[as3]event for change of frame
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [as3]event for change of frame

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    13

    [as3]event for change of frame

    hello everybody,
    Is there any event to listen for change of frame.Actually i cant access the timeline varibles of frame 2,3 & so on, in my .as file

  2. #2
    Super Moderator nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    No there isn't, but you can use Event.ENTER_FRAME to keep track of the current and last frame and detect whether they are different or not, i.e., whether there has been a change of frame.
    Actionscript Code:
    addEventListener(Event.ENTER_FRAME, checkFrame);

    var lastFrame:uint;

    function checkFrame(e:Event):void
    {
        if (lastFrame != 0)
        {
            if (lastFrame == currentFrame)
            {
                trace("same frame");
            }
            else
            {
                trace("different frame");
            }
        }
       
        lastFrame = currentFrame;
    }

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Posts
    13
    Thanks, again a great help

Posting Permissions

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




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com