read/update attributes plugin AS3

  • Hi,

    I'm currently modifying the interface example "flashcs3exampleplugin11",
    and i don't know where to place my register/update Event and their functions,
    syntax seems differents in actual documentation... *confused*

    where should i put :

    Code
    krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);
    krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_RESIZE,   resizeEvent);
    krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_UPDATE,   updateEvent);

    because Flash throw me errors

    first i had this :


    this works fine with no errors,but no attributes reading here....

    then after i modify to this :


    and this time Flash throw me Error #1009 : impossible to access nul object...

    what's wrong ??

    what is the fix to be able to read/assign/update plugin xml attributes

    Thanks *smile*
    z

    Edited once, last by zadda (October 19, 2010 at 8:00 PM).

  • I'm not exactly sure what you're trying to accomplish with your code examples, but you can read/write plugin attributes just fine using the standard interface.

    If you look at: http://www.krpano.com/docu/plugins/#register

    You'll see a standard method to get a reference to the plugin's instance.

  • hi,

    when i add

    Code
    // Register plugin listener
    krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);


    somewhere outside a function,
    i got a flash error:
    TypeError: Error #1006: value is not a function...

    and when i put on startup_plugin function, i got Error #1009 : impossible to access nul object...

    then i wonder where should i put the code ???

    Klaus ?? *confused* (if you got 1 mn in your busy agenda..)

    thanks

    z

  • This is the basic template I use and holds all the required event bindings and such:

    - registerEvent() is the one that's called when your plugin is registered and ready for use in the Krpano viewer. From this point on the global variable 'p' holds a reference to the plugin instance. Through this you can read or write its data.

    - updateEvent() called whenever the data changes (either through your own Flash plugin or through an action in the XML)

    - resizeEvent() called when the size changes

  • Thanks for replying,

    i'm pretty sure your example works fine,
    but it wasn't helpful for my case (again some flash errors..aarrrrrrgh *angry* ),

    and because i'm not a black belt in action scripting,
    i'll be more cumfortable with the .fla source "flashcs3exampleplugin11" modified with the register/resize/update event included,
    then i can track down where and why theses errors show up....

    again thanks for your patience

    z

Participate now!

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