This content has been marked as final. Show 6 replies
Look into using the Tween class for the fade in and fade out, along with some listeners to tell you when to move on to subsequent stages. Some timing elements may come in handy as well.
You can feed in the object from an array that will be tweened at the start of each cycle, incrementing a counter so that the next object in the lineup will be assigned the next time the sequence starts (resetting it to zero when the time comes).
You could probably achieve a similar effect using your current code (though Tween-ing is smoother), but you need to have functions being fed objects rather than dedicating functions to individual objects.
Thanks for your reply. Unfortunately, I don't really follow what you mean. Not sure what you mean by "but you need to have functions being fed objects rather than dedicating functions to individual objects."
I was hoping to be able to define an array such as:
var images:Array = new Array();
Then setting the array such that images="food1"; , etc.
Then instead of saying food1._alpha += 4; for example, I could say images ._alpha +=4;, and loop through incrementing the value of i. But that did not work.
Can you give me some more detail about what it means to have "functions being fed objects rather than dedicating functions to individual objects."?
You were heading on the irght track with what you tried, but you were targeting names of things (Strings) rather than the actual objects by those names. If you have the name of an object, that being a String, you can target the object itself using the following:
this[ object-name]._alpha = ...
The brackets cause the program to evaluate what's inside as an object. So if you had used..
You would have been targeting the instance named food1. You could even store the actual object target in the array...
images = this["food1"];
such that when it comes time to control it, you would only have to use...
images._alpha = ...
I'll see if I can come up with a simple example.
This should be sufficient to do what you are after, you'd just have to fill up the array with your 15 items.
Thanks so much for your time and your reply! I actually figured out a way to make it work, but this may be even easier (once I study it and understand it completely :-) ). Thanks again!
You're welcome Bob. The best things are those you make yourself, so I'm glad you pursued it and got it working. If you have any questions about my approach, feel free to ask.