A few new events have been added to EaselJS that provide additional functionality to developers.
DisplayObjects now dispatch non-bubbling “added” and “removed” events when they change parents. This is going to be familiar to anyone coming from Flash. A common use case is to listen for these events, and check the stage
property to determine if the child has just been added to the stage (and is therefore visible). Note that stage
is now a handy getter on any DisplayObject, instead of the deprecated `getStage` method.
var sprite = new createjs.Sprite(spriteData); sprite.on(“added”, function(event) { if (event.target.stage != null) { // Added to stage } });
Additionally, Sprites now dispatch a “change” event any time the displayed frame changes. This functionality already exists on any Tween in TweenJS, and is a natural addition to the Sprite class.
sprite.on(“change”, function(event) { // The sprite frame changed. });
all the demos are not working on the website. I need the tweenjs spark table demo.
What browser are you using?
I am not getting the object’s stage property right away – have to setTimeout in the added event listener. For instance, event.target.stage is not working. Is it working for you? Tried in latest Firefox and Chrome using the posted 2014 build.
I can’t even find the spark table demo. A link is broken:
From http://createjs.com/Docs/TweenJS/classes/Ease.html to
http://www.createjs.com/#!/TweenJS/demos/sparkTable
Result: http://www.createjs.com/#!/404 woops not found
Thanks! I have fixed the link in the docs in the CDN. It will get posted on the site soon. Good catch.