A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: struggling with simple rollover menu in AS3

  1. #1
    flAsh and bones socreative.tv's Avatar
    Join Date
    Mar 2005
    Posts
    143

    Unhappy struggling with simple rollover menu in AS3

    Hi
    I cant get my head around how to do it in AS3 with less code as possible and have no success so far. I couldnt find any similar tutorials on the web
    Attached Files Attached Files

  2. #2
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    Hint: don't look for tutorials, learn programming instead ( only if you ever want to actually be able to do something with AS 3.0 ).
    Attached Files Attached Files



    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |


  3. #3
    flAsh and bones socreative.tv's Avatar
    Join Date
    Mar 2005
    Posts
    143
    thanks a lot! currentTarget FTW!!!
    how do i turn cursor into a hand when im hovering over a button though? buttonMode = true doesnt seem to work

    Code:
    var menuLabels:Array = ["About", "Services", "Showcase", "Clients"];
    var menuItems:Array = ["bFlameButton1", "bFlameButton2", "bFlameButton3", "bFlameButton4"];
    
    for (var i:int = 0; i < menuItems.length; i++)
    {
    	var button:MovieClip = this.getChildByName(menuItems[i].toString()) as MovieClip;
    	button.ButtonText.text = menuLabels[i].toString();
    	
          button.buttonMode = true;
    	
            button.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
    	button.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
    	
    }
    function onButtonOver(event:MouseEvent):void
    {
    	event.currentTarget.gotoAndPlay("over");
    }
    
    function onButtonOut(event:MouseEvent):void
    {
    	event.currentTarget.gotoAndPlay("out");
    }
    Last edited by socreative.tv; 04-04-2009 at 03:05 PM.

  4. #4
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    It's not working because the text field is stealing the event. Use button.mouseChildren = false; button.buttonMode = true;



    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |


  5. #5
    flAsh and bones socreative.tv's Avatar
    Join Date
    Mar 2005
    Posts
    143
    you're the man! cheers!

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