Home
> FlashEff 1 (Discontinued version)
> Topic
Flasheff and pre-loaders
Posted by lawrni
Flasheff and pre-loaders November 25, 2008 12:58PM | Registered: 15 years ago Posts: 2 |
Hi,
I love Flasheff, but I'm having a little problem with combining it with a pre-loader and wondered if anyone can help?
I have an AS3 pre-loader that loads in an external swf file and adds it to the stage via the addChild method. I'm using the loader class, and adding the loader to the stage on Event.Complete. The technique I'm using is described here:
http://newmovieclip.wordpress.com/2007/03/14/preloader-in-flash-cs3-actionscript-30-way/
The external swf file contains several Flasheff animations and initially seems to work, but on closer inspection it looks like the flasheff component animations are now showing out of sync with those of the main movieClip. Its like they start playing before anything else.
Any ideas what I can do to prevent this? - Do I need to ensure no Flasheff transitions on frame 1 to allow it to initialise properly ?
Cheers,
Nick
I love Flasheff, but I'm having a little problem with combining it with a pre-loader and wondered if anyone can help?
I have an AS3 pre-loader that loads in an external swf file and adds it to the stage via the addChild method. I'm using the loader class, and adding the loader to the stage on Event.Complete. The technique I'm using is described here:
http://newmovieclip.wordpress.com/2007/03/14/preloader-in-flash-cs3-actionscript-30-way/
The external swf file contains several Flasheff animations and initially seems to work, but on closer inspection it looks like the flasheff component animations are now showing out of sync with those of the main movieClip. Its like they start playing before anything else.
Any ideas what I can do to prevent this? - Do I need to ensure no Flasheff transitions on frame 1 to allow it to initialise properly ?
Cheers,
Nick
Re: Flasheff and pre-loaders November 25, 2008 09:18PM | Registered: 15 years ago Posts: 2 |
Hi,
Problem solved: In the document class for the loaded swf file I added a stopMovieClip() function that was called in the class constructor. StopMovie cycled through all the child clips and stopped them (see below). Then I added an eventlistener to the class for when it was added to the stage - it ran another function that started all the movieClips again. This worked fine.
It seemed like the loader function was playing the flasheff parts of the movieclip before it was added to the stage.
Problem solved: In the document class for the loaded swf file I added a stopMovieClip() function that was called in the class constructor. StopMovie cycled through all the child clips and stopped them (see below). Then I added an eventlistener to the class for when it was added to the stage - it ran another function that started all the movieClips again. This worked fine.
It seemed like the loader function was playing the flasheff parts of the movieclip before it was added to the stage.
public class DocumentClass extends MovieClip { public static var stage:Stage; public static var root:DisplayObject; public function DocumentClass() { addEventListener(Event.ADDED_TO_STAGE, initialize); stopMovieClip(this); } private function initialize(evt:Event):void { DocumentClass.stage = stage; DocumentClass.root = this; startMovieClip(this); // set the default stage scale mode and alignment stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; removeEventListener(Event.ADDED_TO_STAGE, initialize); } public function stopMovieClip(mc:MovieClip):void { mc.stop(); for (var i:int = 0; i < mc.numChildren; i++) var mcChild = mc.getChildAt(i); if (mcChild is MovieClip) stopMovieClip(mcChild); trace("Stop--" + mcChild); } public function startMovieClip(mc:MovieClip):void { mc.play(); for (var i:int = 0; i < mc.numChildren; i++) var mcChild = mc.getChildAt(i); if (mcChild is MovieClip) startMovieClip(mcChild); trace("start--" + mcChild); } } }
Re: Flasheff and pre-loaders November 26, 2008 08:41AM | Admin Registered: 15 years ago Posts: 270 |
Actually this problem exists for any Flash clip, not just the ones with FlashEff. For example, if I would use the Loader class to load an external .swf file which contains some time line animations starting on frame 1, that animation would start playing as soon as the necessary assets were loaded, even if the entire content was not completely loaded yet.
The solution is simply to put a stop() function on the first frame and start the animation from the second frame. Once the entire content is loaded, I just access the content and tell it to start playing the animation from the second frame with a gotoAndPlay(2) or gotoAndStop(2) (which ever is required).
The solution is simply to put a stop() function on the first frame and start the animation from the second frame. Once the entire content is loaded, I just access the content and tell it to start playing the animation from the second frame with a gotoAndPlay(2) or gotoAndStop(2) (which ever is required).
Re: Flasheff and pre-loaders December 05, 2008 05:21PM | Registered: 15 years ago Posts: 6 |
I'm an AS3 newbie; I come from the world of Director and dabbled in AS2. My experience in creating a "preloader" or using tricks to preload elements is way out of date and I need some help doing it right.
I've read and tried a half dozen methods of building a preloader on AS3, with poor results and I'd really appreciate some help from the Jumpeye team. I see the code in the post above; but would GREATLY appreciate a step-by-step in how to create a "Jumpeye flasheff approved" preloader to speed up my animation: http://www.the41.com/flashtest.asp
bstewart [at] the41.com
Edited 1 time(s). Last edit at 12/08/2008 04:37PM by brettestewart.
I've read and tried a half dozen methods of building a preloader on AS3, with poor results and I'd really appreciate some help from the Jumpeye team. I see the code in the post above; but would GREATLY appreciate a step-by-step in how to create a "Jumpeye flasheff approved" preloader to speed up my animation: http://www.the41.com/flashtest.asp
bstewart [at] the41.com
Edited 1 time(s). Last edit at 12/08/2008 04:37PM by brettestewart.
Re: Flasheff and pre-loaders December 06, 2008 07:25PM | Registered: 15 years ago Posts: 2 |
Re: Flasheff and pre-loaders December 09, 2008 07:38AM | Admin Registered: 15 years ago Posts: 270 |
I've posted an example on how to preload FlashEff animations: http://www.flasheff.com/forum/read.php?23,1207. You can use the same technique to preload other stuff.
Re: Flasheff and pre-loaders December 15, 2008 04:46PM | Registered: 15 years ago Posts: 6 |
Re: Flasheff and pre-loaders December 16, 2008 06:21AM | Admin Registered: 15 years ago Posts: 270 |
Sorry, you do not have permission to post/reply in this forum.