Images not showing after updating to NEXT versions

jonnyngan1's Avatar

jonnyngan1

24 Jan, 2013 10:23 AM

Hi,

Is there a new way to add images to the canvas?
The way i've been doing it is,

var img= new createjs.Container();
img.addChild(dogImage);
stage.addChild(img);

After updating to the NEXT versions, my images don't show up anymore, only text and things that are drawn using graphics are shown.

Thanks

Jonny

  1. Support Staff 1 Posted by Lanny McNie on 24 Jan, 2013 03:28 PM

    Lanny McNie's Avatar

    We can check it out. There has not been a change to the API for this - so it should work. Thanks for the report.

  2. Support Staff 2 Posted by Sebastian De Ro... on 24 Jan, 2013 04:26 PM

    Sebastian De Rossi's Avatar

    @jonnyngan1

    Lanny is correct there have not been any changes to API, it does work correctly.

    Looking at your code, how are you creating "dogImage"?
    What is "dogImage" is it an Image Element? is it a Bitmap instance?

    This works with the all versions of EaselJS:

    stage.addChild(new createjs.Bitmap("image.jpg"));
    stage.update();
    

    Hope this helps.

  3. 3 Posted by jonnyngan1 on 24 Jan, 2013 04:34 PM

    jonnyngan1's Avatar

    dogImage was just an example, I don't actually have it in code.

    Everything was working before I updated to NEXT.

    The things I've changed when I updated to NEXT are:

    createjs.SoundJS ---> createjs.Sound
    createjs.PreloadJS ---> createjs.LoadQueue

    preloader.getResult('id').result ---> preloader.getResult('id', true);

    If its not the API then maybe its something I haven't changed yet that has changed in the NEXT version of preloadjs or one of the other libraries?

  4. Support Staff 4 Posted by Lanny McNie on 24 Jan, 2013 04:37 PM

    Lanny McNie's Avatar

    Please grab the latest EaselJS NEXT file from GitHub. I pushed a new version this morning with a minor fix in it.

    We need to either see more of your code, or figure out where the issue is getting caused. Can you put together a spike that shows the issue?

    Are you seeing any console errors?

  5. 5 Posted by supbro on 07 Feb, 2013 11:19 AM

    supbro's Avatar

    Hello! I can confirm this.
    Images don't show in Chromium. In firefox, they do after reloading the page once.
    There are no console errors and the image is loaded properly by the browser (i can see it in the network debug tab of the developer tools).
    I'm just using Sebastian's code.
    Rolling back to 5.0 now...

  6. 6 Posted by supbro on 07 Feb, 2013 11:45 AM

    supbro's Avatar

    Well, forget about it. The image was just not loaded when i called stage.update().
    However, some sort of built-in callback when the image is loaded would be nice!
    new createjs.Bitmap(url, onLoadCallback)
    But still, nothing crucial since it's easy to implement by yourself.

    var image = new Image();
    image.onload = function() {
    stage.addChild(new createjs.Bitmap(this));
    stage.update();
    };
    image.src = 'image.jpg';
    
  7. Support Staff 7 Posted by Lanny McNie on 07 Feb, 2013 03:41 PM

    Lanny McNie's Avatar

    You can add an onload callback to the Bitmap.image. I recommend preloading your images using PreloadJS for an HTML application.

  8. 8 Posted by jonnyngan1 on 15 Feb, 2013 02:00 PM

    jonnyngan1's Avatar

    I've worked out why my images weren't appearing and it was because a lot of the changes to do with new preloadJS. Quite a few of the changes meant my scoping was off so 'this' wasn't actully 'this' any more.

  9. jonnyngan1 closed this discussion on 15 Feb, 2013 02:01 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac