2 Replies Latest reply on Mar 23, 2010 11:49 AM by adamgeework

    incorporating flash animations


      I want a rotating circle made in flash to be used as an animation in Flex so the user knows the app is loading something.


      I was just going to have the animation delete after the responder responds... but if there is a better way of making a loader let me know



        • 1. Re: incorporating flash animations
          Karl_Sigiscar_1971 Level 3

          In your main:








          In ProgressDisplay.mxml:


          <?xml version="1.0" encoding="utf-8"?>





                  import flash.events.Event;
                  import flash.events.ProgressEvent;


                  import mx.events.*;
                  import mx.preloaders.Preloader;
                  import mx.preloaders.DownloadProgressBar;
                  import mx.core.Application;


                  private var loader:loaderprocessmc;     


                  override public function set preloader( preloader:Sprite ):void
                      preloader.addEventListener( ProgressEvent.PROGRESS , SWFDownloadProgress );
                      preloader.addEventListener( Event.COMPLETE , SWFDownloadComplete );
                      preloader.addEventListener( FlexEvent.INIT_PROGRESS , FlexInitProgress );
                      preloader.addEventListener( FlexEvent.INIT_COMPLETE , FlexInitComplete );


                      loader = new loaderprocessmc(); // Created with the Flex component kit for Flash CS3 (a swc added to the libs folder)
                      loader.x = stageWidth  / 2 - (loader.width / 2);
                      loader.y = stageHeight / 2 - (loader.height / 2);
                  private function SWFDownloadProgress( event:ProgressEvent ):void
                      var percent:uint = (event.bytesLoaded / event.bytesTotal) * 100;
                      loader.animation.gotoAndStop(percent); // animation is a movieclip nested into the main movieclip we have turned into a Flex component
                  private function SWFDownloadComplete( event:Event ):void {}
                  private function FlexInitProgress( event:Event ):void {}
                  private function FlexInitComplete( event:Event ):void
                      dispatchEvent( new Event( Event.COMPLETE ) );

          • 2. Re: incorporating flash animations
            adamgeework Level 1

            is this to replace the main "initialize" preloader?