instances of the same swf

  • i tried to have my own mapspots with some controlable functionality; parameters given by variables set in my xml.
    So for all my mapspots it should be the same url to load and i wanted to have the possibility to control them individually,

    The problem i ran into was that i could not find a way to identify (within flash) which instance "i am" at runtme. There was no way to let the swf at runtime know by which mapspot-"plugin" it was called from - and vice versa no chance from within krpano scripting language to adress the plugins at runtime correspondig swf-instance of my mapSP.swf.

    Any sugesstions for it?

    Klaus, wouldn´t this be a very powerful future feature: to have corresponding instance-references for multiple use of the same swf ???? !!!!

    - AND - by the way - :
    very important would be a more elegant way to have someting like
    "use url from" for using the same plugin-url multiple - it had two fortunes:
    1) it could save time and scale down errors during scripting
    2) it could (and should!) copy the object in memory instead of download 14 times the same file...

    regards,
    Oliver

    edited Mai 18:
    ...my knowledge of actionscript i growing but still poor --- > is the above ("instances...") already possible by using the aviable methods for registering events for plugins?
    ... i see it is possible to adress the corresponding plugin within flash
    via its name-attribute - but is it possible vice versa too ???

  • Hi,

    using multiple instances is currently not possible, maybe later,
    cloning an image (jpeg,png)/sharing the same base bitmap would be easy,
    but cloning a swf can be problematic, a swf can have childs, streams, code ...


    about addressing the plugins from flash - there are many ways,

    e.g. you can assign to every plugin a own as3/flash function:
    just set() the function to the event:

    Code
    krpano.set("plugin[xyz].onclick", xyz_click);
    
    
    ...
    
    
    function xyz_click():void
    {
      ...
    }


    also own functions can be added from flash and called in the xml:
    (functions and variables can be also added outside a plugin)

    as3:


    xml:

    Code
    <action name="...">
       plugin[xyz].dosomething(abc,xyz);
    </action>


    or you could also assign one as3/flash function to all plugins
    and check there which one has been clicked:

    (note - hotspots can be addressed in the same way)


    Quote

    very important would be a more elegant way to have someting like
    "use url from" for using the same plugin-url multiple - it had two fortunes:
    1) it could save time and scale down errors during scripting

    this could be done by actions for example,
    use an action that dynamically creates a plugin or hotspot,
    and call it several times,

    like in this example: (included in the 1.0.8 beta 7 download)
    https://krpano.com/examples/108b7/krpano.html
    https://krpano.com/examples/108b7/krpano.xml

    there I have a "createbutton" action which was used to create the buttons in this example,

    best regards,
    Klaus

Participate now!

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