mercredi 30 décembre 2015

addChild() issue: error 2007 on AS3

I have this piece of code that's suppose to add a swf file (homePage.swf) inside my main file (skeleton.fla).

var mcHome:MovieClip;

var newPage: Loader = new Loader();
newPage.load(new URLRequest("homePage.swf"));

newPage.contentLoaderInfo.addEventListener(Event.COMPLETE, homeLoaded);

function homeLoaded(event:Event): void {
    mcHome = MovieClip (newPage.contentLoaderInfo.content);
    newPage.contentLoaderInfo.removeEventListener(Event.COMPLETE, homeLoaded);


I keep getting this error:

TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChild()
    at skeleton_fla::MainTimeline/homeLoaded()

I don't know how to solve it, or what to change!

Help please, I'm a bit desperate.

Aucun commentaire:

Enregistrer un commentaire