1 Reply Latest reply on Dec 20, 2010 7:48 AM by Ned Murphy

    What modification required to use a "Class" code in .FLA itself?

    learner_7n Level 1

      Hi,

       

      What modification required to use a "Class" code in .FLA itself instead of using an external Class file? Please help me to solve the problem? When I tried the Class code by pasting all the code, it doesn't work. How to modify it? Please help.

       

      The following is the Class Code:

       

      package demos {

      import com.greensock.events.LoaderEvent;
      import com.greensock.loading.ImageLoader;
      import com.greensock.loading.LoaderMax;
      import com.greensock.loading.SWFLoader;
      import com.greensock.loading.VideoLoader;
      import com.greensock.loading.display.ContentDisplay;

      import flash.display.Sprite;

      public class Parse_Array extends Sprite {
       
        public var progress_mc:MovieClip;
       
        public function Parse_Array() {
        
         //activate the loaders we need
         LoaderMax.activate([ImageLoader, SWFLoader, VideoLoader]);
        
         var urls:Array = ["image.jpg", "video.f4v", "image.png", "avm2.swf"];
         var queue:LoaderMax = LoaderMax.parse(urls,
                    {maxConnections:1,
                     onProgress:_progressHandler,
                     onComplete:_queueCompleteHandler,
                     onChildComplete:_childCompleteHandler},
                    {width:125,
                     height:90,
                     scaleMode:"stretch",
                     y:150});
         queue.prependURLs("assets/");
         queue.load();
        }
        
        private function _progressHandler(event:LoaderEvent):void {
         this.progress_mc.progressBar_mc.scaleX = event.target.progress;
        }
       
        private function _queueCompleteHandler(event:LoaderEvent):void {
         var contents:Array = event.target.content;
         var currentContent:ContentDisplay;
         for (var i:int = 0; i < contents.length; i++) {
          currentContent = contents[i];
          addChild(currentContent);
          currentContent.x = i * 125 + 25;
         }
        }
       
        private function _childCompleteHandler(event:LoaderEvent):void {
         trace("child loaded: " + event.target + " inside queue: " + event.currentTarget);
        }
      }
      }

       

       

      Regards.