A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: onRollOver on Buttons

  1. #1
    Senior Member
    Join Date
    Dec 2005
    Posts
    101

    onRollOver on Buttons

    Hi,

    I wonder if anyone could check this for me and tell me why it's not working please?

    I want the play head to go and stop in frame 1 only if the user is not hovering on btnIntermediate or btnExpert.

    Code:
    on (rollOut) {
    	if((!btnIntermediate.onRollOver)||(!btnExpert.onRollOver)){
    		gotoAndStop(1);
    	}
    }
    Regards,
    E
    Last edited by Ennair; 09-24-2006 at 11:54 AM.

  2. #2
    Senior Member
    Join Date
    Dec 2005
    Posts
    101
    Quote Originally Posted by Ennair
    Hi,

    I wonder if anyone could check this for me and tell me why it's not working please?

    I want the play head to go and stop in frame 1 only if the user is not hovering on btnIntermediate or btnExpert.

    Code:
    on (rollOut) {
    	if((!btnIntermediate.onRollOver)||(!btnExpert.onRollOver)){
    		gotoAndStop(1);
    	}
    }
    Regards,
    E
    it's not supposed to be a space in the second part on the if statement 'onRollOver'.

    Thanks.

  3. #3
    Senior Member ozmic66's Avatar
    Join Date
    Oct 2005
    Posts
    472
    I suppose you're trying to achieve this in as3
    in that case you can't use on(...){ anymore you need to use event listeners.

    see the docs for help on that because I'm not sure which events are used for rollover/out

    for click, you can do this

    Code:
    myButton.addEventListener(MouseEvent.CLICK,onClickListener)
    
    function onClickListener(e:MouseEvent){
       //do stuff
    }
    don't mind the extra spaces, it adds them for some reason
    Pixelwave Flash-based iPhone framework
    iPhone Games: Flyloop | Freedom Run

    Twitter: Oztune

  4. #4
    Senior Member
    Join Date
    Dec 2005
    Posts
    101
    Quote Originally Posted by ozmic66
    I suppose you're trying to achieve this in as3
    in that case you can't use on(...){ anymore you need to use event listeners.

    see the docs for help on that because I'm not sure which events are used for rollover/out

    for click, you can do this

    Code:
    myButton.addEventListener(MouseEvent.CLICK,onClickListener)
    
    function onClickListener(e:MouseEvent){
       //do stuff
    }
    don't mind the extra spaces, it adds them for some reason
    Actually, I may have posted this question in the wrong section. I am using Flash 8 and I think I am using AS2.

    How can I achieve the same effect using AS2 please?

  5. #5
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Wrong forum.

    The answer to your question is:
    1. Do not use scripts associated with buttons and MovieClips. In most part use scripts, which you place on the main timeline. Name your clips and buttons. You have more control.

    2. the answer to your question. Create a variable which you put in the RollOver function.

    var pressed:Boolean;
    pressed = false;
    myBut.onRollOver = function()
    {
    pressed = true;
    }
    myBut.onRollOut = function()
    {
    if(pressed)
    {
    d
    //function here
    }
    }
    - The right of the People to create Flash movies shall not be infringed. -

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