A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Remove onRollOver and have button automatically play

  1. #1

    Remove onRollOver and have button automatically play

    I have some code for a button, I'm trying to remove the onRollOver and onRollOut functions and have it automatically play the button effects.
    What do I need to do to just have this automatically play?


    Code:
    //default size
    sizeTo = 100;
    
    //increase the size and play the effect animation when mouse is over the button
    onRollOver = function(){
    	effect.gotoAndPlay(2);
    	sizeTo = 130;
    }
    
    //revert to 100% size when mouse cursor is out
    onRollOut = function(){
    	sizeTo = 100;
    }
    
    //dynamically adjust the size of the button
    onEnterFrame = function(){
    	caption._xscale = caption._yscale = caption._xscale+((sizeTo)-caption._xscale)/5;
    }

  2. #2
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    Try using the onEnterFrame method.

  3. #3
    shavingcream incarnate gukinator's Avatar
    Join Date
    Jul 2008
    Location
    Santa Cruz
    Posts
    147
    since ur using a gotoAndPlay, onEnterFrame will make it act like a gotoAndStop, because it will be repeatedly going to that frame, just remove the functions all together, change
    PHP Code:
    onRollOver = function(){
        
    effect.gotoAndPlay(2);
        
    sizeTo 130;
    }

    //revert to 100% size when mouse cursor is out
    onRollOut = function(){
        
    sizeTo 100;

    to
    PHP Code:
    effect.gotoAndPlay(2);
    sizeTo 130
    if you want a way to change the size back, its going to have to be something other than rollOut, because you wont have a rollOver

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