PDA

View Full Version : enable/disble editor.swf with javascript


fritsjan
02-08-2008, 07:39 AM
I know this is possible because dennis is using it:

(see http://flashpanoramas.com/forum/showthread.php?t=134)

3. Now there is only one plugin you can load/unload completely any amount times: editor.swf. There are two special undocumented functions for Hotspots script (beta status): loadPlugin(url:String, depth:Number); and unloadPlugin(depth:Number); (you can call them in Actionscript in Hotspots script or in Javascript). I used this feature to load Editor at runtime using Javascript in browser's adress line.

Can anyone tell me how it is done? What is the xml code and what is the javascript/html code to achive this.

It would be very nice to implement this in my testing/development environment, will save me (and others) a lot of time!

Thanks in advance,
Frits Jan

fritsjan
02-08-2008, 10:52 AM
I found out it is actually simple, well the xml part at least.

here is the code to make a button which loads/unloads the editor:



<spot id="editorButton" url="button.png" static="1" salign="RT" align="RT"
onClick="openMe();"
openMe="loadPlugin(urlto/editor.swf, 20);onClick=closeMe"
closeMe="unloadPlugin(20);onClick=openMe;"
/>



Note: DO NOT load the editor.swf in the load-plugins section.

Hope this can make people happy
Now the javascript to make this work from the html page in order not to mess with the layout inside the pano (the extra button)....

Any help? Would also be nice if someone wrote a tutorial on this javascript access to fpp... or is there one somewere I missed?

fritsjan
02-08-2008, 11:03 AM
hmm, somehow it is not working as I like it to be, the loadPlugin and unloadPlugin makes my pano freeze...

the code above does the following: when clicked, the editor is loaded, but pano freezes (except for the buttons). second click makes the editor dissappear (unload I guess) but then still pano is frozen and next button click does nothing.