Can't get layer[name].imagewidth working

  • Hi!
    I'm creating an image layer with:


    The layer is created and works correctly, but I can't get the layer[name].imagewidth working, I always get 0.


    Any ideas?

  • set(layer[map].onloaded, showlog();trace(layer[map].imagewidth));

    Thanks!
    I completely missed the .onloaded method. I just put the code that deals with image dimensions to be run in an .onloaded and it's working fine!

    I didn't expect to have to deal with such asynchronous behaviour with Krpano.

  • Why asynchroneous? It's all very logical: imagewidth (original width of the image file) is not known until the source image is fully loaded.

    In my original code, I called the .imagewidth a long after the image layer was created and set and it wasn't blocking. That's async behavior. Nothing wrong with it, but important to keep in mind.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!