Get a plugin attribute and use the value in a as3 function (help with the syntax)

  • Hello There!

    Thank you very much in advance!

    The question:

    How to get a plugin attribute value (located in the krpano xml file) and pass it to a flash plugin, in order to trigger an action (in flash).

    The story:

    I have a scrolling thumbnails plugin inside krpano, which shows a red frame around the corresponding thumbnail when a scene loads.
    As a default the red frame always starts in the first thumbnail, as the virtual tour always loads the first scene first.

    Recently I purchased the SWFaddress plugin, which allows me to load any scene from the same html file, changing the url.
    So what I would like to do is to put the red frame in the corresponding scene loaded.

    DO NOT PANIC! I know exactly how to do that, but my action scrip 3 knowledge is very limited.

    Roughly, this is the code I need:

    So after all it is just a syntax thing.

    The example:

    Virtual tour

    Thank you !!!

  • Hi,

    just with get() function,

    like here:

    Code
    var scene_path:Object = krpano.get("plugin[swfaddress].path");

    e.g. to get the current hlookat:

    Code
    var hlookat:Number = Number( krpano.get("view.hlookat") );

    or to get the current scene:

    Code
    var currentscene:String = krpano.get("xml.scene");

    or to get the current align setting from the plugin logo:

    Code
    var align:String = krpano.get("plugin[logo].align");

    ...

    best regards,
    Klaus

  • Thanks for your quick answer Klaus!

    I followed your instructions but Flash throws an error:

    TypeError: Error #1006: value is not a function. at scroll_fla::MainTimeline/frame1()

    This is the code:

    Code
    import krpano_as3_interface;
    
    
    var krpano:krpano_as3_interface = krpano_as3_interface.getInstance();
    
    
    var scene_path:Object = krpano.get("plugin[swfaddress].path");

    I read 4 previous threads regarding this error but I couldn't find a definitive fix for the problem.

    Here are all the files involved:

    Example

    main.xml

    scroll.fla

    krpano_as3_interface.as

    I am using version 1.0.8.12

    Hope this helps.

    Cheers!

  • Hi all!

    Sorry for bringing this thread alive again but I still haven't found what's wrong with this thing.
    I really would appreciate anyone's help.

    I've tried to simplify the problem to it's simpliest form and it the previous post I supplied all the files involved.
    To make it even easier I've put everything together in a zip file.

    Zip file

    Thank you very much in advance!

    Cheers

  • The reason flash throws an error is because krpano doesnt exist in its context. But if you put swf in the tour and load it in as a xml plugin, it should work.

    you can test its working by tracing something in flash to krpano:

    Code
    krpano.trace('flash communication succes");

    if you look at the examples of krpano, you'll see that the plugin checks if there is a stage or not. If there's a stage then the plugin is in standalone mode and krpano access isnt posbbile. Alsoo the examples implement a dummy call/set/get/trace, so you wont get errors during debugging.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!