我试图与AS3中的外部SWF文件中的影片剪辑进行通信并收到错误1050

时间:2014-04-05 17:37:04

标签: actionscript-3 flash actionscript

好的,所以在AS3,CS4中,我正在尝试与外部SWF中的影片剪辑进行通信。我可以与其中一个影片剪辑进行通信:backunit1game2_mc(它做我想要的),但我无法与next3_mc通信。我收到以下错误:unloadmovie TypeError:错误#1010:术语未定义且没有属性。     在Game3Unit1_Scene1_fla :: MainTimeline / unMovieLoad() 卸载

我已将next3_mc导出为ActionScript文件。此外,我似乎无法在任何其他Flash程序中导出任何影片剪辑,并重做我使用backunit1game2_mc所做的事情。当我试图出口时,有什么我可能做错了吗?请帮忙!!!我有以下代码:

var loadedSWF:Loader = null;

/**
 * Loads an SWF and adds it to container once complete
 * @param file The URL to the SWF to load
 * @param container The container to add the SWF to
 */
function loadSWF(file:String, container:MovieClip=null):void
{
    if(container == null) container = MovieClip(root);

    // removes the previously loaded SWF
    if(loadedSWF != null)
    {
        if(loadedSWF.parent) loadedSWF.parent.removeChild(loadedSWF);
    }

    var req:URLRequest = new URLRequest(file);
    loadedSWF = new Loader();
    loadedSWF.load(req);

    addChild(loadedSWF);


}

nextunit1game1_mc.addEventListener(MouseEvent.CLICK, _click);
function _click(e:MouseEvent):void
{
    loadSWF("game3unit1game2.swf");
    loadedSWF.contentLoaderInfo.addEventListener(Event.COMPLETE, unMovieLoad);
}


function unMovieLoad(event:Event):void
{

    trace("unloadmovie");

    /* In order to be able to access a movie clip in an external SWF
    file, you must first export that for use in the other file.  Right click on 
    the movie clip, select properties, and export to AS file.  */

    /*  Here we are making the menu button return us to the main menu.*/

    event.target.content.backunit1game2_mc.buttonMode = true;
    event.target.content.backunit1game2_mc.addEventListener(MouseEvent.CLICK, returnTogame1);
    event.target.content.next3_mc.buttonMode = true;
    //event.target.content.nextunit1game2_mc.addEventListener(MouseEvent.CLICK, goTogame3);

}


function returnTogame1(event:MouseEvent):void
{

    //this.parent.parent.parent.removeChild(bgLoader);

    /* This unloads the movie */

    removeChild(loadedSWF);
    trace("unload");
}

0 个答案:

没有答案