Note that there are some explanatory texts on larger screens.

plurals
  1. POAS3 remove tween before MOTION_FINISH via the movieclip
    primarykey
    data
    text
    <p>I've been fumbling with this issue for a bit. I've got a lovely little tooltip movieclip that follows the user's mouse for a few seconds before it removes itself. My problem is that if there is one already there I remove it, however, I cannot seem to remove the MOTION_FINISH event and it still fires and possibly deletes a new tooltip.</p> <p>What I want is to essentially put in a line item such as var tween(smallhelp_panel).deleteAll(); I saw a tweenlight function killtweensof(mc); However I've used the tweens I've incorporated below throughout my 30k lines of AS3 code.</p> <p>Here is my tooltip handler. I call it with a simple </p> <pre><code>Main_Warning("Please don't forget to save!",5); </code></pre> <p>My movieclip is a 'smallhelp_panel' and I check if it already exists and remove it. However, the alpha and MOTION_FINISH tweens still exist and cause issues with any new smallhelp_panels.</p> <pre><code>public function Main_Warning( the_text:String, myTimer:int = 4){ if(smallhelp_panel != null){ stage.removeChild( smallhelp_panel ); removeEventListener(Event.ENTER_FRAME, trackmouse); smallhelp_panel = null; } smallhelp_panel = new small_help(); smallhelp_panel.name = "myWarning"; smallhelp_panel.x = mouseX - 50; smallhelp_panel.y = mouseY + 15; smallhelp_panel.helptext.text = the_text; stage.addChild( smallhelp_panel ); addEventListener(Event.ENTER_FRAME, trackmouse); var myTween:Tween; myTween = new Tween(smallhelp_panel, "alpha", None.easeOut, 1, 0, myTimer, true); tweenholder = myTween; tweenArray.push(tweenholder); myTween.addEventListener(TweenEvent.MOTION_FINISH, removeTween); } </code></pre> <p>That is my Tooltip handler.</p> <p>for reference purposes my tween remover is:</p> <pre><code>public function removeTween(e:TweenEvent = null):void{ e.target.removeEventListener(TweenEvent.MOTION_FINISH, removeTween); if(smallhelp_panel != null){ removeEventListener(Event.ENTER_FRAME, trackmouse); stage.removeChild( smallhelp_panel ); smallhelp_panel = null; } } </code></pre> <p>and my mouse tracker that moves the tooltip with the mouse is a simple:</p> <pre><code>public function trackmouse(e:Event):void{ smallhelp_panel.x = mouseX - 50; smallhelp_panel.y = mouseY + 15; } </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.
    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