The ActionScript 3 `addChild()` function
Questions tagged [addchild]
287 questions
0
votes
2 answers
AS3: How can I add a children (instance) on stage every time I press the button without replacing the existing children?
How can I add a children (instance) on stage every time I press the button without replacing the existing children?
I have four Classes: Symbol1, Symbol3, Symbol4, all.
When I Press Symbol3 which is a button I want to create an instance of Symbol1…

irnik
- 139
- 1
- 2
- 13
0
votes
2 answers
Use FLVplayback in FlashDevelop, add Sprite Class to a World in AS3
Hi (excuse me if there are grammar mistakes, I'm french),
I'm a beginner in AS3 but I know a bit better Flashpunk; whatever, I have really some difficulties to code in AS3 and can't get how to insert a video in an AS3 project using…

Lap
- 11
- 4
0
votes
1 answer
AS3 How to add a Class on the stage from a timer?
lots of help from you guys :). My next question is here :).
I have timer in class MyTimer.as and Thief1_mc.as movie clip.
How can I addChild(Thief1_mc) on the stage from MyTimer? Everything looks simple, the only problem is "stage" property.…

irnik
- 139
- 1
- 2
- 13
0
votes
2 answers
AS3: Is it possible to add child in a specific area on the screen which is not a rectangle?
I need to add many children (addChild()) in a specific area. This area is not in a regular shape (figure). I noticed that if I want to add many children into my figure Flash creates rectangle that represent my figure and some of my children are…

irnik
- 139
- 1
- 2
- 13
0
votes
1 answer
randomly generating images on screen, how do i get it to loop after a certain amount
so I'm creating a project and for the background I want stars randomly appearing and dissapearing from the screen.
I have the stars randomly appearing, but they just stay on the screen and eventually fill the whole screen with stars. I would like…
0
votes
1 answer
MovieClip did not play animation when using addChild()
i am trying to make a simple flash game.
And I've been searching about this problem but I can't found any questions/answers that helped me, so here it is:
I am trying to use addChild() to generate the pokemon Movieclips
var comPkm:MovieClip =…

Briandito
- 9
- 4
0
votes
1 answer
PHP/SimpleXML. How to add child to node returned by xpath?
I have a simple XML string:
$sample = new SimpleXMLElement(' ');
and i try to find node with xpath() and add child to this node.
$node = $sample->xpath('//parent');
$node[0]->addChild('child2');
echo…

Andrew Roo
- 61
- 1
- 2
- 5
0
votes
1 answer
Adding and removing children in AS3?
So, I'm trying to do this sort of thing where, if Cosmo.hitTestObject, Asteroid 5 should be removed, however I want it immediately added back at a different position, so the hit test isn't triggered automatically. How would I go about doing…

user2072135
- 59
- 1
- 12
0
votes
1 answer
Type 1061: Call to a possibly undefined method addChild through a reference with static type slotmachine:SlotMachineGame
Im having issues with this part of the code, it's supposed to add the pieces into an array, but I keep getting this error.
This is the part of the code:
function addPiece(xCoord:Number,yCoord:Number,id:Number){
classLoader =…

Alejandro
- 5
- 3
0
votes
1 answer
Error adding sprites using addchild method: argument must to be non-nil
I've a problem using the method addchild adding sprites
previously I've never had this problem and I could add png files without problems,now sometimes if I try to add some sprites to the scene using the addchild method I receive these…

Jacopo.R
- 1
- 1
0
votes
2 answers
AS3 - Trying to place 5 rows of 5 squares
This code is meant to place an instance of a movieclip called BasicGrid on to my stage 25 times, then if the X co-ordinate of the new movieclip is over 128 it starts placing them on a new line.
But for some reason I can't get it to work no matter…

CodeMode
- 55
- 2
- 8
0
votes
1 answer
Creating XML File using simplexml_load_string, addChild, and addAttribute
This is what I have so far:
This is the output I am receiving: http://i.imgur.com/mGRAJPe.gif
It seems all of the subfield nodes are becoming a child of the 1st datafield element, instead of being nested in their respective datafield parent. Any…

rtd1123
- 482
- 2
- 7
0
votes
1 answer
How do I pass variables to new children? [flash AS3]
The code illustrates the problem pretty well, I've cut everything unrelated out.
Create 2-4 kinsmen when the game starts
function createInitialKinsmen()
{
for (var k:int = 1; k < 3 + Math.round(Math.random() * 2; k++)
{
if (k == 1)
…

Ashton
- 7
- 2
0
votes
4 answers
Adding to Stage in ActionScript 3 from a .as file
Note: Yes, I know that similar questions have been asked before. However, after following the answers in such questions I'm still stuck and can't find a solution to my problem.
I'm having a problem which requires adding DisplayObjects to the Flash…

Anthony
- 25
- 1
- 11
0
votes
1 answer
TextField appears on stage when it's not a child of DisplayContainer?
Really need some help understanding whats going on after
textFields[i].text = thisWord.charAt(i);
I understand it updates a value at that particular index, I just can't figure out why it…

laphiloctete
- 476
- 1
- 6
- 20