Man , this is Away3D oriented playground. For General AS3 you can inquire in
the billions of  other blogs and forums . :)

On Tue, Jul 20, 2010 at 1:18 PM, Ali <[email protected]> wrote:

> Hi gurus,
>
> I need help. I am trying to create loader class for loading my
> external swf files. This Class worked good for images but it doesn't
> load swf. However it download the swf but doesn't display on stage.
>
> Bellow is code for the class
>
>
> //*****************************************************//
>
> package
> {
>
>
>        import flash.display.Loader;
>        import flash.display.MovieClip;
>        import flash.display.Sprite;
>        import flash.display.Stage;
>        import flash.display.StageAlign;
>        import flash.display.StageScaleMode;
>        import flash.events.Event;
>        import flash.events.ProgressEvent;
>        import flash.events.TimerEvent;
>        import flash.net.URLRequest;
>        import flash.utils.Timer;
>
>        import org.osmf.display.ScaleMode;
>
>        [SWF(backgroundColor="#000000",frameRate=30)]
>        public class swfLoader extends Sprite
>        {
>                //public var swfURL:String=null;
>                private var square:Sprite;
>                private var tmr:Timer;
>                private var mLoader:Loader;
>                public function swfLoader()
>                {
>
>                        stage.align=StageAlign.TOP_LEFT;
>                        stage.scaleMode=StageScaleMode.NO_SCALE;
>                        square = new Sprite();
>
>                        mLoader = new Loader();
>                        var mRequest:URLRequest = new
> URLRequest("assets/test.swf");
>                        //var mRequest:URLRequest = new
> URLRequest("assets/bg.jpg"); //
> This is working
>
>  mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
> onCompleteHandler);
>
>  mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
> onProgressHandler);
>                        mLoader.load(mRequest);
>
>
>                        addChild(square);
>
>                }
>                private function onCompleteHandler(loadEvent:Event):void
>                {
>
>                        addChild(mLoader);
>
>                }
>                private function
> onProgressHandler(mProgress:ProgressEvent):void
>                {
>                        var percent:Number =
> mProgress.bytesLoaded/mProgress.bytesTotal;
>                        drawProgress(percent);
>                }
>
>                public function drawProgress(prg:Number):void{
>
>                                square.graphics.beginFill(0x00FFF);
>
>  square.graphics.drawRect(0,0,stage.stageWidth*(prg/100),10);
>                                square.graphics.endFill();
>                                square.x =
> stage.stageWidth/2-square.width/2;
>                                square.y = stage.stageHeight-10
>
>                }
>        }
> }
>
> //*****************************************************//
>
> Please tell me what I am doing wrong.
>
> Riyasat




-- 
Michael Ivanov ,Programmer
Neurotech Solutions Ltd.
Flex|Air |3D|Unity|
www.neurotechresearch.com
http://blog.alladvanced.net
http://www.meetup.com/GO3D-Games-Opensource-3D/
Tel:054-4962254
[email protected]
[email protected]

Reply via email to