-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAS2ToAS3_Canvas.html
78 lines (63 loc) · 1.94 KB
/
AS2ToAS3_Canvas.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>AS2ToAS3_Canvas</title>
<!-- write your code here -->
<script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script>
<script src="AS2ToAS3_Canvas.js"></script>
<script src="Lib\AS2_Library.js"></script>
<script>
var canvas, stage, exportRoot;
function init() {
// --- write your JS code here ---
canvas = document.getElementById("canvas");
exportRoot = new lib.AS2ToAS3_Canvas();
stage = new createjs.Stage(canvas);
stage.addChild(exportRoot);
stage.update();
createjs.Ticker.setFPS(lib.properties.fps);
createjs.Ticker.addEventListener("tick", stage);
InitAS2();
Init();
}
function Init(){
var _root = exportRoot;
trace("example 1 Drawing");
_root.createEmptyMovieClip("line_mc", 1);
with(_root.line_mc){
lineStyle(10, 0xFF0000, 100);
moveTo(0, 0);
lineTo(150, 0);
lineTo(150, 50);
lineTo(0, 50);
lineTo(0, 0);
_x=150;
_y=150;
}
trace("example 2 Text");
eval('line_mc').createTextField("MyText", undefined, 10, 10);
eval('line_mc.MyText').text = 'Hello Word';
trace('example 3 attachMovie from Library Adobe Animate');
_root.attachMovie("LibMovie","Movie2",undefined).x = 250;
_root.Movie2.y = 100;
trace("example 3 duplicateMovieClip (this version doesn't copy all childrens)");
eval('line_mc').duplicateMovieClip("copy_line_mc")._x = 100;
_root.copy_line_mc._y = 30;
_root.Movie2.gotoAndStop(1);
eval('Movie2').duplicateMovieClip("copy_Movie2");
_root.copy_Movie2._x = 0;
trace("example 4 remove any MovieClip or Text");
eval('line_mc.MyText').removeObject();
eval('Movie1').removeObject();
trace("example 5 Set width and height for MovieClip");
eval('Movie2')._width = 40;
eval('copy_Movie2')._height = 40;
}
</script>
<!-- write your code here -->
</head>
<body onload="init();" style="background-color:#D4D4D4;margin:0px;">
<canvas id="canvas" width="550" height="400" style="background-color:#FFFFFF"></canvas>
</body>
</html>