What do we do when we want to make sure that our clip only start after all items are downloaded. A Flash Pre Loader, written in ActionScript 3.0, that show the download percentage, makes sure all items are in place before our movie starts.
HERE IS THE SOURCE CODE
var loader:Loader = new Loader();
/* It may sound funny but loader
with small “L” is not a reserved word
therefore available for a variable name,
while Loader with Capital “L” is
a reserved word and becomes blue */
function fileLoaded(event:Event):void{
addChild(loader);
}
function preload(event:ProgressEvent):void {
var percent:Number = Math.round(event.bytesLoaded / event.bytesTotal *100);
/* both values are received on the function
through the Progress event */
// Dynamic text boxes accept only strings, so the value has to be transformed into string, using the string function.
preload_txt.text = String(percent) + “%”;
}
/* Now the code */
// This function fires when the Loading is Completed
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, fileLoaded);
// This function happens during loading.
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preload);
loader.load(req);






13 Responses to “ActionScript 3.0 Video Lesson 27: Creating a Pre Loader”
Trackbacks/Pingbacks
Title…
Ugh, I just wrote a huge comment, but it disappeared when I hit send. Anyway, I’m not going to retype it again, so I just wanted to say nice blog!
…
generally want to keep this a positive…
profile, while leaning towards the neutral side.interview someonefind someone who you are interested in and invite them in for an interview. you can even do your interview via e-mail. if they are interested in being interviewed you can just send them…
Digital Marketing Services…
[...]we came across a cool site that you simply might appreciate. Take a look in case you want[...]…
Fife…
[...]that is the end of this write-up. Here you?ll locate some web sites that we consider you?ll enjoy, just click the hyperlinks over[...]…
Thanks Man…
Great Post Great Article god bless you….
best approach to re-writing, of course, is…
to find someone else, someone with a critical eye and a tough skin, to read and mark and criticize what you have written. bear into that criticism. change what is recommended. alter your approach. try it again. revising and editing your…
…Additional Information ca be found here…
[...]The entire glance of your web site is wonderful, let well as the content![...]…
trackback…
this post…
…Awesome website…
[...]you made running a blog glance[...]…
trackback…
look what I found…
Title…
Rats that was odd. I just wrote an extremely long comment but after I clicked send my comment didn’t show up. Grrrr… well I’m not writing all that again. Anyways, just wanted to say fantastic blog!…
Title…
Wow that was weird. I just wrote an extremely long comment but after I clicked submit my comment didn’t show up. Hmmm… well I’m not typing all that again. Anyways, just wanted to say great blog!…
Title…
Wow, I’m really happy that I landed on this page, good info here! Better than http://facebook.com!…