Flash ~ Javascript call Flash function

Flash Object

<object
id="Test" width="950" height="360"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="Test.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#000000" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="Test.swf" quality="high" bgcolor="#000000"
width="950" height="360" name="Test" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>


Javascript call Flash

<script type="text/javascript">
function doPassVar(args){
var sendText = args;
document.Test.caseRotation(sendText);
}
</script>


Flash ~ Action Script

var xxxxxx:Qoooooooooooo= new Qoooooooooooo();
ExternalInterface.addCallback("caseRotation", xxxxxx.caseRotation);

public class Qoooooooooooo
{
public function caseRotation(x:int):void
{
//do something
}
}


Reference
http://blog.kyart.com.tw/article/4975362739/3357911199/

http://www.adobe.com/tw/support/flash/ts/documents/javascript_comm.htm

沒有留言:

發佈留言