Actionscript 3 AS3";“进口包装”;无法工作-captivate中的拖放游戏
我正试图把一个AS3“拖放”游戏放到captivate 6的幻灯片上。独立swf工作正常,但一旦将其导入captivate中的幻灯片并发布,captivate就会将其所有内容重新包装到另一个swf中,从而丢失导入的游戏包 在flash中的主时间线上,我有动作Actionscript 3 AS3";“进口包装”;无法工作-captivate中的拖放游戏,actionscript-3,flash-cs5.5,adobe-captivate,Actionscript 3,Flash Cs5.5,Adobe Captivate,我正试图把一个AS3“拖放”游戏放到captivate 6的幻灯片上。独立swf工作正常,但一旦将其导入captivate中的幻灯片并发布,captivate就会将其所有内容重新包装到另一个swf中,从而丢失导入的游戏包 在flash中的主时间线上,我有动作 import com.test.games.*; var dragArray:Array = [comment1, comment2, comment3, comment4, comment5, comment6, comment7, c
import com.test.games.*;
var dragArray:Array = [comment1, comment2, comment3, comment4, comment5, comment6, comment7, comment8 ];
var matchArray:Array = [leftMatch, leftMatch, rightMatch, rightMatch, rightMatch, leftMatch, rightMatch, leftMatch ];
var posArray:Array = [ {x:154, y:362}, {x:154, y:316}, {x:641, y:362}, {x:641, y:316}, {x:641, y:270}, {x:154, y:270}, {x:641, y:224}, {x:154, y:224} ];
var dragGame:DragGame = new DragGame(stage, dragArray, matchArray, posArray);
dragGame.addEventListener(DragGame.MATCH_MADE, onMatch);
dragGame.addEventListener(DragGame.NO_MATCH, onFlub);
dragGame.addEventListener(DragGame.ALL_DONE, onDone);
function onMatch(event:Event):void {
var matchSound:Sound = new MatchSound();
matchSound.play();
}
function onFlub(event:Event):void {
var flubSound:Sound = new FlubSound();
flubSound.play();
}
function onDone(event:Event):void {
var applause:Sound = new Applause();
applause.play();
}
但我认为造成问题的原因是
import com.test.games.*;
当被captivate的swf重新包裹时是否会丢失,如果这有意义的话
我是否需要以root或其他什么为目标才能工作,或者是否有一种方法可以将所有文件的包嵌套在主时间轴中
(我发现这款游戏是免费的,所以我对AS3作为一种语言不太有信心,请温柔些)我想这是因为当你把它导入Captivate时,
阶段的值可能是空的。用以下命令覆盖:
var dragGame:DragGame; // uninitialized!
if (stage) init() else addEventListener(Event.ADDED_TO_STAGE,init);
function init(e:Event=null):void {
removeEventListener(Event.ADDED_TO_STAGE,init);
// here we have stage available, let's make a game
dragGame = new DragGame(stage, dragArray, matchArray, posArray);
dragGame.addEventListener(DragGame.MATCH_MADE, onMatch);
dragGame.addEventListener(DragGame.NO_MATCH, onFlub);
dragGame.addEventListener(DragGame.ALL_DONE, onDone);
}
谢谢,我尝试过改变它,但它破坏了它作为一个独立的版本,不幸的是,在Captivate中也不起作用。我认为这与“import com.test.games.*”有关,因为其他任何东西都可以工作,我甚至可以在captivate中拖动元素,只是答案保存在引用的AS3包文件中。请参见编辑的代码。我忘了在一个例子中有一个阶段是存在的。我认为导入根本不会中断,导入是为编译器而不是为运行时而进行的。