Beginner question: Plugin alignment

  • Hi there

    I'm trying to create a plugin for the first time.

    Right now, it's just loading an image using a Loader instance. I'm able to add it to krpano (using ) and see the image, but it's not aligned correctly. It seems that it's considering the stage to be smaller than it actually is; when I set the alignment to "rightbottom", it stays roughly in the center of the krpano window.
    I was looking at the radar and zoombuttons examples from 1.0.7, but I can't find which part of the code is supposed to handle this. Anyone ran into this before?

    Thanks
    Manuel

  • you need to make sure you are properly using the stage resize event


    see below for a sample

  • It seems that the problem is the size of the SWF file. The size of the SWF can be defined in actionscript this way:

    [SWF(width="300", height="200")]


    KrPano's alignment seems to take this size into account. The problem is that my plugin loads images dynamically and I don't know their size beforehand.
    Does anyone know if it's possible to change these width and height values dynamically? How is this handled, for instance, in the textfield plugin? I was looking at the source from 1.0.7 but couldn't find anything.

  • Hi,

    when you don't know the size it would be better not to use the krpano alignment (just let the "align" setting unset) and align your plugin manually via a own onresize event in the plugin,

    something other:
    it's possible to add a krpano RESIZE event for the plugin,
    then you will be get notified when the width/height or scale settings of the plugin were changed,
    the scaling of the plugin itself will not change automatically when there is such event,

    best regards,
    Klaus

Participate now!

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