-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup.html
59 lines (49 loc) · 1.57 KB
/
setup.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
<!-- A simplfied EaselJS || EaselFL setup example -->
<html>
<head>
<script type="text/javascript" src="../js/FLSetup.js"></script>
<script type="text/javascript">
window.onload = function(){
var options = {
preferFlash: false,
EaselJS_url: '../test/js/easeljs-0.6.0.min.js',
EaselFL_url: '../build/output/easelfl-NEXT.min.js',
SWFObject_url: '../js/swfobject.js',
}
// FLSetup.run will callback to success/failure synchronously
// if no options are provided, Easel is unsupported,
// or no necessary loads are included.
// If your app is including EaselJS & EaselJS in different
// built versions, then loading those can occur in the
// success handler based on the 'isFL' boolean callback parameter.
createjs.FLSetup.run( onSetupSuccess, onSetupFailure, options);
}
function onSetupFailure() {
//handle lack of support for Easel
}
function onSetupSuccess(isFL){
// start it up
var canvas, stage, shape, gfx;
canvas = document.createElement('canvas');
//width, height, and fl_swf_url must be set as attributes on
//the canvas for EaselFL to work properly
canvas.setAttribute('width', 600);
canvas.setAttribute('height', 400);
canvas.setAttribute('fl_swf_url', '../haxe/bin/easelfl-NEXT.swf');
document.body.appendChild(canvas);
stage = new createjs.Stage(canvas);
createjs.Ticker.addListener(stage);
shape = new createjs.Shape();
gfx = shape.graphics;
gfx.beginFill('#000');
gfx.drawRect(100, 100, 50, 50);
gfx.drawRect(200, 100, 50, 50);
gfx.drawRect(100, 200, 150, 50);
gfx.endFill();
stage.addChild(shape);
}
</script>
</head>
<body>
</body>
</html>