views:

20

answers:

3

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 trackListingBox:trackListingScreen = new trackListingScreen();
addChild(trackListingBox);

it either doesn't run the actionscript, or it's somehow broken. Can children not run their own action script?

A: 

Maybe try adding some code to your MovieClip which will fire when the movie clip is added to the stage. Something like this:

this.addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
function onAddedToStage(e:Event):void {
functionWhichLoadsHTML();
}
JohnWinkelman
A: 

They can "run their own actionscript" fine. There's probably a bug in your code in the child clip, but I can't give any advice on it without actually seeing the code.

davr
A: 

the problem was that the actionscript was loading before the items it was referring to, thereby giving me errors that items were not found.

HeroicNate