Search code examples
flashactionscript-3actionscript-2

Simple as2 load into an as3 movie


I'm loading an as2 game into a as3 movie. No communication other than to play the game in the movie. I'm using a loader class.

function startLoad()
{
    var mRequest:URLRequest = new URLRequest(correctURL.toString());
    mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
    mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
    mLoader.load(">http://www.boomerang-tv.ro/sites/www.boomerang-tv.ro/files/flash/data/Scooby_Doo_-_Downhill_Dash/scoobydownhill-BM.swf");
}

function onCompleteHandler(loadEvent:Event)
{
    addChild(loadEvent.currentTarget.content);
}

When it finishes loading I get this error.

ArgumentError: Error #2180: It is illegal to move AVM1 content (AS1 or AS2) to a different part of the displayList when it has been loaded into AVM2 (AS3) content. at flash.display::DisplayObjectContainer/addChild() at main_fla::MainTimeline/onCompleteHandler()

Any ideas. I'm sure its simple it's just late :(

Thanks


Solution

  • Try adding the loader instead of the loader content.

    function onCompleteHandler(loadEvent:Event) 
    { 
       addChild(loadEvent.currentTarget.loader); 
    }