Container class doesn't have setChildByName but has getChildByName

23 views
Skip to first unread message

Oren Shvalb

unread,
Dec 27, 2015, 11:20:14 PM12/27/15
to CreateJS Discussion
Hi,

I see that Container has a getChildByName but I can't figure out how to add an object into container by name...

What am I missing?

Thank you.

Duncan Beevers

unread,
Dec 28, 2015, 8:57:49 AM12/28/15
to createjs-...@googlegroups.com
A name is a simple property of all DisplayObjects. Any DisplayObject can be added as a child to a container, and that child can later be retrieved by name. The method you're looking for is `addChild` (http://www.createjs.com/docs/easeljs/classes/Container.html#method_addChild). If you have a reference to the DisplayObject you want to add to the Container, pass that reference to the Container's `addChild` method.

--
You received this message because you are subscribed to the Google Groups "CreateJS Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to createjs-discus...@googlegroups.com.
To post to this group, send email to createjs-...@googlegroups.com.
Visit this group at https://groups.google.com/group/createjs-discussion.
For more options, visit https://groups.google.com/d/optout.

Oren Shvalb

unread,
Dec 28, 2015, 10:12:08 AM12/28/15
to createjs-...@googlegroups.com
You were right! it works - Thank you :-)

I think it would be better if 'Container' class would have a constructor with 'name' as parameter - it would be self explanatory this way.

--
You received this message because you are subscribed to a topic in the Google Groups "CreateJS Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/createjs-discussion/qjxcgO91Thg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to createjs-discus...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages