ForumsProgramming ForumAddChild in AS3

7 8207
kevinseven11
offline
kevinseven11
36 posts
Nomad

Okay Ive been learnin alot about AS3 but i dont understand how AddChild() can even be anything.Its not a variable and I think its a class but when I look theres no class for it, is it a function?
Thanks

  • 7 Replies
clipmaster3
offline
clipmaster3
104 posts
Nomad

addChild() is a function of the DisplayObjectContainer class
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/display/DisplayObjectContainer.html#addChild()

Erasmus_Darwin
offline
Erasmus_Darwin
59 posts
Nomad

It's worth noting that Stage, Sprite, and MovieClip (among other classes) are all direct or indirect subclasses of DisplayObjectContainer. So if you've got an object of one of those types, you can call addChild on it.

kevinseven11
offline
kevinseven11
36 posts
Nomad

oh thanks guys, when you add it and it has the () do you have to put the X and Y cordinates everytime? or is there a default?

dank
offline
dank
986 posts
Peasant

You can look it up in the docs if you aren't sure about it's parameters.
In Flash, go to Help>Flash Help, or press F1. Then search addChild(). When you find it, YOu'll see that it says:

public override function addChild(childisplayObject)isplayObject

the part that says childisplayObject tells you that it takes one parameter of a DisplayObject (or one of its subclasses).
kevinseven11
offline
kevinseven11
36 posts
Nomad

dude thanks alot, ill keep learnin

max3624
offline
max3624
1 posts
Nomad

How can I use delay in addChild?

Darkroot
offline
Darkroot
2,763 posts
Peasant

How can I use delay in addChild?


With a timer?
Showing 1-7 of 7