Document class, how to ....?
Hi,
the school project I am doing now requires a text editor module. as the user open new document for this module, some headers, section and subsections will be created automatically and displayed on text panel. all user need to do is to add paragraph/content to that section. the module itself is also able to create table. the headers, section and subsectiions are always fixed for each new document class created.
I am thinking to create some extended document class for this purpose. But as I read through java API documentation and Document class source code, I am completely lost. Document, View, EditorKit...blablabla .....a lot of classes and it completely overwhelmed me.
May I request help from any java gurus here to help me regarding document class, or at least give some hints on how to start creating a extended document class to fit in my module. I have tried google and any tutorial regarding this document class seems to be rare.
thank you.
anyone can help? thank you
Similar Messages
-
ArchiveLink - creating a new document class - how?
Hello,
I want to store csv files on our archive via archive link.
But the file type that I need is not available in R/3.
Ok, I think here is where my solution could be found:
-> archive link -> basic customzing -> edit document classes
Document class: I add "CSV"
But what´s behind the MIME type of a web object.
What do I have to do to fill this field with something useful.
What is to implement behind?
Any help is appreciated!
Best regards
Dirkif you go throught there archive link creation in the archiveing process ...
FTWP is the comfiguration tcode for archive of DART extract ....
there Comtemporary Repository has to be created with document area-> here dropdown is there for for archieve link , for MIME ,, BFT ...etc ..
this will decide the file format .....
i am working in DART Exctraction project .....we use to create the archive link for that ......
normally in archiving processs all the files stored in csv only
Girish -
How to configure "document class"
Dear all,
In Change management function, we can add document (doc/xls/ppt/txt.. etc) in business transaction. And, in property of the document, there is a "Document Class" items, which is usually "Document for business transaction".
Does anyone know how to configure this item? Please help. Thanks.No, you need to follow the rules and put the jar in the WEB-INF/lib folder.
-
How can a textInput variable access a document Class?
I have a document class which creates a body of text on-the-fly at runtime. I am trying to figure out (though I haven't taken any steps to do so yet) how to use a textinput field on the stage of a Flash document that calls the Document Class "MyClass" (just for example's sake"). The class file is MyClass.as and is located in the same directory as the FLA and resultant SWF. I would like that textInput.text value to change the body text of the MyClass text. The reason I am using MyClass is because I am performing special visualizations with the text that are encapsulated in MyClass.
Thanks in advance for any feedback.
-markerlineI hadn't realized that this import was what was necessary. Thank you. However now with the imported property and my EnterFrameEvent, the rendered text is still not updating.
Here is my complete Document Class:
package
import away3d.containers.ObjectContainer3D;
import away3d.extrusions.TextExtrusion;
import away3d.primitives.TextField3D;
import flash.events.Event;
import flash.display.MovieClip;
import wumedia.vector.VectorText;
import flash.text.TextField;
import flash.text.TextFieldType;
public dynamic class FontExtrusionDemo extends Away3DTemplate
[Embed(source="Fonts.swf", mimeType="application/octet-stream")]
protected var Fonts:Class;
protected var container:ObjectContainer3D;
protected var extrusion:TextExtrusion;
protected var text:TextField3D;
public var txtFld:TextField;
public var myString:String;
public function FontExtrusionDemo()
super();
protected override function initEngine():void{
super.initEngine();
this.camera.z=0;
VectorText.extractFont(new Fonts());
public function setString():void{
this.myString=myString;
txtFld= new TextField();
txtFld.x=txtFld.y=20;
txtFld.width =100;
txtFld.height=20;
txtFld.border=txtFld.background=true;
txtFld.type=TextFieldType.INPUT;
addChild(txtFld);
stage.focus=txtFld;
protected override function initScene():void{
super.initScene();
myString="1";
setString();
text = new TextField3D("Vera Sans",{
text:myString,
align: VectorText.CENTER}
extrusion = new TextExtrusion(text, {
depth: 10,
bothsides:true}
container = new ObjectContainer3D(text, extrusion, { z:300 });
scene.addChild(container);
protected override function onEnterFrameEvent(event:Event):void{
super.onEnterFrameEvent(event);
text = new TextField3D("Vera Sans",{
text:String(txtFld.text),
align: VectorText.CENTER}
extrusion = new TextExtrusion(text, {
depth: 10,
bothsides:true}
//container = new ObjectContainer3D(text, extrusion, { z:300 });
//scene.addChild(container); // IF I UNCOMMENT THIS THEN A NEW CHILD WILL BE ADDED AT EVERY FRAME, which is not desired.
container.rotationY=(container.rotationY+1)%360;
if (container.rotationY>90&&container.rotationY<270){
text.screenZOffset=10;
} else {
text.screenZOffset=-10; -
NEED TO KNOW HOW CONVERT GIF FILE TO SYMBOL FROM DOCUMENT CLASS
ROBERT LEAHONG
COMPUTER PROGRAMMER / ASP Web Devloper
Hello,
I need to convert a GIF file (PICTURE) to a symbol (Button) From within The Document Class using ActionScript 3.0 .
Thanks in advance for your help.So you imported a .gif into the library and need to get to it from the document class? If that's the case you need to right-click the image in the library, select properties, select the ActionScript tab and then set it to export for ActionScript. Give it a class name - I'll use myGif for example. You'll see it will have a base class of BitmapData...
Then in your document class you can just instantiate it like:
var myImageData:BitmapData = new myGif();
You can turn it into a useable image that you can place on stage by putting it into a Bitmap object:
var myImage:Bitmap = new Bitmap(myImageData);
If you want to make a button out of it, ie make it clickable - stick it into a Sprite:
var mySprite:Sprite = new Sprite():
mySprite.addChild(myImage);
addChild(mySprite);
mySprite.addEventListener(MouseEvent.CLICK, clicked);
function clicked(e:MouseEvent):void
trace("clicked");
HTH -
Document Classes and other Questions
Basically, i am working on an application that will eventually be deployed to the desktop as an AIR application.
I am wanting to create an Analogue clock and Digital clock with a button that toggles the display between either one when pressed. As well as this, i will be wanting to display the Date below, i am having a number of issues however.
I have the code sorted for three of the four components, i have not attempted to figure out the button thus far as i would be more than happy to have the digital clock, analogue clock and date all being displayed on a drag and drop desktop application first. When i say i have it sorted, i have a fully working analogue clock which i have managed to display on the desktop through air on its lonesome, however, i did not include the drag and drop function. For the digital clock and date components i am not sure how to configure them into document classes. The main issue i am having is i do not know if you can reference a dynamic text box within a movie clip to a document class.
This is the code to show the date
[code]{
var currentTime:Date = new Date();
var month:Array = new Array("January","February","March","April","May","June","July","August","September","Octo ber","November","December");
var dayOfWeek:Array = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
date_text.text = dayOfWeek[currentTime.getDay()] + " " + currentTime.getDate() + " " + month[currentTime.getMonth()] + " " + currentTime.getFullYear();
[/code]
I have put the actionscript frame inside the movie clip file, and i have given both the movie clip, and the dynamic text box within the movie clip the instance name "date_text".
Basically, i am just struggling in how to put this code into a working document class, since the digital clock and date functions are both, some what similar, i feel the solution to one will more than likely lead to me discovering the solution for the other.
The other problem i am having, i do not know how i will display all of the components on one air application. I am assuming, that you create one other document class file which links the other four together? i have tried to do this by just linking a new FLA file with the analogue clock, but it does not work. The code for that is below.
[code]package
import flash.events.Event;
import flash.display.MovieClip;
public class time1 extends MovieClip
public var now:Date;
public function time1()
// Update screen every frame
addEventListener(Event.ENTER_FRAME,enterFrameHandler);
// Event Handling:
function enterFrameHandler(event:Event):void
now = new Date();
// Rotate clock hands
hourHand_mc.rotation = now.getHours()*30+(now.getMinutes()/2);
minuteHand_mc.rotation = now.getMinutes()*6+(now.getSeconds()/10);
secondHand_mc.rotation = now.getSeconds()*6;
[/code]
That is the original clock document class (3 Movie clips for the moving hands, and the clock face is a graphic, which i may have to reference somehow below)?
[code]package
import flash.display.MovieClip;
public class main extends MovieClip
public var hourHand_mc:time1;
public var minuteHand_mc:time1;
public var secondHand_mc:time1;
public function main()
hourHand_mc = new SecondHand();
addChild(mySecondHand);
hourHand_mc.x = 75;
hourHand_mc.y = 75;
minuteHand_mc = new SecondHand();
addChild(mySecondHand);
minuteHand_mc.x = 75;
minuteHand_mc.y = 75;
secondHand_mc = new SecondHand();
addChild(mySecondHand);
secondHand.x = 75;
secondHand.y = 75;
}[/code]
This is my attempt at creating the main document class in a seperate FLA file to attempt to load the analogue clock, and later on the Digital Clock, Date Function and Toggle Display button in the same AIR application.
Any help on this is much appreciated, i have been reading up a lot on it through tutorials and the like, but i can't seem to fully grasp it.why do you have code in a movieclip?
if you want to follow best practice and use a document class you should remove almost all code from timelines. the only timeline code that might be reasonably used would be a stop() on the first frame of multiframe movieclips.
so, you should have a document class. that could contain all your code but it would be better to just have your document class create your 2 clocks and date objects and possibly manage toggling between the two clocks. you could have a separate class the tracks the time and date and that class is used by your two clock classes and your date class. -
Preloader in Document Class Help.
Hello,
I want to know that how can I add a Preloader to my existing document class. In my FLA all content is on 1st Frame. I'm loading an external image to a MovieClip which is on 1st frame and on stage. My document class is working fine but when i try to add any preloading script, its not working...
Can any one please help me in this regard..
A Garden of Thanks.
My Document Class is here... (This was also a tutorial which I'm using..)
package com.ahmad.bg
//import all classes
import caurina.transitions.Tweener;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageDisplayState;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.URLRequest;
public class MainClass extends MovieClip
//create variables
private var loader:Loader;
private static const IMAGE_PATH:String = "bgs/bg.jpg";
public function MainClass() {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, stageResize);
//load external image
loader = new Loader();
loader.load(new URLRequest(IMAGE_PATH));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, showImage);
pic.addChild(loader);
private function showImage(e:Event):void
try {
e.target.content.alpha = 0;
Tweener.addTween(e.target.content, { alpha:1, time:1, transition:"easeOutSine" } );
e.target.content.smoothing = true;
} catch (e:Error) { };
stageResize();
private function stageResize(e:Event=null):void
pic.x = 0;
pic.y = 0;
pic.scaleX = pic.scaleY = 1;
if ((stage.stageHeight / stage.stageWidth) < pic.height / pic.width) {
pic.width = stage.stageWidth;
pic.scaleY = pic.scaleX;
} else {
pic.height = stage.stageHeight;
pic.scaleX = pic.scaleY;
pic.x = stage.stageWidth / 2 - pic.width / 2;
pic.y = stage.stageHeight / 2 - pic.height / 2;
//my bottom navigation
bottomNav.x = Math.floor(stage.stageWidth / 2 - bottomNav.width / 2);
bottomNav.y = Math.floor(stage.stageHeight - bottomNav.height - 0);package com.ahmad.bg
//import all classes
import caurina.transitions.Tweener;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageDisplayState;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.events.ProgressEvent;
public class MainClass extends MovieClip
//create variables
private var loader:Loader;
private static const IMAGE_PATH:String = "bgs/bg.jpg";
public function MainClass() {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, stageResize);
//load external image
loader = new Loader();
loader.load(new URLRequest(IMAGE_PATH));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, showImage);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preload_image, false, 0, true);
private function preload_image(event:ProgressEvent):void
var per = int((event.bytesLoaded / event.bytesTotal) * 100);
pic.addChild(loader);
//make a textfield or preloader animation and assign this per to it.
private function showImage(e:Event):void
try {
e.target.content.alpha = 0;
Tweener.addTween(e.target.content, { alpha:1, time:1, transition:"easeOutSine" } );
e.target.content.smoothing = true;
} catch (e:Error) { };
stageResize();
private function stageResize(e:Event=null):void
pic.x = 0;
pic.y = 0;
pic.scaleX = pic.scaleY = 1;
if ((stage.stageHeight / stage.stageWidth) < pic.height / pic.width) {
pic.width = stage.stageWidth;
pic.scaleY = pic.scaleX;
} else {
pic.height = stage.stageHeight;
pic.scaleX = pic.scaleY;
pic.x = stage.stageWidth / 2 - pic.width / 2;
pic.y = stage.stageHeight / 2 - pic.height / 2;
//my bottom navigation
bottomNav.x = Math.floor(stage.stageWidth / 2 - bottomNav.width / 2);
bottomNav.y = Math.floor(stage.stageHeight - bottomNav.height - 0);
Oh.. Thanks.. its working now... Thanks aloooooooooooooot.....
Any other tip if you have a time to give me will be a greatful to you...
Thanks again for your precious time.. I've seen your Awesome Portfolio at your website.... -
just trying to understand the concept here.
I have a flash animation '.fla' file with it's corresponding
document class that provides the code to control it.
I want to instantiate an instance of that document class in
another class.
Do I simply put the document class and it's
corresponding'.fla' file together inside the package folder ?
Once I declare the document class as a new object within my
new class, how does the document class link to the it's
corresponding .fla animation ?
To summarize, what I am trying to do, is create a reusable
class or component from this .fla file with its document class. I
just dont know how to proceed.more than one swf can use the same document class. but
"animation" or other timeline assets will not be shared. -
Document Class {add image library + preloader}
Hi there,
I'm learning AS3 and want to use a document class to control
my Flash movie (i.e. I want the time line to be completely empty).
I've run into two problems.
1.) I have a large image in the Flash library which I setup
with "Export for ActionScript", but I was unable to work out how to
add the image to the displaylist as i think it needs to be added as
BitmapData? Can anyone advise how best to do this and provide an
example please.
2.) I have yet to find a simple example of creating a
preloader in a document class? There was a BizTalk website tutorial
but I don't think that explained very well what the code was doing
- so I'm hoping someone here can provide a code example with
comments (if the code example could tie into the point 1. above
that would be brilliant).
Finally, also I'm unsure of how a document class can preload
content that doesn't actually exist until the class itself creates
the content, just seems a bit odd?
Any help with these two issues would be greatly appreciated!
Thank you :)
Kind regards,
M.Hi there,
I'm learning AS3 and want to use a document class to control
my Flash movie (i.e. I want the time line to be completely empty).
I've run into two problems.
1.) I have a large image in the Flash library which I setup
with "Export for ActionScript", but I was unable to work out how to
add the image to the displaylist as i think it needs to be added as
BitmapData? Can anyone advise how best to do this and provide an
example please.
2.) I have yet to find a simple example of creating a
preloader in a document class? There was a BizTalk website tutorial
but I don't think that explained very well what the code was doing
- so I'm hoping someone here can provide a code example with
comments (if the code example could tie into the point 1. above
that would be brilliant).
Finally, also I'm unsure of how a document class can preload
content that doesn't actually exist until the class itself creates
the content, just seems a bit odd?
Any help with these two issues would be greatly appreciated!
Thank you :)
Kind regards,
M. -
Flash CS5 - document class relative path & package location
It seems I have no trouble pointing an FLA's document class to my project's class package when the FLA is at the same root level as the package's top-level directory. However, if the FLA is nested in a sub-directory, then relative paths to a class nested in the package will not work.
example package & class location : com.company.project.ClassName
Case1 :
Package location : \MyProject
FLA location : \MyProject
where document class path is : "./com/company/project"
Case 2 ( does not work ) :
Package location : \MyProject
FLA location : \MyProject\MySubFolder
where document class path is : "../com/company/project"
If someone can provide an explanation as to why nested FLAs can't point to custom packages in parent-level directories, OR demonstrate how this can be done, it would be much appreciated.
Now that I think on, both paths are relative, which makes this more confusing.
Thank you.You are correct.
I'm setting the "Document class" of an FLA file to a custom Class.
The class is embedded/nested in the package directories of my project.
The FLA is nest not at the same level as the root of the package, but in a sub-directory.
Therefore, I need a relative path to point to the parent directory, then to the package.
The occurs in both Win and Mac.
I'm almost expecting someone to say FLAs can only point to packages in the same directory, but does not seem correct. Application-level classpaths can reference anywhere on your system, but are global. Document-level classpaths should be able to point to relative paths since a project needs to be portable, right? See attached image for example. -
Accessing value in document class
hello i am trying to acces a value in the document class. but i can't get it to work.
what i have is:
can someone tell me how i should access the myArray value?
bomberman.as:
package {
import flash.display.MovieClip;
public class bomberman extends MovieClip {
public var myArray:Array=[]; //trying to access this value
public function bomberman() {
init();
//trace(document.docClass);
private function init() {
var square:Array=[];
for (var i:Number=0;i<11;i++) {
for (var j:Number=0;j<11;j++) {
var temp:grassSquare;
if (i==0||i==10) {
temp=new grassSquare(i*50,j*40);
addChild(temp);
square.push(temp);
} else if (i%2!=0) {
if (j==0||j==10) {
temp=new grassSquare(i*50,j*40);
addChild(temp);
square.push(temp);
myArray.push(false);
} else {
myArray.push(true);
} else {
if (j%2==0) {
temp=new grassSquare(i*50,j*40);
addChild(temp);
square.push(temp);
myArray.push(false);
} else {
myArray.push(true);
bomberman.fla:
import flash.events.KeyboardEvent
var User1:Player1=new Player1;
stage.addEventListener(KeyboardEvent.KEY_DOWN, User1.fl_SetKeyPressed);
User1.x=75;
User1.y=60;
addChild(User1);
Player1.as:
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.KeyboardEvent
import flash.ui.Keyboard
public class Player1 extends MovieClip {
private var upPressed:Boolean = false;
private var downPressed:Boolean = false;
private var leftPressed:Boolean = false;
private var rightPressed:Boolean = false;
private var currentSquare:uint=12;
public function Player1() {
this.addEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey);
//stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_SetKeyPressed);
public function fl_MoveInDirectionOfKey(event:Event)
if (upPressed && this.y>=100 /*&&document.myArray[currentSquare-1]*/)
this.y -= 40;
upPressed = false;
currentSquare-=1;
if (downPressed && this.y<=340 /*&& this.myArray[currentSquare+1]*/)
this.y += 40;
downPressed = false;
currentSquare+=1;
if (leftPressed && this.x>=125 /*&& /*this.myArray[currentSquare-11]*/)
this.x -= 50;
leftPressed = false;
currentSquare-=11;
if (rightPressed && this.x<=425 /* && /*this.myArray[currentSquare+11]*/)
this.x += 50;
rightPressed = false;
currentSquare+=11;
trace(currentSquare);
public function fl_SetKeyPressed(event:KeyboardEvent):void
switch (event.keyCode)
case Keyboard.UP:
upPressed = true;
break;
case Keyboard.DOWN:
downPressed = true;
break;
case Keyboard.LEFT:
leftPressed = true;
break;
case Keyboard.RIGHT:
rightPressed = true;
break;i have this code now and it gives me a bunch of errors. could someone tell me what's going wrong ?
errors are in the red code.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 25
1093: Syntax error.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 27
1084: Syntax error: expecting identifier before this.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 27
1084: Syntax error: expecting colon before minusassign.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 28
1084: Syntax error: expecting rightbrace before semicolon.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 31
1084: Syntax error: expecting rightparen before if.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 31
1084: Syntax error: expecting identifier before dot.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 31
1093: Syntax error.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 33
1084: Syntax error: expecting identifier before this.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 33
1084: Syntax error: expecting colon before plusassign.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 34
1084: Syntax error: expecting rightbrace before semicolon.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 37
1093: Syntax error.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 39
1084: Syntax error: expecting identifier before this.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 39
1084: Syntax error: expecting colon before minusassign.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 40
1084: Syntax error: expecting rightbrace before semicolon.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 43
1084: Syntax error: expecting rightparen before if.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 43
1084: Syntax error: expecting identifier before dot.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 43
1093: Syntax error.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 45
1084: Syntax error: expecting identifier before this.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 45
1084: Syntax error: expecting colon before plusassign.
C:\Users\Jannes\Desktop\dev\Player1.as, Line 46
1084: Syntax error: expecting rightbrace before semicolon.
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.KeyboardEvent
import flash.ui.Keyboard
public class Player1 extends MovieClip {
private var upPressed:Boolean = false;
private var downPressed:Boolean = false;
private var leftPressed:Boolean = false;
private var rightPressed:Boolean = false;
private var currentSquare:uint=12;
public function Player1() {
this.addEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey);
//stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_SetKeyPressed);
public function fl_MoveInDirectionOfKey(event:Event)
if (upPressed && this.y>=100 && MovieClip(root).myArray[currentSquare-1]*/)
this.y -= 40;
upPressed = false;
currentSquare-=1;
if (downPressed && this.y<=340 && MovieClip(root).myArray[currentSquare+1]*/)
this.y += 40;
downPressed = false;
currentSquare+=1;
if (leftPressed && this.x>=125 && MovieClip(root).myArray[currentSquare-11]*/)
this.x -= 50;
leftPressed = false;
currentSquare-=11;
if (rightPressed && this.x<=425 && MovieClip(root).myArray[currentSquare+11]*/)
this.x += 50;
rightPressed = false;
currentSquare+=11;
trace(currentSquare);
public function fl_SetKeyPressed(event:KeyboardEvent):void
switch (event.keyCode)
case Keyboard.UP:
upPressed = true;
break;
case Keyboard.DOWN:
downPressed = true;
break;
case Keyboard.LEFT:
leftPressed = true;
break;
case Keyboard.RIGHT:
rightPressed = true;
break; -
Access a mc or textfeild from a non document class.
Hey all.
This use to be simple in as2, but seems to allude me from as3. It used to be simple to access an object you put on the stage like a mc or dynamic text field by simply using _root.instanceName ect. Now I see references to making references to the Stage and such like:
private var stage:Stage;
stage = stageRef;
and I am still confused.
What I have going on is, I have placed a movieclip on the stage in Flash and gave it an instance name of Cell_mc.
I have a cusom class that extends MovieClip with the following imports
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.utils.Timer;
This Class is tied to a set of MovieClips in my Library.
I have a listener: this.addEventListener(MouseEvent.MOUSE_DOWN,pickUp);
And a function:
private function pickUp(event:MouseEvent):void
this.startDrag();
_interval = new Timer(100);
_interval.addEventListener(TimerEvent.TIMER,onInterval);
_interval.start();
And
private function onInterval(event:TimerEvent):void
//Set up hit test
this.hitArea(Cell_mc)
trace("hit");
I get the following error whenever I try to access an object I placed on the stage from anywhere other than the document class:
1120: Access of undefined property Cell_mc.
How do I access the cell_mc that is already on the stage from this non-document class?
Thanks guys.try:
private var stage:Stage;
stage = stageRef;
and I am still confused.
What I have going on is, I have placed a movieclip on the stage in Flash and gave it an instance name of Cell_mc.
I have a cusom class that extends MovieClip with the following imports
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.utils.Timer;
This Class is tied to a set of MovieClips in my Library.
I have a listener: this.addEventListener(MouseEvent.MOUSE_DOWN,pickUp);
And a function:
private function pickUp(event:MouseEvent):void
this.startDrag();
_interval = new Timer(100);
_interval.addEventListener(TimerEvent.TIMER,onInterval);
_interval.start();
And
private function onInterval(event:TimerEvent):void
//Set up hit test
this.hitArea(MovieClip(root).Cell_mc)
trace("hit");
I get the following error whenever I try to access an object I placed on the stage from anywhere other than the document class:
1120: Access of undefined property Cell_mc.
How do I access the cell_mc that is already on the stage from this non-document class?
Thanks guys. -
Preloader and Document Class BIG question (yeap please help)
Hy,
I know that this its a question posted many, many times, but
after searching the net, reading a lot of books and searching this
forum too, I cant get out with a solution. If I'd say for sure
there is no possibility to create something like this, I just go
back to old methods but is not the scope of Adobe with AS3 to
encourage the use of OOP principle or not?
The problem:
I have a single fla file (AS3) with a single frame on
timeline, frame that its there when you will create the file with
flash. In the library I have different symbols, that for simplicity
are only jpg image, (BitmapData) checked for export for
ActionScript and exported on frame one. An external .as file called
DocumentClass its off course my Document Class
This its all that I want to do with the fla, the goal its to
create, animate etc. only with AS3 in external classes, no timeline
script. I don't want to load external files, XML, or else in this
movie. I just want a single swf after compilation, no additional
files.
Ok, how do I create a preloader that will take care of
starting the logic after the whole swf its loaded and in the same
time shows the user a percentage or a load bar or something that
its not the blank screen when the swf its downloading. I want to do
this without another swf that load this swf, or timeline scripts,
or place all the content on second frame and then gotoAndStop to
the third frame. All this are not solution but cheap tricks, that
are against all this OOP principle that I just continue to read in
books and here from guru programmers.
The big question is:
It is possible to create a preloader, when use a document
class with your fla? And if yes, how?
I know that the Document Class its not instantiated if its
not fully loaded, if that's true when the document class will be
fully loaded? maybe after the whole movie its loaded? And, if its
true, it will never show a percentage bar "while" the movie its
loaded. And if that's true WHY use a document class anyway?
Thank you for reading this and I really wait to get some
answer.I am pretty sure you cannot do self preloader with one frame
and all the objects in the library. I guess the key here is
one-frame design. Screen refreshes (renders) only when all the
scripts in the frame are executed - this is a very important thing
to understand about how Flash works. Yes, you can force screen
refresh with updateAfterEvent() method but it is attached to a
handful of events only (MouseEvent and TimerEvent) but, again, all
this functionality is available only after first frame scripts are
executed. Thus, it seems like the only way to create preloader from
within SWF is to use multiple frames and set library objects to
load in later (not first) frame.
quote:
And if that's true WHY use a document class anyway?
Well, preloader is the last thing that would be on my mind in
terms of using AS3 ability to link DocumentClass to the top movie.
This feature allows for very sophisticated architectural
approaches. It has no connection to preloader as to any other
features developer wants to implement. Neither it depends on or
negates timeline. As a matter of fact, although I love one-frame
applications, I find on numerous occasions that my application
would be more efficient if I used several (at least two) frames.
gotoAndStop is not deprecated. It is a valid MovieClip class'
method. After all, having only one frame doesn't mean not having
frames at all - there is one already. Frames are fundament of
Flash. AS3 did introduce frameless entities like Sprite, etc. but
it doesn't mean that frames are going anywhere.
I would agree that timeline code is inferior to
classed/packaged (read: better organized) code but, still, how is
it not OOP? Frame is an Object, right? Why using timeline is cheap
and not a solution?
On a side note, I see too many times how some authors (and
managers) are pushing their agenda (or close mindedness) onto their
audience with no real substantiation. Claiming that timeline in
Flash is not valid architectural decision from OOP standpoint is
totally wrong. As wrong as strict adherence to design patterns. I
don't think there is sharply defined "right" or "wrong" in
programming. One finds the best optimal solution. The goal is to
create something that works fine. Unless, of course, the process is
the goal - but very few of us can afford focusing on the process. -
IPM & CIS and Document Class creation
If I've to setup a new Content Management System with process management, what are the advantages I get if I integrate UCM with IPM?
1. Can't IPM provide the versioning and document management features?
2. How can I create various document classes (as in Documentum, FileNet)? The idea is to create various document classes and associate folders and workflows with those classes. Thus once created, documents automatically go into workflow. Note that workflows can be associated with folders. I want them to be associated with document types.
ThanksIts more along the lines of how do I get started. This is part of my homework for my Intro to Programming class. What I have so far is
package cardCode
import flash.display.MovieClip;
public class Card extends MovieClip
public var cardValue:Number;
public var cardSuit:String;
public function card() {
// constructor code
I don't know how to go about assigning values and suits. The final outcome wil be so that you can compare two cards and a trace statement will appear stating which card wins. -
Organising document class?
Hi team,
I am using a document class for a project to keep the code off the main timeline - only problem is now my document class is running to almost 2000 lines of code and becoming unwieldy to scroll through and find stuff. Is there any way I can better organise this? Or should I be building in some other way?
I am really not very sure on how classes actually work. I have got this document class working but that is about as good as it gets. Any help would be greatly appreciated.
cheers
SubWhen you are getting into thousands of lines of code, there is not alot you can do to avoid having to scroll thru it to find things, though you can do things to reduce the amount of scrolling needed.
What you could do is go thru the code and organize it into functional sections. To aid in the need to scroll to find things, you can make use of keywords as comments in combination with the Find tool (the magnifying glass in the toolbar), and use it to jump to sections.
You could probably break it all down into separate class files, but then it might be even moreso unwieldy for you to have to remember which file you need to look at for different things. Still, for major functional divisions this can be useful.
Maybe you are looking for
-
Portal front end and R/3 back end
Hi All, Is it possible to debug R/3 backend from the front end Portal. I want to stop at the R/3 program when I click a link in the front end portal.... Thanks Ricky
-
General query regarding availability of Older Versions of Connector bundles
Hi Guys, How can I download the older versions of Connector bundles. I wish to download PeopleSoft User Management Connector 9.1.0. But the official Oracle website shows only some 11.x.x version. If I want to download some older versions, is there a
-
Displaying and manipulating an BufferedImage
I have to program a game in Java for a university course. Therefore I need to display a quite big image (the game field). I tried to display the image with an own Panel Class ImagePanel: public class ImagePanel extends JPanel { private BufferedIm
-
I accidentally unistalled my device from my itunes, how do i add another device?
.
-
I turned on my macbook pro and ALL my libraries and albums are gone from iPhoto, any ideas
I turned on my macbook pro and ALL my libraries and albums are gone from iPhoto, any ideas I already tried the hold down option command key and rebuild, didn't work HELP PLEASE no I do not have a bckup