-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMovieClip.html
57 lines (54 loc) · 1.47 KB
/
MovieClip.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MovieClip</title>
<script src="images/TweenLite.min.js"></script>
<script src="http://code.createjs.com/easeljs-0.6.0.min.js"></script>
<script src="http://code.createjs.com/tweenjs-0.4.0.min.js"></script>
<script src="http://code.createjs.com/movieclip-0.6.0.min.js"></script>
<script src="http://code.createjs.com/preloadjs-0.3.0.min.js"></script>
</head>
<body onload="init()">
<div style="align:center"><canvas id="canvas" width="1440" height="600"></canvas></div>
<script>
var stage;
var imgList;
var mc;
function init(){
stage=new createjs.Stage("canvas");
stage.enableMouseOver(10);
mc=new createjs.MovieClip();
stage.addChild(mc);
for(var i=1;i<=4;i++){
var img=new BaseImage("images/"+String(i)+".jpg");
img.scaleX=img.scaleY=0.3;
img.x=144+300*(i-1);
img.y=45
mc.gotoAndStop(i);
mc.addChild(img);
}
mc.cursor="pointer";
mc.gotoAndStop(1);
createjs.Ticker.addEventListener("tick",tick);
}
function tick(e)
{
stage.update(e);
}
function BaseImage(src){
var s=this;
s.initialize();
var img=new Image();
img.onload=function(){
var bmp=new createjs.Bitmap(img);
bmp.regX=img.width>>1;
bmp.regY=img.height>>1;
s.addChild(bmp);
}
img.src=src;
}
BaseImage.prototype=new createjs.Container();
</script>
</body>
</html>