MovieClip addressing issue w/ActionScript Tween
Hey everyone,
I'm hoping there's an easy solution to this problem that I simply haven't thought of.
I have a SWF that loads in a series of pages all with a similar structure. There is next and back navigation in the main movie clip, which loads in the previous and subsequent page SWFs respectively.
In the main movie, there are functions (AS2, since I need to publish for compatibility with FP8) which control the animation of movieClips within the loaded SWFs.
For instance, a simple function used to fade in the text movie clips in the individual pages (which load their content via XML) would look like this:
Code:
function fadeIn(which):Void {
fadeInTween = new Tween(which, "_alpha", Strong.easeOut, 0, 100, 20, false);
}
Then, inside the loaded page SWF is code which looks like this:
where mc1 is the text movie clip.
Now, let's say, for instance, that this function is called when a popup within the loaded SWF is opened (to transition the text nicely onto the screen). However, the function to close this popup looks like this:
Code:
function resetPopup():Void {
setProperty(this.popup, _alpha, 0);
setProperty(this.mc1, _alpha, 0);
}
Here's the problem: if the user closes the popup before the tween is complete, the setProperty function does not have access to the movie clip to set the alpha back to 0.
A similar thing happens if the navigation is used before the animations which transition the page content on are complete. For instance, if mc1 in the current SWF is being animated, and the user pages to the next page, which also contains a movieClip with an instance name of mc1, the functions which are to animate this clip or set its properties cannot do so, as the reference to the clip is tied up with the tween from the previous page. (at least if I understand how this works correctly).
Here's my question: given that a lot of code exists for this project already which I am updating, what is the most practical way to work around this? If I were writing the code fresh, I would simply ensure that the tweens were complete before anything else could be done (using the onMotionFinished event). But I don't believe I have a way to disable every possible interaction when these functions are called. Is there a way to dynamically reference these movie clips (perhaps in the function itself) such that the identical instance names will not be an issue? How about a way to release the reference to the movie clip being animated by the Tween in order to make it available for other functions?
Any ideas here would be greatly appreciated. If you need clarification on any of this, I'll be happy to explain anything further.
Thanks!