actionscript-3 - 将MC1的pauseposition转移到MC2的AS3

  显示原文与译文双语对照的内容
0 0

嗨我是 Flash 上的新手需要一些代码。 我有 3个 MC1 说,MC2MC3 。 我将拥有 3个专用按钮,暂停一个MC的音乐,并将帧位置转移到另一个 MC,开始播放。 例如例如,如果 MC2 正在播放,然后按 MC3 按钮我希望它将 MC2 ( 非 MC1 )的暂停位置,并继续在 MC3 中继续播放,并将从 MC2MC3的画面转换为。 它是一个多语言应用程序,所有 3都具有相同的帧长度。 换句话说,我想在语言之间进行 switch 。 感谢你的帮助,任何帮助都会。

编辑:到现在为止


mtlyrvult.stop();
itlyrvult.stop();

engvult.addEventListener(MouseEvent.CLICK, playMC1); 

function playMC1(e:MouseEvent):void {
 itlyrvult.stop();
 enlyrvult.gotoAndPlay(itlyrvult.currentFrame);
 itlyrvult.gotoAndStop(1);//frame one is empty
 engvult.mouseEnabled = false;
 itvult.mouseEnabled = true;
}

itvult.addEventListener(MouseEvent.CLICK, playMC2); 

function playMC2(e:MouseEvent):void {
 enlyrvult.stop();
 itlyrvult.gotoAndPlay(enlyrvult.currentFrame);
 enlyrvult.gotoAndStop(1);//frame one is empty
 itvult.mouseEnabled = false;
 engvult.mouseEnabled = true;
} 

从一种语言切换到另一种语言。 我的客户给了我另一种语言。 mtlyrvult 和我不知道AS3如何识别哪个mc正在播放 pauseposition/currentframe 。

时间: 原作者:

0 0

我坚持你的代码( 没有类,方法,成员,addChild,。) 。 我没有使用 Flash 或者SDK尝试最后的草稿。

我认为你有:

  • 3 MovieClip 对象: enlyrvultitlyrvultmtlyrvult
  • 3 InteractiveObject ( SimpleButton,MovieClip,。) 对象: engvultitvultmtvult
  • 当我们开始时,enlyrvult 正在播放( 如果不是: enlyrvult.play(); 或者 enlyrvult.stop(); ) 。


itlyrvult.stop();//or itlyrvult.gotoAndStop(1); 
mtlyrvult.stop();//or mtlyrvult.gotoAndStop(1);

engvult.addEventListener(MouseEvent.CLICK, playMC1); 
itvult.addEventListener(MouseEvent.CLICK, playMC2); 
mtvult.addEventListener(MouseEvent.CLICK, playMC3); 

//play enlyrvult
function playMC1(e:MouseEvent):void {
//stop them
 itlyrvult.stop();
 mtlyrvult.stop();

//play me
 enlyrvult.gotoAndPlay(mtlyrvult.currentFrame);

//hide them
 itlyrvult.gotoAndStop(1);//frame one is empty
 mtlyrvult.gotoAndStop(1);//frame one is empty

//My trigger is out, theirs are fine
 engvult.mouseEnabled = false;
 itvult.mouseEnabled = true;
 mtvult.mouseEnabled = true;
}

//play itlyrvult
function playMC2(e:MouseEvent):void {
//stop them
 enlyrvult.stop();
 mtlyrvult.stop();

//play me
 itlyrvult.gotoAndPlay(enlyrvult.currentFrame);

//hide them
 enlyrvult.gotoAndStop(1);//frame one is empty
 mtlyrvult.gotoAndStop(1);//frame one is empty

//My trigger is out, theirs are fine
 itvult.mouseEnabled = false;
 engvult.mouseEnabled = true;
 mtvult.mouseEnabled = true;
} 

//play mtlyrvult
function playMC3(e:MouseEvent):void {
//stop them
 enlyrvult.stop();
 itlyrvult.stop();

//play me
 mtlyrvult.gotoAndPlay(itlyrvult.currentFrame);

//hide them
 enlyrvult.gotoAndStop(1);//frame one is empty
 itlyrvult.gotoAndStop(1);//frame one is empty

//My trigger is out, theirs are fine
 mtvult.mouseEnabled = false;
 engvult.mouseEnabled = true;
 itvult.mouseEnabled = true;
}

或者,你想要多少( 300) 。


//add to your import:
import flash.utils.Dictionary;

//in your const/var section
const STARTING_FRAME:int = 1;
var dict = new Dictionary();//mapping and memory
var currentTrack:MovieClip;//we will know who's last

initAll();
playTrack(enlyrvult, STARTING_FRAME, engvult);

function clickHandler(e:MouseEvent):void {
 var playheadFrame:int = currentTrack.currentFrame;//we remember position
 var trigger:InteractiveObject = (e.currentTarget as InteractiveObject);//who shot me?
 var nextTrack:MovieClip = (dict[trigger] as MovieClip);//who's next?

 resetAll();//and again.. (http://en.wikipedia.org/wiki/Sisyphus)
 playTrack(nextTrack, playheadFrame, trigger);
}

function playTrack(mc:MovieClip, fram:int, iObj:InteractiveObject):void {
 currentTrack = mc;
 currentTrack.gotoAndPlay(fram);
 iObj.mouseEnabled = false;
}

function resetAll():void {
 for (var key:InteractiveObject in dict) { key.mouseEnabled = true; }
 for each (var value:MovieClip in dict) { value.gotoAndStop(1); }//diff-> each
} 

function initAll():void {
 dict[engvult] = enlyrvult;
 dict[itvult] = itlyrvult;
 dict[mtvult] = mtlyrvult;
//dict[avult] = alyrvult;//<- new one like this: dict[trigger]=lyrMC; add as much as you can!

 for (var key:InteractiveObject in dict) {
 key.addEventListener(MouseEvent.CLICK, clickHandler);
 }

 resetAll();
}

原作者:
...