Jump to content
  • Advertisement
Sign in to follow this  
SchnarfleMuffin

AS3 preloader

This topic is 3354 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I recently downloaded the Flex SDK and I am writing AS3 programs in FlashDevelop. There I am satisfied, however, I created an "AS3 with preloader" project. In preloader.as automatically is the following code: package AS3tut { import flash.display.DisplayObject; import flash.display.MovieClip; import flash.events.Event; import flash.events.ProgressEvent; import flash.utils.getDefinitionByName; /** * ... * @author Ted Bauer */ public class Preloader extends MovieClip { public function Preloader() { addEventListener(Event.ENTER_FRAME, checkFrame); loaderInfo.addEventListener(ProgressEvent.PROGRESS, progress); // show loader } private function progress(e:ProgressEvent):void { // update loader } private function checkFrame(e:Event):void { if (currentFrame == totalFrames) { removeEventListener(Event.ENTER_FRAME, checkFrame); startup(); } } private function startup():void { // hide loader stop(); loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progress); var mainClass:Class = getDefinitionByName("AS3tut.Main") as Class; addChild(new mainClass() as DisplayObject); } } } And when I run my program, everything runs fine in the program but there is no preloader. I doubt this is a problem, but how can I observe what the proloader looks like and stuff? Plus I need a good tutorial on making a preloader with images, percents and all that crap.

Share this post


Link to post
Share on other sites
Advertisement
did you try searching for "as3 preloader" in google? I am sure you will find much more than you want.

Easiest way is add a movie clip (bar_mc) to the scene to use as a preloader bar. and add this line to "// update loader"

bar_mc.scaleX = (loaderInfo.bytesLoaded)/(loaderInfo.bytesTotal);

and add this to startup()

bar_mc.visible = false;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!