2013-05-13 92 views
2

我在html5邊緣動畫中遇到問題。我使用邊緣動畫創建了一個動畫。 我想從外面調用邊緣動畫的構圖。我嘗試使用$.Edge.registerCompositionReadyHandler(compId, handlerFn, options),但它給出錯誤ReferenceError: $ is not defined。我無法解決這個問題,我沒有找到足夠的文件。誰能幫幫我嗎。來自javascript的調用組合準備(邊緣動畫)

我的代碼看起來像這樣

<!DOCTYPE html> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/> 
<title>Untitled</title> 
<!--Adobe Edge Runtime--> 

<script type="text/javascript" charset="utf-8" src="teste1_edgePreload.js"></script> 
<script type="text/javascript" src="teste1_resize.js"></script> 
<style> 
    .edgeLoad-EDGE-1429726 { visibility:hidden; } 
</style> 
<!--Adobe Edge Runtime End--> 

<script> 
    $.Edge.registerCompositionReadyHandler("EDGE-1429726",scaleStage) //SCALE STAGE IS INSIDE THE JAVASCRIPT fn teste1_resize.js 
function mover(){ 
     var stage = $.Edge.getComposition("EDGE-1429726").getStage(); 
     console.log($("#Stage").height()); 
     stage.mover(); 
} 
</script> 

</head> 
<body style="margin:0;padding:0;"> 
<div id="Stage" class="EDGE-1429726"> 
    <input type="button" value="Mover" onClick="mover();"> 
</div> 

</body> 

在此先感謝

回答

6

有了Ena的幫助和很少的修改,我能夠找到答案。

AdobeEdge.bootstrapCallback(function(compId) { 
    AdobeEdge.Symbol.bindElementAction(compId, 'stage', 'document', 'compositionReady', function(sym, e){ 
     // composition is loaded, do stuff here 
    }); 
}); 
3

而不是

$.Edge.registerCompositionReadyHandler 

使用

AdobeEdge.registerCompositionReadyHandler 

而且,把你的代碼這個函數中:

AdobeEdge.bootstrapCallback(function(compId) { 
    // Register your handlers here 
}); 

所以你一定階段被加載,您可以在其註冊的處理程序。

+0

嘿,我已經嘗試過這幾天回去,但它沒有工作:( – 2013-05-23 16:39:18

+0

現在我使用JavaScript超時遺憾的是:( – 2013-05-23 16:47:19

+0

嘗試反轉裝載腳本的順序: <腳本類型=」文本/ JavaScript的」 SRC = 「teste1_resize.js」> <腳本類型= 「文本/ JavaScript的」 字符集= 「UTF-8」 SRC = 「teste1_edgePreload.js」> 從內部的Adobe邊緣動畫 然後,在代碼窗口添加事件Stage> compositionReady。在代碼中調用您的函數: scaleStage(); – Ena 2013-05-24 08:37:32