The ActionScript 3 `addChild()` function
Questions tagged [addchild]
287 questions
3
votes
1 answer
The supplied DisplayObject must be a child of the caller
I am a newbie, and I have seached and tried for weeks on this, and I cannot get the grip on this. The simple code below gives the "The supplied DisplayObject must be a child of the caller" error.
var square = new…

Harald
- 31
- 1
- 1
- 2
3
votes
4 answers
PHP SimpleXML::addChild with empty string - redundant node
Calling addChild with an empty string as the value (or even with whitespace) seems to cause a redundant SimpleXml node to be added inside the node instead of adding just the node with no value.
Here's a quick demo of what happens:
[description] =>…

Dave
- 155
- 2
- 5
3
votes
1 answer
Correct use of addChild
I'm new to coding and AS3. I was reading about adding things to the stage using AS3 and learned about the addChild method. Reading more I found that there are different ways to use it. I also read that some ways are better than others, and that some…

NPN328
- 1,863
- 3
- 27
- 47
2
votes
2 answers
Can an AS2 swf be loaded into an AS3 swf? How can I add this to the stage and interact with it from As3 swf?
I am trying to load a swf written in AS2 into an AS3 swf - using Loader class and listening for Event.COMPLETE. in my onCompleteHandler function i want to add this to the stage so Im trying -
addChild(evt.currentTarget.content)
... but I get the…

undefined
- 5,190
- 11
- 56
- 90
2
votes
1 answer
What is the proper way to create draft page programatically in the Wagtail?
Just to save page I do:
parent_page = Page.objects.get(title="parent")
page = Page(title="child", owner=request.user)
parent_page.add_child(instance=page)
page.save() # not sure if this required
What if I need to save Draft Page? This code seems to…

Igor Margitich
- 43
- 7
2
votes
1 answer
Populating VirtualStringTree as virtually as possible?
I'm trying to populate a VirtualStringTree. My underlying data are like this, here showing 3 of many branches, each of which has a varied number of twigs.
string 1
chunk:string 1, fname:c:\temp\file0.txt, freq:8
chunk:string 1,…

Mike Scott
- 169
- 2
- 8
2
votes
1 answer
My SKSpriteNode wouldn't show even though I used addChild in swift
I tried to add an image to my Game Scene, but it won't appear. Below is my code. I hope you guys can help me
import SpriteKit
import GameplayKit
class GameScene: SKScene {
var Ground = SKSpriteNode()
var iceCream = SKSpriteNode()
…

Claire Cho
- 87
- 1
- 11
2
votes
1 answer
NSTreeController get added child
When NSTreeController -(void)addChild:(id)sender is called, is there a way to get the NSManagedEntity that was created?
The documentation mentions that the result of this method is deferred to the next loop run.

sharvey
- 7,635
- 7
- 48
- 66
2
votes
1 answer
AddChild to the stage only once when revisiting frame
I have two frames.
In the first frame you can click a button to go to the next frame. In the first frame I want to add menu1 to the stage just once. If we go to the next frame and then back to the first frame, the menu1 should not be created again…

Jack
- 57
- 7
2
votes
2 answers
OpenFL - How to use addChild in another class?
The answer should be simple but I can't find out how anywhere..
So I have a Main.hx class and a ObjectManager.hx class.
In the main class's constructor, it calls ObjectManager.addAllToScreen(); and my objectManager should then add the objects to…

k13ran
- 147
- 12
2
votes
4 answers
Adding elements to other elements
I have been using .net for the past couple of years, and I like the way you can add controls at any point in the page from anywhere. For example, you can say Head.Controls.add(new LiteralControl("

ClarkeyBoy
- 4,934
- 12
- 49
- 64
2
votes
1 answer
AS3 addChild with multiple buttons top layer fails
this seems like an odd one as it seems pretty straight forward, I have a movieclip that contains a back and forward button to invoke a tween for 2 groups of buttons to slide accross the screenI addChild then make the tween and then removeChild for…

TravisF
- 459
- 6
- 13
2
votes
1 answer
How to add sub-child to a child of self in swift
I am trying to add two SKSpriteNodes with their respective textures in swift, however the "Blade" does not show up on screen during the simulation. I am having no trouble getting the "Handle" to appear though. So my question is, what is the proper…

Lahav
- 781
- 10
- 22
2
votes
2 answers
AS3: Actions inside dynamically added movie clip not working
I have a very strange problem with a simple test I'm trying to do in AS3.
I have two functions on my first frame:
function function1 ():void {
trace ('function1 executed');
mc.gotoAndStop (2);
function2 ();
}
function function2…

DanielFox
- 675
- 2
- 9
- 18
2
votes
1 answer
Adding a child to a child
In AS3, I am trying to add a child to a specific child of a MovieClip.
To do this I have done the following:
for (var r:Number = 0; r < 2; r++) {
sand = new Sand();
sLayers.getChildAt(r).addChild(sand);
}
When sLayers is the MovieClip…

XactVisual
- 23
- 3