0

I need to find a way in Flash AS3 to send a MovieClip property as a variable. I don't want to send the property value but the property itself. Here's an approach of what I want to achieve:

myFunction (mc:String, mcProperty:String, value:Number, iterations:int)
{
    for(var i:int = 1; i<=iterations; i++)
    {
        Tweener.addTween(this["mc" + i], { [mcProperty]:value, time:.8 } );
    }
}

myFunction ("myMovieClipName", "scaleX", 0, 8);

Does anyway have a clue?

Thanks!

1 Answer 1

4

try:

myFunction (mc:String, mcProperty:String, value:Number, iterations:int)
{
    var prop:Object = {time:.8};
    prop[mcProperty] = value;

    for(var i:int = 1; i<=iterations; i++)
    {
        Tweener.addTween(this["mc" + i], prop );
    }
}

myFunction ("myMovieClipName", "scaleX", 0, 8);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.