2013-03-27 1 views
2

Captivate 6의 슬라이드에 AS3 "드래그 앤 드롭"게임을 넣으려고합니다. 독립형 swf는 제대로 작동하지만 가져 오자 마자 Captivate의 슬라이드에 올려 놓고 게시하면 Captivate는 모든 콘텐츠를 다른 SWF로 다시 래핑하므로 가져온 게임 패키지가 손실됩니다. 플래시의 기본 타임 라인에AS3 "가져 오기 패키지"가 작동하지 않음 - Captivate에서 게임을 드래그 앤 드롭

나는 액션

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.*; 

에서 4 개 패키지 파일이 유실되고 있다는 것입니다 원인을 생각한다 그걸 이해한다면, 마음을 사로 잡다.

작동하려면 루트 또는 그 밖의 대상을 지정해야합니까, 아니면 기본 타임 라인이있는 모든 파일에 대해 패키지를 중첩하는 방법이 있습니까?

은 (게임 내가 발견 공짜입니다 - 그래서 부드러운 주시기 바랍니다 언어로 AS3와 majorly 확신 아니에요) 나는 stage 값이 null이 될 수 있기 때문에 당신이 Captivate에서이 점을 가져올 때 그것의 기대

답변

1

. 재정의 :

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); 
} 
+0

고마워, 내가 이것을 변경하려고했지만 독립형 버전으로 그것을 깨고 안타깝게도 Captivate에서 작동하지 않습니다. 나는 그것이 "import com.test.games. *;"와 관련이 있다고 생각합니다. 다른 작품처럼 끊어짐 나는 요소를 끌기조차 할 수 있습니다. 그 대답은 참조 된 AS3 패키지 파일 – Randy4

+0

에 보관되어 있습니다. 편집 된 코드를 참조하십시오. 나는 그 무대가 한 가지 경우에 있다는 것을 잊었다. – Vesper

+0

나는 임포트가 전혀 중단 될 수 있다고 생각하지 않는다. 임포트는 런타임이 아닌 컴파일러를위한 것이다. – Vesper