시 나 웨 이 보 의 마법 표정 발표 에서 배 웠 습 니 다.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<div id="aini"></div><br />
<button id="btn">    </button>
<button id="stop">    </button>
<button id="rewind">  </button>
<script>
$(function() {
	var flashParams = {
			id: "view_ani",
            quality: "high",
            allowScriptAccess: "always",
            wmode: "transparent",
            allowFullscreen: true,
            allownetworking: "internal",
            play:false
	};
	swfobject.embedSWF('swf/2.swf', 'aini', "440", "360", "10.0.0", null,null, flashParams);
	var timer;
	$("#btn").click(function() {
		var swf = swfobject.getObjectById('aini');
		swf.Play();
		timer = setInterval(function() {
			var CurrentFrame = swf.CurrentFrame();
			var totalFrame; 
				try{
					totalFrame = swf.TotalFrames();
				}catch(e) {
					totalFrame = swf.TotalFrames;
				}
			console.log((CurrentFrame * 100 / totalFrame).toFixed(2));			
		} , 1000);
	});
	$("#stop").click(function() {
		clearInterval(timer);
		var swf = swfobject.getObjectById('aini');
		swf.StopPlay();
	});
	$("#rewind").click(function() {
		clearInterval(timer);
		var swf = swfobject.getObjectById('aini');
		swf.Rewind();
	});
	
});
</script>
</body>
</html>

좋은 웹페이지 즐겨찾기