Dear list,
I have been trying to solve this problem for a good while, but I wonder if
anyone has a good way to get around it. Here is the problem (you can
download the related Flash at: http://www.acts.net/Flash/ComponentBlue.zip
I have created a component called Parent, inside Parent timeline I have my
designer to layout components Child1 and Child2, so I only have to do the
wiring.
So now I have put Parent in the movie timeline at a frame labeled TestFrame,
so we have a structure liked followed,
TestFrame
+ Parent
- Child1
- Child2
For the ease of description, I have classes with the same name as Parent,
Child1 and Child2. In the timeline, the Parent instance is named as
mcParent.
So somewhere in a function I will write like:
function myFunction():Void
{
gotoAndStop("TestFrame");
trace( this["mcParent"] ); // it returns _level0.mcParent
trace( Parent( this["mcParent"] ); // the movieclip is there, but it
returns null }
Somehow I cannot get Parent as the Parent class. If I revise logic like:
function myFunction():Void
{
gotoAndStop("TestFrame");
trace( this["mcParent"] ); // it returns _level0.mcParent
trace( Parent( this["mcParent"] ); // the movieclip is there, but it
returns null
this.onEnterFrame = laterFunction;
}
function laterFunction():Void
{
this.onEnterFrame = null;
trace( this["mcParent"] ); // it returns _level0.mcParent
trace( Parent( this["mcParent"] ); // now it returns _level0.mcParent
correctly }
The similar problem exists in Child1 and Child2 inside Parent timeline. It
seems to me that the MovieClip is not converted to its associated class
until later time, so I have to split my logic into two different functions,
whic makes the code look cumbersome and hard to manage.
A more detailed example of the problem above can be downloaded at,
http://www.acts.net/Flash/ComponentBlue.zip
Although putting components on the stage using attachMovie might solve the
problem, but I would like the designer to have the freedom to arrange the
components on the stage the way he likes, and attachMovie would take away
this freedom. I wonder if anyone has a cleaner way around this problem.
TIA!
- Tangent
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com