• Hi there

    I made a small as3 class which allows the placement of variable size plugins to be controlled from within KrPano more easily. I'm attaching the as3 source code.

    When a KrpanoAligner instance is created, it automatically registers itself to the PLUGINEVENT_UPDATE event. When this event is received, the alignment is performed. The alignment can also be forced by calling the doAlign() function (this can be useful, for instance, if the plugin itself changes size).
    ATTENTION: When the KrpanoAligner instance is created, alignment is not performed. Therefore, the doAlign() function must be called as soon as the stuff in the plugin is loaded.

    Methods:
    KrpanoAligner(krpano:krpano_as3_interface, plugin:Sprite, pluginName:String, pluginWidth:Number, pluginHeight:Number)
    doAlign()

    krpano - krpano instance
    plugin - the plugin to be aligned (typically this will be "this")
    pluginName - the plugin's name in KrPano
    pluginWidth and Height - the Width and Height of the flash application, defined in the SWF metatag

    Problems:
    When this is used, the "width" and "height" values must ALWAYS be set in Krpano when the plugin is embedded. This is because when these values are not set, krpano automatically defaults them to the flash application's Width and Height (from the SWF metatag). In this case, I think it's impossible to know from as3 whether these values were set by default, or they are the values which the user wants. Any thoughts on solving this?


    Under the hood:
    This is a very simple program; it just changes the alignment of the plugin sprite inside the flash application to compensate for the latter's extra size. It reads the plugin's "edge" value (or, if that's not defined, the "align") and compensates according to that.
    Also, it sets the size of the plugin to the size of the flash application, making the "width" and "height" values inside krpano match those of the plugin sprite.

    Hope this is useful.

    Manuel
    (The forum doesn't allow uploading of .as files, therefore I uploaded a .txt. Please rename ;) )

Participate now!

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