The ActionScript 3 `addChild()` function
Questions tagged [addchild]
287 questions
1
vote
1 answer
AS3 - Adding new instances of a Class with Spacebar
I have 2 classes, Main and Rocket, and I am trying to create a new instance of Rocket every time I hit the space bar. Here is what I have right now:
Main.as:
package
{
import flash.display.MovieClip;
import flash.events.Event;
import…

RunningFromShia
- 590
- 6
- 20
1
vote
1 answer
AS3 - Get the child name from within itself (a bit like this.name):
I've added a MovieClip from the Library to the stage using the addChild() function.
The child name has come from an array.
I now need to place a piece of code within the MovieClip I added to look at itself and return what it's 'child' name is so…

TheD2000
- 213
- 1
- 2
- 7
1
vote
3 answers
AS3 dynamically attach MovieClip from a library to the Stage
I really have searched high and wide and i'm starting to think it may be my terminology that is preventing me from finding the answer.
I have a MovieClip in my library set to Export to ActionScript 3.0 with a Class called 'Info_Win' (its basically…

TheD2000
- 213
- 1
- 2
- 7
1
vote
1 answer
JInternalFrame does not show up
from my MainFrame I create a internal Frame and add that to my desktop pane, but the internal Frame just won't show up. I tried to figure it out for 3 hours now and I kinda need some help with it. Before I implemented the observer pattern it just…

Quatsch
- 361
- 1
- 8
- 29
1
vote
3 answers
flash as3: can children not run their own actionscript?
I thought I was being slick by having movieclips that I export for actionscript and then addChild later. I've made this one movieclip that loads html text through as, and it works fine when I drag it to the stage; but if I do
var…

HeroicNate
- 35
- 2
- 8
1
vote
1 answer
actionscript 3 addchild within child and clear the first child
Okay so here is the setup:
Within the main timeline I have a menu, which is a MovieClip. This menu is comprised of about 17 "buttons", each of which point to a different section of the site. When a "button" is clicked (2 examples: menu_bag_button,…

steve
- 688
- 6
- 13
- 32
1
vote
3 answers
Loading more than one child image AS3
I'm trying to load 2 images in to my flash file but getting an error - new to this AS3 malarkey any help would be appreciated!
Getting error: 5 1151: A conflict exists with definition request in namespace internal.
var myImage:String =…

Dave
- 108
- 2
- 15
1
vote
1 answer
AS3 - Can't access properties or methods of a MC child that has been added in script
I am still a bit of a beginner at AS3, so bear with me, please.
I have created a loop to instantiate tiles on a board. In the following example, "Gametiles" is an array containing objects of class "Tile" which is a class that extends MovieClip. …

Chris
- 11
- 1
1
vote
2 answers
AS3: A term is undefined when adding a shape inside a movieclip
I have what seems to be a very simple issue. I need to create a shape and add it inside a movie clip that is inside of another movie clip.
The code I am currently using is as follows:
var enemy_beacon:Shape = new…

user3600741
- 23
- 4
1
vote
1 answer
iOS SpriteKit creating and displaying objects from another class
I'm new to SpriteKit and I'm trying to display an object (a circle) created in a class, from MyScene.m. This is what I have:
in CreateNewCircle.h I wrote:
#import
@interface CreateNewCircle : SKScene
-(void)…

aleciuf
- 353
- 3
- 11
1
vote
1 answer
Difference between addNode and addChild
I 'm going through cocos2dx 3.0 beta2, the definition of UIWidget is confusing:
void Widget::addNode(Node* node, int zOrder, int tag)
void Widget::addChild(Node* child, int zOrder, int tag)
What is the deffrence between these two functions?

1hunch1kill
- 522
- 4
- 12
1
vote
1 answer
What does mx:target do in Flex 3?
There is an example on Adobe livedocs for using states:
…

Tony
- 18,776
- 31
- 129
- 193
1
vote
1 answer
AS3- how to addchild this array(john) correctly
I do not know how to add the john array and make a hittestobject with it.
Bal is a different class non relevant to this problem.
I've tried to do john[new Bal]
tried john[ k ]
tried z and to specify z as a for-loop but then i would just get Z…

user3276987
- 13
- 2
1
vote
1 answer
ActionScript 3.0 addChild throwing error
basically my issue is i got my main class..which has a variable which is the object holding my levels. but when i try to add the child to the stage i get an error...i have never had this error before and i am very confused. The error i get is…

Mark9135
- 101
- 11
1
vote
2 answers
addchild setting width and height
trying to do something pretty straight forward - have a function that adds child from library and sets position and width and height. Is adding fine but for some reason width and height aren't setting properly. Any suggestions?
code:
var…

user2561920
- 121
- 3
- 14