开发环境及工具参考上一篇文章:用flashdevelop创建createjs应用
下面这段实现让红色球在浏览器上来回跑,及创建点击事件
[code]
var a;
Main.prototype.createCircle = function () // 相当于as3里Main类下面的public createCircle方法
{
a = new createjs.Shape();
a.graphics.beginFill(“#FF0000”).drawCircle(0, 0, 50);
a.graphics.endFill();
a.x = 50;
a.y = 200;

a.addEventListener(“click”,clickHandle);
function clickHandle(event)
{
console.log(“test”);
}

createjs.Tween.get(a,{loop:true}).to({x:450},3000).to({x:50},3000);

this.mainStage.addChild(a);
};
[/code]