2007/7/16, John laPlante <[EMAIL PROTECTED]>:
> I'm writing a component and have created a MovieClip with
> createEmptyMovieClip. When I try to create sub-MovieClip inside the
> first MC with createEmptyMovieClip, it is undefined. This must be a
> basic Flash thing. I haven't used createEmptyMovieClip too much.
>
> I tried
> private var ItemContainer:MovieClip;
> private var CContainer:MovieClip;
>
> this.createEmptyMovieClip("ItemContainer",
this.getNextHighestDepth());
> this.ItemContainer.createEmptyMovieClip("CContainer",
> this.getNextHighestDepth());
Try this instead and see what it comes up with:
var itemContainer:MovieClip = this.createEmptyMovieClip("itemContainer",
this.getNextHighestDepth());
trace(itemContainer._name); // should be "itemContainer"
var subItem:MovieClip = itemContainer.createEmptyMovieClip("subItem",
itemContainer.getNextHighestDepth());
trace(subItem._name); // should be "subItem"
trace(subItem._parent._name); // should be "itemContainer"
It's a good idea to make variable names start with lowercase; the usual
code convention is that class names are initial caps, variable names are
lowercase with internal caps.
var classInstance:ClassName = new ClassName();
_______________________________________________
[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