Copy link to clipboard
Copied
working in a canvas project. when i use the following code, the pic loads fine, but i don't get the trace alert.
var page1Pic = new createjs.Bitmap("page1.0.png")
root.addChild(page1Pic);
page1Pic.addEventListener("added", picAdded);
function picAdded(event){
alert("Trace");
// my goal here would be to start loading a second picture
};
if i use the "click" event listener, as in the following code, i get the trace alert.
var page1Pic = new createjs.Bitmap("page1.0.png")
root.addChild(page1Pic);
page1Pic.addEventListener("click", picAdded);
function picAdded(event){
alert("Trace");
};
what gives?
is there a better way to load one pic and display it before starting to load the next pic?
Try adding the listening before you add the bitmap. Otherwise it's too late.
Copy link to clipboard
Copied
Try adding the listening before you add the bitmap. Otherwise it's too late.
Copy link to clipboard
Copied
ah! yes.
colin, i'm an idiot, and you're my favorite person in the world.
Copy link to clipboard
Copied
what's a simple way to make the added child the same width as the container into which it is added?
i.e. if i add the bitmap to a movie clip on the stage like so:
Find more inspiration, events, and resources on the new Adobe Community
Explore Now