A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Flash CS4 - Mouse state control

  1. #1
    Junior Member
    Join Date
    Jan 2001
    Posts
    2

    Flash CS4 - Mouse state control

    I have a flash menu.

    It has 8 buttons on the stage.

    Each button has a up state and over state

    To show the user how this menu works i want to simulate a mouse over on each button, from button 1 through to button 8. With perhaps a few seconds delay between each mouse over.

    I found some action script that advances the frame after a specified time but it doesn't actually trigger the mouse over state.

    Any help would be appreciated.

    Don

  2. #2
    Junior Member
    Join Date
    Feb 2010
    Posts
    23
    This is a fairly long solution but it's how I would've fixed this (so no gaurantees )

    Instead of having normal buttons with up and over states make them movie clips with the up and over states set out in the timeline (with appropriate stop actions). Now you can do the following:

    buttonName.addEventListener(MouseEvent.MOUSE_OVER, handleOver, false, 0, true);

    function handleOver(e:MouseEvent) : void {

    e.target.gotoAndPlay("overState");
    e.target.addEventListener(MouseEvent.MOUSE_OUT, handleOut, false, 0, true);

    }

    function handleOut(e:MouseEvent) : void {

    e.target.gotoAndPlay("upState");
    e.target.removeEventListener(MouseEvent.MOUSE_OUT, handleOut);

    }

    that takes care of the mc -> button conversion. The clips will work just like buttons for you now, and since they're movie clips you can now use the advancing frame script ...

    hope that works out for you

  3. #3
    Junior Member
    Join Date
    Jan 2001
    Posts
    2
    Wow... its not a simple thing to do is it! My action scripting ability is, well... not that great but i will give your solution a go.

    Thanks heaps for your time and effort.

    Don

  4. #4
    Junior Member
    Join Date
    Feb 2010
    Posts
    23
    you're welcome. post here if you get stuck and I'll do my best to help you along.

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