-
AS3, preloader not showing until 90% loaded
hello everybody,
I stuck in trouble again,i m using this code for my progress bar but it does not appear on "simulate download" too, it appears for a moment when it reaches nearby 100% & goto next frame
All my script is written on keyframe & no document class.
How can i get rid of such an unusual behaviour?
stop();
import fl.controls.*;
addEventListener(Event.ENTER_FRAME,prog);
function prog(eve:Event)
{
prgb.setProgress(stage.loaderInfo.bytesLoaded,stag e.loaderInfo.bytesTotal);
perc.text=Math.round(stage.loaderInfo.bytesLoaded * 100/stage.loaderInfo.bytesTotal)+"% loaded";
if(stage.loaderInfo.bytesLoaded==stage.loaderInfo. bytesTotal)
{
removeEventListener(Event.ENTER_FRAME,prog);
removeChild(prgb);
gotoAndStop(2);
}
-
Why don't you use ProgressEvent.PROGRESS instead of ENTER_FRAME?
It works way better and is much easier to use.
-
I have this exact same issue, does anyone have a solution? here is my code
Actionscript Code:
stop();
this.addEventListener(Event.ENTER_FRAME, loading);
function loading(e:Event):void{
var total:Number = this.stage.loaderInfo.bytesTotal; var loaded:Number = this.stage.loaderInfo.bytesLoaded;
logo_loader.scaleX = loaded/total; loader_txt.text = Math.floor((loaded/total)*100)+ "%";
if (total == loaded){ play(); this.removeEventListener(Event.ENTER_FRAME, loading); }
}
there is one vector graphic and text for percentage on this page.
-
When you test your movie, go to View>Bandwidth Profiler and look at the file size of the first frame. Is most of your data on the first frame?
-
Designer, Programmer, Musician
I am experiencing this issue too. I have all my content in the 2nd frame, and I have the actionscript class export to frame 2. When simulate download, in the bandwidth profiler, i see how the preloading proccess begins to load data, but the canvas stays "white" completely, and my stage's background color is black. Then, when it reaches 90%, then the black canvas shows with the loader bar and the dynamic text box...that's really weird because in AS2 that did not happen.
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|