PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
CS3 onRollout cancels onRelase/Press
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: onRollout cancels onRelase/Press

  1. #1
    Senior Member
    Join Date
    Aug 2006
    Posts
    293

    onRollout cancels onRelase/Press

    hi all,

    does anyone know a workaround for the following - i have some script that i am using to play an mc timeline on rollover and rewind the mc on rollout, but my problem is that i want to add an onRelease action that takes the mc to an specific frame within the mc.

    thing is that the onRollout action cancels out the onRelease action and rewinds the mc regardless.

    this is the script that i have on the first frame of the mc

    Actionscript Code:
    //all this code is inside the complex button so you can stick as many as you want
    //on the stage and all will work.. they all will have this code in it..

    stop(); // stop the movie clip from playing (stop button from growing, we want that when the mouse rolls over only
                                                 
    this.onEnterFrame = function(){
        if(rewind == true){   //if rewind switch is set to true play backwards
            prevFrame();        // play backwards
        }
    }

    this.onRollOver = function(){
        rewind = false; //set variable (or switch) that decides wether ot not to play backwards...
        play();    // play this movie clip.. (grow the button(tween));
    }

    this.onRollOut = function(){
        rewind = true;    //set or rewind switch to true so it will play backwards...
    }

    i have tried a number of things but the on rollout just keeps rewinding the mc!

    any ideas on how i can cancel the rollout action if the mc is clicked???

  2. #2
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    make a variable to determine whether a release has occurred. for example:
    Actionscript Code:
    stop();
    released = false;
    this.onEnterFrame = function(){
        if(rewind) prevFrame();
    }
    this.onRollOver = function(){
        rewind = false;
        release = false;
        play();
    }
    this.onRollOut = function(){
        if(!released) rewind = true;
    }
    this.onRelease = function(){
        released = true;
    }

    So, basically that uses a variable (I called it "released") to determine whether the click occurred. Int the onRollOver method, "released" is automatically set to false. If onRelease is executed, "released" is set to true. Then in onRollOut, it will only set "rewind" to true if "released" is NOT true.

    Hope that all makes sense!

    -Zippy Dee
    Ted Newman
    Last edited by ZippyDee; 07-08-2010 at 02:48 AM. Reason: Kicks and giggles

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