My suggestions regarding object declarations and nested functions are a matter of best practices and code clarity. For example, declaring named movieclips provides a frame of reference and context for objects that appear in your code. Otherwise, these objects kind of just "magically" appear out of nowhere with no prior definition.
Nested functions will often work as expected, but this (questionable) coding technique really has very little useful context in most AS3 projects.
With regard to the curtain tweens, you can add the curtain to the displaylist and tween it within the same scope. ie: within the same function body {}
TweenMax has some very helpful methods for handling stuff like this economically, such as tweening from, to, fromTo, and the Array methods: allFrom, allTo, allFromTo, etc...
If fact, the tweening for your script could be handled very effectively and entirely within the constructor using TweenMax and/or TimelineMax.
TimelineMax is essentially what it sounds like: a configurable programmatic timeline composed of multiple TweenMax instances. It is extremely flexible, and has numerous options such as the fantastic updateTo() method which allows you to easily change the parameters for an actively running tween instance. For example, you can continuously update the x y destinations for a tween while it is running, which can lead to some fairly sophisticated effects with relatively little code.
The Greensock Animation Platform (TweenMax, TimlineMax, LoaderMax, BlitMask, and a host of other advanced classes) is probably the most productive aspect of AS3 development that I have learned in the past 5 years.
|