[Tweener] FW: AS 3 If/Else issues with Tweener - Part two
Nathan Thompson
nathan.thompson at engagegroup.co.uk
Thu Nov 13 01:17:58 PST 2008
Hey all. Thanks very much to Gerry (props for the sample movie) and Cedric for their help.
I have managed to get it to work! BUT... And this is the last time you hear about if because if I can't fix this I may have to resort to timelining (shudder).
I have the following working great.
var blue:MovieClip = new BlueBtn();
blue.x = 166;
blue.y = 23;
blue.addEventListener(MouseEvent.MOUSE_UP,moveBtn);
// if you want a hand cursor
blue.buttonMode = true;
blue.useHandCursor = true;
addChild(blue);
//
function moveBtn(e:MouseEvent):void {
var btn = e.target;
if (btn.x == 166) {
Tweener.addTween(btn, {x:638, time:1});
Tweener.addTween(blue_content_MC, {x:166, time:1});
} else if (btn.x == 638) {
Tweener.addTween(btn, {x:166, time:1});
Tweener.addTween(blue_content_MC, {x:-311, time:1});
}
}
What I assumed was that to re-create that for 6 other elements (pink, grey, yellow etc...) I would copy/paste then swap out the mentions of blue for the colour required (all movie clips are named the same format)
But I get this...
1021: Duplicate function definition. function moveBtn(e:MouseEvent):void {
So I change the function to movePinkBtn
And I get...
1180: Call to a possibly undefined method PinkBtn. var pink:MovieClip = new PinkBtn();
Anyhoo - files are at http://www.mymindseye.co.uk/tween/tween.zip if anyone fancies a look.
Thanks again people.
------ End of Forwarded Message
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.caurinauebi.com/pipermail/tweener-caurinauebi.com/attachments/20081113/df1f7118/attachment.htm>
More information about the Tweener
mailing list