10 Replies Latest reply on Jun 25, 2009 9:58 PM by kglad

    Scripting the loading bar without a UILoader...

    cmoadobe

      So I was using a UILoader to load my swf, but was having issues with the component, so I got rid of it, and am now using the following AS to load the file instead:

       

      var Xpos:Number=0;

      var Ypos:Number=0;

      var swf:MovieClip;

      var loader:Loader=new Loader();


      var defaultSWF:URLRequest=new URLRequest("CMO.swf");


      loader.load(defaultSWF);

      loader.x=Xpos;

      loader.y=Ypos;

      addChild(loader);

       

      My problem however, is that before when I was using a UILoader component, I had some dynamic text and a little animation running while the clip loaded and I need to rescript it to work without the UILoader component.  The AS I had for that was worked into the UILoader instance name:

       

      loadFile();

       

      loadAnimation.stop();

       

      function loadFile():void {

      CMOLoader.load(new URLRequest("CMO.swf"));

      CMOLoader.addEventListener(ProgressEvent.PROGRESS, progressHandler);

      CMOLoader.addEventListener(Event.COMPLETE, completeHandler);

      }

       

      function progressHandler(e:ProgressEvent):void {

      prog_txt.visible=true;

      var percent:int=CMOLoader.percentLoaded;

      prog_txt.text=percent+"%";

      }

       

      function completeHandler(event:Event):void {

      currentFrame+1;

      prog_txt.visible=false;

      loadAnimation.visible=false;

      CMOLoader.removeEventListener(ProgressEvent.PROGRESS, progressHandler);

      CMOLoader.removeEventListener(Event.COMPLETE, completeHandler);

      }

       

       

       

      So now I'm trying to figure out how to extract and rescript the animation (loadAnimation) and the text (prog_txt) to fit my new AS that loads the file now.

       

      Thank you for any ideas!