so i made a tween the on rollover plays out a tween i treyed the code below but it does not work, i need to remove the event listener once it is rolled over once but it gives me an error that says
Symbol 'pictures_mc',Layer 'actions', frame2, Line19 1067 :Implict coercion of a value of type.transitions:Tween to an to an unrelated type Function.
I have no idea what this means but i know its about the remove event listener in the code below.
import flash.events.MouseEvent;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
stop();
var myTween:Tween = new Tween(sidebar, "x", None.easeIn, 0, -40, 1, false);
sidebar.addEventListener(MouseEvent.MOUSE_OVER,showsidebar)
function showsidebar(evtobj:MouseEvent){
var Sidebartween:Tween = new Tween(sidebar, "x", None.easeIn, 0, -100, 1, false);
sidebar.addEventListener(TweenEvent.MOTION_FINISH,deletearrow);
function deletearrow(evtObj:TweenEvent){
delete(sidebar.arrow_mc)
}
stage.removeEventListener(TweenEvent.MOTION_START,Sidebartween);
}
like i said i need to remove the event listener because when i roll over it the tween just keeps playing if i dont can anyone help?
You want to add the listener to the tween instance, not the sidebar. Change:
sidebar.addEventListener(TweenEvent.MOTION_FINISH, deleterarrow);
to:
Sidebartween.addEventListener(TweenEvent.MOTION_FINISH, deletearrow);
And you can also just make it an anonymous function which is pretty much what you have anyhow.
e.g.:
Sidebartween.addEventListener(TweenEvent.MOTION_FINISH, function(e:TweenEvent):void{ delete(sidebar.arrow_mc); });
North America
Europe, Middle East and Africa
Asia Pacific