Accesing Flash Vars

  • Hi,

    I would recommend the following way:

    define the variables you want to use in your plugin direct in the xml <plugin> definition,
    e.g.

    Code
    <plugin name="testplugin" url="yourplugin.swf"
            yourvar="abc"
            />


    and then - use the "krpano_as3_interface" in your plugin as3 code to get access to krpano and also to your plugin variables,
    e.g.

    more informations about the code also here:
    https://krpano.com/docu/plugins/

    best regards,
    Klaus

  • Hi!
    thanks Klaus!, but i got this problem, im opening krpano from another window, and in the first window the user can define one variable that is send to the window where the krpano will be displayed, that is acctually a php document that acording to the variables it recives prints the swfObject whit the var from the first window in the flashvars param, but here is where i lost this variable *cry* . what do you recomend me??..
    thanks again for your atention.

  • Hi Ronin,

    You can retrieve your Flashvars using get(YourFlashvars)...

    For example, let say your php script adds the following Flashvars in your html file:

    Code
    so.addVariable("MyFlashvars", "plus on est de fou, plus on rit");

    Using as reference the example plugin above from Klaus, you will can do:

    Code
    <plugin name="testplugin" url="yourplugin.swf" 	
    	yourvar=""
    	.....
    	onloaded="set(yourvar,get(MyFlashvars));trace('MyFlashvars = ',get(yourvar))"
    	/>

    Hopes this can help.

    SAlut.

  • Hi,

    to get just such variable, that will passed in the html like here:

    Code
    so.addVariable("MyFlashvars", "plus on est de fou, plus on rit");


    can be also get direct via the krpano interface:

    e.g. in as3:

    Code
    function startplugin(evt:Event):void
    {
      krpano = krpano_as3_interface.getInstance();
      var MyFlashvars:String = krpano.get("myflashvars");
    }

    just one note - the name of all passed variables will be converted to lowercase!

    best regards,
    Klaus

Participate now!

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