[Tweener] AS 3 If/Else issues with Tweener
Gerry Creighton
gerry at thespikeranch.com
Tue Nov 11 08:05:57 PST 2008
Woops...I forgot to mention that I was using a MovieClip that had the
name
blue on the stage. That differs from your sample, I shortened it just
to show you the proper method.
Also if you wanted to show a hand cursor on that btn use this...
// if you want a hand cursor
blue.buttonMode = true;
blue.useHandCursor = true;
I put this sample fla on my site that you can use and download here:
http://www.thespikeranch.com/test/blueBtn/
Hope that helps.
-Gerry
On Nov 11, 2008, at 10:38 AM, Gerry Creighton wrote:
> Nathan,
>
> I threw this together which is an AS3 way of doing it.
>
> ####
>
> import caurina.transitions.Tweener;
> import flash.events.MouseEvent;
>
>
> blue.addEventListener(MouseEvent.MOUSE_UP,moveBtn);
>
>
> function moveBtn(e:MouseEvent):void {
> var btn = e.target;
> if (btn.x == 100) {
> Tweener.addTween(btn, {x:200, time:1});
> } else if (btn.x == 200) {
> Tweener.addTween(btn, {x:100, time:1});
> }
> }
>
> ####
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>
> The Spike Ranch
> Web Design and Development
> http://www.thespikeranch.com
>
> ph: 609.748.7973
> c: 609.703.3372
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>
>
>
>
>
> On Nov 11, 2008, at 10:08 AM, Nathan Thompson wrote:
>
>> Hi all... Apologies up front.
>>
>> New to email lists and Tweener and AS3 so am probably going to be a
>> royal pain in the proverbial... Please let me know if this is not
>> the way to do things.
>>
>> I have the following AS
>>
>> if (blue.x==166) {
>> blue.blue_BTN.addEventListener ('mouseUp', function() {
>> Tweener.addTween(blue, {x:638, time:1});
>> trace('this is 638')
>> });
>> }
>>
>> else if (blue.x==638) {
>> blue.blue_BTN.addEventListener ('mouseUp', function() {
>> Tweener.addTween(blue, {x:166, time:0.5});
>> trace('this is 166')
>> });
>> }
>>
>>
>>
>> What I am trying to do is click blue_BTN and it change position
>> (this works). When that is done I want to be able to click on it
>> again and restore its position (this doesn’t work).
>>
>> Is it an if/else thing or is there a tween function I am not
>> implementing.
>>
>> Thanks in advance if anyone can point me in the right direction.
>>
>> Nathan
>>
>>
>> --
>>
>> _______________________________________________
>> Tweener mailing list
>> Tweener at lists.caurinauebi.com
>> http://lists.caurinauebi.com/listinfo.cgi/tweener-caurinauebi.com
>
> _______________________________________________
> Tweener mailing list
> Tweener at lists.caurinauebi.com
> http://lists.caurinauebi.com/listinfo.cgi/tweener-caurinauebi.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.caurinauebi.com/pipermail/tweener-caurinauebi.com/attachments/20081111/35de7dc4/attachment-0001.htm>
More information about the Tweener
mailing list