来自flash cs3的我的javascript函数没有被调用。 "测试"调用脚本顶部的警报,所以我知道javascript正在运行。闪光灯播放得很好,以便正常工作。下面是动作脚本和html。我错过了什么?
为:
package
{
import flash.external.*;
import flash.display.MovieClip;
import flash.events.Event;
public class AnimatingObject extends MovieClip
{
// constants
public const ANIMATION_COMPLETE:String = "animation_complete";
/**
* Constructor
*/
public function AnimatingObject()
{
addEventListener(Event.ENTER_FRAME, frameEnter);
}
/**
* Called on dispatch of Event.ENTER_FRAME
*/
private function frameEnter(e:Event):void
{
if(currentFrame == totalFrames)
{
ExternalInterface.call("stoppedPlaying");
trace( "Event complete" );
var evt:Event = new Event(ANIMATION_COMPLETE);
dispatchEvent(evt);
}
}
}
}
使用Javascript:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<!--<link rel="stylesheet" href="style.css">-->
<script type="text/javascript">
alert("test");
function stoppedPlaying(){
alert("finished");
}
</script>
</head>
<body width="100%" height="100%">
<!--<embed src="dalogo.swf" width="100%" height="100%" quality="high">-->
<object width="500" height="500">
<param name="movie" value="dalogo.swf">
<param name="AllowScriptAccess" value="always">
<embed src="dalogo.swf" width="100" height="100">
</embed>
</object>
</body>
</html>