Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Create a variable called <code>focusedButton</code>. Then, in your onClick function do something like this:</p> <pre><code>if ( focusedButton !== null ) { // all the code to re-enable the previous button // ie add the listeners and tween alpha } // be sure to store a reference to the new focused button: focusedButton = e.currentTarget; </code></pre> <p>Then go on with the code for disabling the new button....</p> <p>EDIT - I saw your comment requesting more code. I'm tempted to let you figure it out yourself since I think I've given you everything you need, but since I don't know what your experience is, I'll take you a bit further. I hope this helps:</p> <pre><code>// put this at the top of your file: var focusedButton:MovieClip = null; // an updated onClick function ( untested ) function onClick(e:MouseEvent):void { if ( focusedButton !== null ) { // just guessing your unfocus tint: TweenLite.to(focusedButton, 2, { tint:0xFFFFFF, ease:Strong.easeOut, onComplete:function():void { // remove tint here }}); focusedButton.addEventListener(MouseEvent.ROLL_OUT, rolloutEffect);//enable the roll out effect focusedButton.addEventListener(MouseEvent.MOUSE_UP, onClick);//enable the roll out effect focusedButton.addEventListener(MouseEvent.ROLL_OVER, rolloverEffect);//enable the roll out effect } // keep reference to the new button focusedButton = MovieClip(e.currentTarget); // now disable the new button etc: pages.gotoAndStop(e.target.name); TweenLite.to(e.currentTarget,2,{tint:0xFF0000, ease:Strong.easeOut}); var myTween:Tween = new Tween(pages, "alpha", Strong.easeOut, 0, 1, 2, true); e.currentTarget.removeEventListener(MouseEvent.ROLL_OUT, rolloutEffect);//disable the roll out effect e.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, onClick);//disable the roll out effect e.currentTarget.removeEventListener(MouseEvent.ROLL_OVER, rolloverEffect);//disable the roll out effect } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload