[Tweener] Noob Question: Animate Instances Only?

Zeh Fernando zeh at zehfernando.com
Sun Aug 10 17:09:02 PDT 2008


Well, a movieclip that fades in after being created:

package something {

   import caurina.transitions.Tweener;
   import flash.display.MovieClip;

   public class FaderClip extends MovieClip {

     public function FaderClip() {
        alpha = 0;
        Tweener.addTween(this, {alpha:1, time:1});
     }

   }
}

Michael Narciso wrote:
> I tried using "this" but I get an error. Sorry I'm still learning... can 
> you show me an example of how to use this with Tweener in a class? 
> Thanks Zeh
> 
> On Aug 10, 2008, at 3:10 PM, Zeh Fernando wrote:
> 
>> Oh, then yes, you can just use "this".
>>
>> Michael Narciso wrote:
>>> Actually, I was referring to being able to use the Linkage option for 
>>> the MovieClip, such as exporting for actionscript for use with a 
>>> class. I was trying to make a class that used tweener but I couldn't 
>>> get it to work without having to put some kind of instance name.
>>> Usually if I wasn't using tweener I could just use 'this' instead of 
>>> writing any instance names at all.
>>> Thanks for all the amazing timely responses by the way.
>>> On Aug 10, 2008, at 1:58 PM, Zeh Fernando wrote:
>>>> Well, the instance name is the reference variable. So if someone 
>>>> wants another name instead, one can always create another reference.
>>>>
>>>> var xx:MovieClip = myMovieClipWithALongName;
>>>>
>>>> Then:
>>>>
>>>> Tweener.addTween(xx, {...});
>>>>
>>>> Instead of
>>>>
>>>> Tweener.addTween(myMovieClipWithALongName, {...});
>>>>
>>>> Same thing.
>>>>
>>>> Wes wrote:
>>>>> It sounds to me as if he's asking if he can use a variable instead 
>>>>> of typing the exact name of the instance.
>>>>> --- On *Sun, 8/10/08, Zeh Fernando /<zeh at zehfernando.com>/* wrote:
>>>>>   From: Zeh Fernando <zeh at zehfernando.com>
>>>>>   Subject: Re: [Tweener] Noob Question: Animate Instances Only?
>>>>>   To: tweener at lists.caurinauebi.com
>>>>>   Date: Sunday, August 10, 2008, 1:26 PM
>>>>>   > I'm still learning AS3 and Tweener at the same time so please 
>>>>> excuse me
>>>>>   > if my terminology is off but hopefully you get what I'm trying 
>>>>> to ask.
>>>>>   > I'm trying to create a class for disabling an animation and I'd
>>>>>   like to     > know how to animate something without having to use 
>>>>> the instance name. I     > know the description of Tweener says 
>>>>> that it animates instances but is     > there a way to do this 
>>>>> dynamically so I don't have to type in the     > instance names all 
>>>>> the time?
>>>>>   I'm not really sure I get the question - Tweener would have to 
>>>>> know what     to animate, so you need to use the instance name as 
>>>>> the reference.
>>>>>   If you're trying to animate the same display object, you can just 
>>>>> use     "this" as the reference parameter since you're inside the 
>>>>> object
>>>>>   already.
>>>>>   If it's a child of the current display object or something 
>>>>> that's     somewhere else, you'd indeed need to use the name, or if 
>>>>> you want to do     that in a more painful way, you could use 
>>>>> getChildAt().
>>>>>      // Animates whatever's at level 0
>>>>>      Tweener.addTween(getChildAt(0), {...});
>>>>>   Or you could always have an array of objects too...
>>>>>      var myobjs:Array = [cube, sphere, pyramid];
>>>>>      // Animates "cube"
>>>>>      Tweener.addTween(myobjs[0], {...});
>>>>>   HTH,
>>>>>   Zeh
>>>>>   _______________________________________________
>>>>>   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
>>>> _______________________________________________
>>>> 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
>> _______________________________________________
>> 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
> 


More information about the Tweener mailing list