简体   繁体   English

在ActionScript 2中加载外部SWF

[英]Loading external SWF in Actionscript 2

I am creating an animation within Flash CS4 in Actionscript 2.0 / Flash Player 7 我正在ActionScript 2.0 / Flash Player 7中的Flash CS4中创建动画

At the moment I have a handler (Movie Clip) called myHolder that is used to play other swf files within one main swf file, when called by a button 目前,我有一个名为myHolder的处理程序(影片剪辑),当通过按钮调用该处理程序时,该处理程序用于播放一个主swf文件中的其他swf文件。

Within a button that load the swf into the main timeline - For Example 在将swf加载到主时间轴的按钮内-例如

on (press)
{
    loadMovie("BulletTrainDRAFT.swf", myHolder);
}

This works fine with bring other swf files into the main swf file timeline, but when I bring a swf file that has video controls for a video within it, they do not respond within the handler when played, but they do work when that swf file is played within its own external flash player window (The video is within a (Movie Clip) on its own timeline within its design fla) 在将其他SWF文件带入主SWF文件时间轴时,此方法可以很好地工作,但是当我将其中包含用于视频的视频控件的SWF文件带入时,它们在播放器中不会在处理程序中响应,但在该SWF文件中起作用在自己的外部Flash播放器窗口中播放(视频在其设计范围内的自己的时间轴上的(影片剪辑)中)

Video buttons - ActionScript 2.0 视频按钮-ActionScript 2.0

btnStop.onPress = function(){

    _root.vid.stop();

}
btnPlay.onPress = function(){

    _root.vid.play();

}

btn_fastforward.onPress = function(){

    _root.vid.nextFrame();

}

btn_Rewind.onPress = function(){

    _root.vid.prevFrame();

}

I tried ActionScript 3.0 code as well 我也尝试了ActionScript 3.0代码

Pausebtn.addEventListener(MouseEvent.CLICK,pauseHandler);
Stopbtn.addEventListener(MouseEvent.CLICK, stopHandler);
Playbtn.addEventListener(MouseEvent.CLICK,playHandler);

function stopHandler(event:MouseEvent):void {
// Pause the stream and move the playhead back to
// the beginning of the stream.
video.gotoAndStop(1);
}
function playHandler(event:MouseEvent):void {
// Pause the stream and move the playhead back to
// the beginning of the stream.
video.play();
}
function pauseHandler(event:MouseEvent):void {
// Pause the stream and move the playhead back to
// the beginning of the stream.
video.stop();
}

Problem I have I think, is that a movie the external swf loads on the existing timeline as a child and doesn't unload the timeline resulting the actionscript not functional, but I can't fix this. 我想的问题是,外部SWF影片是在儿童时期加载到现有时间轴上的,并且不会卸载时间轴,导致动作脚本无法正常工作,但是我无法解决此问题。

This was fixed by adding 通过添加解决此问题

this._lockroot=true

to the video main fla timeline, after some help on the adobe forums ^_^ 在Adobe论坛上获得一些帮助后,转到视频主fl时间线^ _ ^

Thank you again everyone for your help 再次感谢大家的帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM