Hello!! i'm making a plugin that needs to get a custom flash var for lenguaje, how can i acces the flash vars from the plugin?
thanks
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.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.Code
Alles anzeigenvar krpano:krpano_as3_interface = null; var plugininterface : Object = null; ... this.addEventListener(Event.ADDED_TO_STAGE, startplugin); ... function startplugin(evt:Event):void { krpano = krpano_as3_interface.getInstance(); krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent); } function registerEvent(evt:DataEvent):void { plugininterface = krpano.get(event.data); ... var yourvar:String = plugininterface.yourvar; ... }
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 . 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:
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:
can be also get direct via the krpano interface:
e.g. in as3:
Codefunction 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 -
hi!!
it works great thanks Salut thanks Klaus!!
Jetzt mitmachen!
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!