Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE FLASH: Adobe Flash ForumAdobe Flash TutorialsAdobe Flash Video TutorialsWeb Streaming ForumAdobe Flash

Hair Pulling Preloader Problem!

Cow Forums : Adobe Flash
Hair Pulling Preloader Problem!
by Terrence Dunlop on Jun 27, 2008 at 5:58:06 pm

Hey all,

I have a preloader that will not work.

Here's the preloader code:

root.loaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);

function progressHandler(myevent:ProgressEvent):void{
//show progress
var myprogress:Number=myevent.target.bytesLoaded/myevent.target.bytesTotal;
bar_mc.scaleX=myprogress;
myTextField_txt.text=Math.round(myprogress*100)+"%";
}

root.loaderInfo.addEventListener(Event.COMPLETE, finished);

function finished(myevent:Event):void{
mySite_mc.play();
}

followed by a second frame with code that centers a movieclip (mySite_mc) of the site in any browser window. Here's that code:


Here's the resizer code:

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener (Event.RESIZE, resizeHandler);

// initialize sizing
resizeHandler (null);

function resizeHandler (event:Event):void {
var MovieWidth:Number = stage.stageWidth;
var MovieHeight:Number = stage.stageHeight;
mySite_mc.x=MovieWidth*.5;
mySite_mc.y=MovieHeight*.5+40;
}



The preloader bar_mc is on the timeline's first frame below the preloader code (on the actions layer), the movieclip holding the mySite_mc and its resize code (on the actions layer) is on the second frame.

The movie loads, but no preloader. Right at the end, the preloader graphics flash onscreen, and then the mySite_mc pops up. The swf then works fine.

I should mention: The same code for the preloader works fine on a timeline where the whole site plays on the same timeline.

Any ideas for me?



Respond to this post   •   Return to posts index

Re: Hair Pulling Preloader Problem!
by Sher Ali on Jun 28, 2008 at 6:40:53 pm

The best approach developing a full flash website is to load the main .swf file inside an empty .swf holder and the preloader will be inside the holder swf so it will show the preloader immediately.

If you use just one main swf and also put the preloader in that swf file to preloader the whole swf file then you might get problems if you have embedded a lot of fonts and also if the actionscript classes are set to be exported to first frame in the publish settings.

As you have the preloader in the same swf so make sure the export actionscript classes are set to 2nd frame in the publish settings.


Sher Ali
Flash & Flex Developer
website: http://www.webeyestudio.com
blog: http://www.kabulinteractive.com/blog
My FlashDen Portfolio

Respond to this post   •   Return to posts index

Re: Hair Pulling Preloader Problem!
by Terrence Dunlop on Jun 30, 2008 at 12:34:49 am

I'm sorry, Sher, I'm something of a noob to this, so I have to get this explained super clearly to me.

The empty holder swf: from a little online research, is that:

a preloader movie clip (which contains the preloader code and preloader graphics only, named "holder") which loads the main .swf, and then on _COMPLETE, it plays the main swf?

Or do you mean nesting the timeline of the main swf in a preloader movie clip whose timeline contains only the loader graphics (and code) and a load call for the main.swf?

Thanks for your time. This is the last thing (besides little tweaks) I have to figure out before I get up a functional flash site.




Respond to this post   •   Return to posts index

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>


FORUMSTUTORIALSMAGAZINEDVDsBOOKSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]