PDA

View Full Version : Preloader for Flex AS project


artcraft
07-11-2006, 08:37 PM
I wander huw to make swf which monitor self-loading in Flex 2.0 (AS project - not mxml)

for now I have made external preloader, but I whant to understand how to made internal one :confused:

here is my external preloader:

package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.text.TextField;

public class preloader extends Sprite{
private var tf:TextField;

public function preloader(){
stage.scaleMode = "noScale";
stage.align = "TL";

tf = new TextField();
tf.x=100;
addChild(tf);

var ldr:Loader = new Loader();
var urlReq:URLRequest = new URLRequest("Main.swf");
ldr.load(urlReq);
ldr.contentLoaderInfo.addEventListener(Event.COMPL ETE, loaded);
ldr.contentLoaderInfo.addEventListener( ProgressEvent.PROGRESS, progressHandler);
addChild(ldr);
}

private function progressHandler(event:ProgressEvent):void {
tf.text=event.bytesLoaded.toString();
}

private function loaded(event:Event):void {
removeChild(tf);
}
}
}

artcraft
07-12-2006, 06:20 PM
OK
application compiler options has following option:
frames.frame label class name [...]
Specifies a SWF file frame label with a sequence of class names that are linked onto the frame. (This is an advanced option.)

how to use it?

cksachdev
12-10-2007, 12:04 PM
Hi ...
I was also looking out for the same. And found this. Have a look at it.
http://www.dreaminginflash.com/2007/11/13/actionscript-3-preloader/
This way you can preload a single file. I think.
Although there is a default preloader class also available in Action Script 3 i.e. mx.preloaders
If you have some experience with it. Let me know about it.

dr_zeus
12-10-2007, 05:31 PM
This article by Keith Peters might be helpful:
Preloaders in AS3 (http://www.bit-101.com/blog/?p=946)

cksachdev
12-11-2007, 09:34 AM
This article by Keith Peters might be helpful:
Preloaders in AS3 (http://www.bit-101.com/blog/?p=946)

Any body know how to integrate mx.preloaders class in an ActionScript Project