SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I convert this to ActionScript 2.0?

    I've come across this image gallery code in Actionscript 3.0 and I'm wondering how this can be rewritten in AS2...
    Any idea how?
    (The code are to be inserted in certain frames, hence the reference to frame numbers...)


    //AS3 Code (1st Frame)
    var nextImage:Timer = new Timer(2000);
    nextImage.addEventListener(TimerEvent.TIMER, playNext);
    nextImage.start();

    function playNext(event:Event):void{
    nextFrame();
    }

    //AS3 Code (2nd Frame)
    stop();
    //////////////////////////////////////////////////////////////////
    btn1.addEventListener(MouseEvent.CLICK,play1);

    function play1(event:MouseEvent):void{
    nextImage.stop();
    gotoAndStop(2);
    btn1.addEventListener(MouseEvent.ROLL_OUT, rollout);

    function rollout(event:MouseEvent):void{
    nextImage.reset();
    nextImage.start();

    }
    }
    //////////////////////////////////////////////////////////////////
    btn2.addEventListener(MouseEvent.CLICK,play2);

    function play2(event:MouseEvent):void{
    nextImage.stop();
    gotoAndStop(3);
    btn2.addEventListener(MouseEvent.ROLL_OUT, rollout);

    function rollout(event:MouseEvent):void{
    nextImage.reset();
    nextImage.start();

    }
    }

    btn3.addEventListener(MouseEvent.CLICK,play3);

    function play3(event:MouseEvent):void{
    nextImage.stop();
    gotoAndStop(4);
    btn3.addEventListener(MouseEvent.ROLL_OUT, rollout);

    function rollout(event:MouseEvent):void{
    nextImage.reset();
    nextImage.start();

    }
    }

    btn4.addEventListener(MouseEvent.CLICK,play4);

    function play4(event:MouseEvent):void{
    nextImage.stop();
    gotoAndStop(5);
    btn4.addEventListener(MouseEvent.ROLL_OUT, rollout);

    function rollout(event:MouseEvent):void{
    nextImage.reset();
    nextImage.start();

    }
    }

    //AS3 Code (Last Frame)
    nextImage.stop();
    nextImage.reset();
    gotoAndPlay(1);

  2. #2
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,559
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    Change the bits that use apis unique to as3, into their equivalents in as2
    e.g
    timer -> setinterval


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •