Category Archives: Flash
Raccolta di esempi, istruzioni e guide sul mondo Flash
Actionscript 3: another method to call Main class functions from child classes
No CommentsWritten on February 9, 2009 at 4:19 pm , by adminHere is a variant of the previous post: [sourcecode language="cpp"] //Main.as package src{ import flash.display.Stage; import flash.display.MovieClip; public class Main extends MovieClip { private static var _instance:Main = null; public function Main() { var myChild:Child = new Child(this); } public function callMe():void{ trace(“method called from child class”); } } } [/sourcecode] [sourcecode language="cpp"] //Child.as package more info
Actionscript 3: call Main class functions from child classes
No CommentsWritten on February 9, 2009 at 2:22 pm , by adminOne of the less documented things in actionscript (prove me wrong), is how to access main class functions from child classes. Here is how: [sourcecode language="cpp"] // file Main.as package src{ import flash.display.Stage; import flash.display.MovieClip; public class Main extends MovieClip { private static var _instance:Main = null; public function Main() { _instance = this; trace(“Main more info
Actionscript 3: play movie clip backward
No CommentsWritten on November 6, 2008 at 12:20 am , by adminThis simple code snippled shows how to play a movie clip backward, i.e. from the last frame to the first (in this specific case from frame 100 to frame 1): [sourcecode language="cpp"] myClip.gotoAndStop(100); // move at the end of the clio var playhead:Number; addEventListener(Event.ENTER_FRAME, playBack); // declare an event Listener that calls playBack function at more info
-
First of all go and get a Google Maps API Key, which will be later inserted in the code. You can get it here: http://code.google.com/apis/maps/signup.html Now, download this zip file : it contains a Flash CS3 project that I prepared for you, it’s already setup and ready to go. The only thing you need to more info
-
Using XML files in Actionscript 3 is a subject that would require hours to be described in a satisfactory and exaustive way. The following is a very simple way to open and read an XML file. Here is the XML file: [sourcecode language="xml"] [/sourcecode] And now the Actionscript 3 code: [sourcecode language="cpp"] var xmlLoader:URLLoader = more info
Actionscript 3: add a simple movie clip
No CommentsWritten on November 1, 2008 at 10:58 pm , by adminVery basic and simple piece of information, but nonetheless very important for who is approaching Actionscript 3 for the first time. Here is how you add a position a simple movie clip on the stage. First of all create a movie clip, and in the property panel give to the Class the name myClip, cjust more info
Actionscript 3: get child position index
No CommentsWritten on November 1, 2008 at 10:38 pm , by adminHere is how to retrieve the position index (or if you prefer the level of “depth”) or a child_ [sourcecode language="cpp"] var container:Sprite = new Sprite(); var sprite1:Sprite = new Sprite(); sprite1.name = “sprite1″; var sprite2:Sprite = new Sprite(); sprite2.name = “sprite2″; container.addChild(sprite1); container.addChild(sprite2); var target_A:DisplayObject = container.getChildByName(“sprite1″); var target_B:DisplayObject = container.getChildByName(“sprite2″); [/sourcecode] In this more info
-
Here is how to delete a dinamically generated movieclip first checking if it exists or not. [sourcecode language="cpp"] addchild(myMovieClip); // aggiunge un movieclip if (myMovieClip) if (myMovieClip.parent) myMovieClip.parent.removeChild(myMovieClip); [/sourcecode]
-
The following code allow to pause and resume timeline execution. [sourcecode language='cpp'] // funzione che mette in pausa la timeline function pauseTimeline(howLong:Number):void { stop(); } // funzione che rimette in play la timeline function playTimeline() { play(); } // tempo di pausa in millisecondi var pauseTime:Number=2000; // definizione e inizializzazione del timer var t:Timer = more info