1 Reply Latest reply on Jun 19, 2007 2:27 AM by ev2

    please check actionsipt3 as not working

    ev2
      I am trying to convert a flash folio to actionscript 3

      I will endevour to describe my timeline setup followed by the frame code that I cannot get to work. At the moment the time frame keeps looping, buttons and AC3 loader/ progress components.

      I feel I’m close but I’m missing something. Once I get one frame right I can continue with same actionscript basis for others. Please help….

      I have put all the actionscript for this particular frame in the top layer named “actions”

      The other layers below on the stage are as follows:

      -a layer containing buttons
      -a layer containing for progress bar component
      -a layer for the loader component loading file called “recycle-web-map-4-folio.png”
      -a layer for text and background artwork

      On the stage are:

      -progress bar component instance name of “recyclingProg”
      -UI loader component instance name of “recyclingLoad”
      -Button instance name of “contactUs”
      -Button instance name of “profilePage”
      -Button instance name of “workPage”
      -Button instance name of “applyPage”

      In addition within this scene named “main”, frame name labels have been created named “profile”, “work”, “apply”

      Here is the action script that is in the layer named “actions”:

      //import classes
      import flash.display.MovieClip;
      import flash.events.MouseEvent;
      import flash.display.Loader;
      import flash.display.LoaderInfo;
      import flash.net.URLRequest;
      import flash.events.Event;
      import flash.events.EventDispatcher;
      import fl.motion.Animator;
      import flash.events.ProgressEvent;
      import flash.text.TextField;

      //stop movie clip
      this.stop ();

      //profilePage event listener "istance name" & "handler"
      profilePage.addEventListener(MouseEvent.CLICK, clickProfile);

      //profilePage event handler
      function clickProfile(event:MouseEvent):void
      {
      trace ("profile page button clicked");
      _root.gotoAndPlay("profile"); //root of timeline with "profile" label??
      }

      //applyPage event listener "istance name" & "handler"
      applyPage.addEventListener(MouseEvent.CLICK, clickApply);

      //applyPage event handler
      function clickApply (event:MouseEvent):void
      {
      trace ("apply page button clicked");
      this.gotoAndPlay ("apply","main");
      }

      //workPage event listener "istance name" & "handler"
      workPage.addEventListener(MouseEvent.CLICK, clickWork);

      //workPage event handler
      function clickWork (event:MouseEvent):void
      {
      trace ("work page button clicked");
      this.gotoAndPlay ("work","main");
      }

      //contactUs email link event listener
      contactUs.addEventListener(MouseEvent.CLICK, clickContactUs);

      //contactUs event handler
      function clickContactUs(event:MouseEvent):void {
      navigateToURL(new URLRequest("enquire@evulon.com","_blank"));
      trace("contact us button clicked");
      }

      //define Loader instance “recyclingLoad/myLoader” of the loader class
      var recyclingLoad:Loader = new Loader();

      //define URLRequest instance “myRequest” that points to file to load
      var myRequest:URLRequest = new URLRequest("recycle-web-map-4-folio.png");

      //instance loads image to stage
      recyclingLoad.load(request);

      //capture loading progress
      //declare three callback functions: showPreloader(), showProgress & showLoadResult
      recyclingLoad.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);
      recyclingLoad.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
      recyclingLoad.contentLoaderInfo.addEventListener(Event.COMPLETE,showLoadResult);

      //alternate listen for event errors??
      //recyclingLoad.contentLoaderInfo.addEventListener(10ErrorEvent.10_ERROR, loadError);
      //recyclingLoad.contentLoaderInfo.addEventListener(Security ErrorEvent.SECURITY_ERROR, loadError);
      //recyclingLoad.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);

      //define textfield showing load progress
      var loadProgress_txt:TextField = new TextField();

      //callback function reacts on OPEN event
      function showPreloader(evt:Event):void {
      addChild(loadProgress_txt);
      }

      //callback function reacts when progress is made
      function showProgress(evt:ProgressEvent):void {
      loadProgress_txt.text = “loaded:”+evt.bytesLoaded+” from “+evt.bytesTotal;
      }

      //callback function displays loaded content
      function showLoadResult(evt:Event):void {
      removeChild(loadProgress_txt);
      addChild(recyclingLoad);
      }