EventListener EVENT.ENTER_FRAME as we all know is useful to trigger function you want to check up on conditions for a indefinite period of time. e.g. A check for game over state in a flash game. However, to control the flow of the your flash projects, usually we build only one of these and employ it to the stage trigger various function to have a better control over the code.
Over the weekend, I was rushing for some project of mine coding some AS3 package and I kept getting errors that goes like … “Error 5000 : The Class “xxx” must subclass “flash.display.MovieClip” since it is linked to a library symbol of that type” ; as much as I love AS3.0, it is frustrating sometimes to encounter error which didn’t help users to locate or fix the bug. I hope things will be better in the upcoming CS4.
Two possible situation as listed below.
1. Forget to import flash.display.* which is necessary for all display objects on stage.
Flash Actionscript IDE does not debug or trace for errors on real time coding so, most of the time the programmers will forget what’s happening.
2. Do not add function Brackets for Class
This is very common but surprisingly this is the most common mistake I do every time I script a package document class. Note: This error is hard to spot as the class is very near to the method functions. Just remember the syntax no function like brackets for class. e.g. like samples below :-
package{//REMEMBER : Add import associated with the display.import flash.display.*//REMEMBER : class does not have () like method functions.publicclass docClass extendsMovieClip{publicfunction docClass(){trace("Class Loaded Successfully");
}}}
Hmmm, interesting. I was playing around with Adobe tweening classes just last week. These tweening classes are the default ones found in CS3 (Note this is not the open source ones, as listed in this post here)
Here are the sample tweener class of motion tween-y and fade effect in action. (we are going to move the movieClip up and down and with the fade effect altogether).
Today’s tutorial is a bit complex, but it solved a lot of issues faced by flash developer in AS3.
We will be touching on various subjects such as: -
Creating xml schema of your own.
Easier way of doing xml data retrieval AS3 style.
Loads the xml data into Listbox class.
NOTE : Listbox or List is a component in Flash so, it needs a separate import and special event Listener for that. You will get an error if you try to apply regular addEventListener like MouseEvent to it.
I just came across these Tweener Class while browsing through Google just today - find it quite interesting for those interested in building interactive applications using AS3.
Firstly it is lightweight and does not need to code much to get movement animation you desire e.g. rotation, linear tween and stuff you do in the normal tweening in Flash. You can actually use this class, to build some lightweight interactive menu stuff project.
Check out the sample SWF I Attached Here. A cute image movieClip called CuteMC is used for this demonstration and also a status dynamic text container in the stage. Hah..ha Check out my summersault doggy.
All you need to do is to download the AS3 version of the actionscript file and unzip the folder caurina to your same swf of your project.
Below are my source code sample used to do some simple tweening as shown above.