Skip to main content
Inspiring
October 15, 2015
Question

convert as3 external packgage to as3 internal

  • October 15, 2015
  • 1 reply
  • 289 views

My loader is external but i want internal . no  class , package , private , public function etc. so what will be the equivalent internal code for this loader ?

package {

    import flash.display.*;

    import flash.text.*;

    import flash.events.*;

   

    import flash.media.Sound;

    import flash.media.SoundChannel;

    import flash.media.SoundTransform;

   

    public class LoadingMain extends MovieClip {

        public static const ENTRY_FRAME:Number = 3;

        public static const DOCUMENT_CLASS:String = 'Main';

       

        public function LoadingMain() {

            //super();

            //stop();

            loadingMovie.loaderText.text = 0 + "%";

            loaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);

            loaderInfo.addEventListener(Event.COMPLETE, completeHandler);

        }

       

        private function progressHandler(event:ProgressEvent):void {

           

            var bytesTotal = loaderInfo.bytesTotal;

            var bytesLoaded = loaderInfo.bytesLoaded;

            loadingMovie.gotoAndStop(Math.floor(bytesLoaded*100/bytesTotal));

            loadingMovie.loaderText.htmlText = "loading " + Math.floor(bytesLoaded*100/bytesTotal) + "%";

            loadingMovie.loaderText.autoSize = TextFieldAutoSize.CENTER;

        }

       

        private function completeHandler(event:Event):void {

            gotoAndStop(2);

            //main();

        }

        /*

        private function main():void {

            var programClass:Class = loaderInfo.applicationDomain.getDefinition(LoadingMain.DOCUMENT_CLASS) as Class;

            var program:Sprite = new programClass() as Sprite;

            addChild(program);

           

        }*/

       

    }

}



This topic has been closed for replies.

1 reply

Inspiring
October 15, 2015

    import flash.display.*;

    import flash.text.*;

    import flash.events.*;

   

    import flash.media.Sound;

    import flash.media.SoundChannel;

    import flash.media.SoundTransform;   

            stop();

            loadingMovie.loaderText.text = "0 %";

          loadingMovie.loaderText.autoSize = TextFieldAutoSize.CENTER;

            addEventListener(ProgressEvent.PROGRESS, progressHandler);

            addEventListener(Event.COMPLETE, completeHandler);

       

        function progressHandler(event:ProgressEvent):void {

           

            var bytesTotal = loaderInfo.bytesTotal;

            var bytesLoaded = loaderInfo.bytesLoaded;

           // loadingMovie.gotoAndStop(Math.floor(bytesLoaded*100/bytesTotal));

            loadingMovie.loaderText.htmlText = "loading " + Math.floor(bytesLoaded*100/bytesTotal) + " %";

        }

       

        function completeHandler(event:Event):void {

         removeEventListener(ProgressEvent.PROGRESS, progressHandler);

          removeEventListener(Event.COMPLETE, completeHandler);

            gotoAndStop(2);

        }       


Don't forget to embed the font of the loadingMovie.loaderText, and type anything in the text field don't keep it empty.