A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: animating with cursor on stage

  1. #1
    Member
    Join Date
    Oct 2003
    Location
    Norwich
    Posts
    87

    animating with cursor on stage

    How do you call a movie clip to animate but only while the cursor is in the stage area?

  2. #2
    Junior Member
    Join Date
    Sep 2009
    Posts
    16
    I would use the rollover features of a button. You can make the an invisible button by only having a shape only on the hit area frame.

    Or you could use the mouseX and mouseY properties. Set up a timer object to check the mouseX and mouseY every so often.

  3. #3
    Member
    Join Date
    Oct 2003
    Location
    Norwich
    Posts
    87
    so how does the invisible button call the animation to work once it is hovered by the cursor?

  4. #4
    Junior Member
    Join Date
    Feb 2010
    Posts
    23
    Code:
    if(mouseX<stage.stageWidth && mouseX>0 && mouseY<stage.stageHeight && mouseY>0){
    //execute desired code
    }

  5. #5
    Member
    Join Date
    Oct 2003
    Location
    Norwich
    Posts
    87
    and this code has to be on the main timeline rather than on the button in AS3?

  6. #6
    Junior Member
    Join Date
    Feb 2010
    Posts
    23
    yep, that will make sure that whatever your desired code is it only executes while the mouse is within the bounds of the stage. You'll probably want it to be in a function that handles an ENTER_FRAME event so that it checks for each frame. Savvy?

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