You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Zephyr

Professional

  • "Zephyr" started this thread

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

1

Monday, November 24th 2008, 11:06am

Plugin with a close button

I've made a simple plugin, that needs a close button. But I can't seem to make a call to the plugin itself. I can hide all other plugins/hotspots within the plugin, but can't hide itself.

The close button:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
var closebutton:SimpleButton = new SimpleButton(); //create a button bar
var up:Shape = new Shape();
up.graphics.beginFill(myStyle.Btint, myStyle.Balpha);
up.graphics.drawRect(Sw - Smenu, Sh - Sb2 , Smenu - Sb - Sp, myStyle.Bwidth);

var overclose:Shape = new Shape();
overclose.graphics.beginFill(myStyle.Bover, myStyle.Balpha);
overclose.graphics.drawRect(Sw - Smenu, Sh - Sb2 , Smenu - Sb - Sp, myStyle.Bwidth);

closebutton.upState = closebutton.hitTestState =  closebutton.downState = up; //no rollover effect is applied so all the states are the same.
closebutton.overState = overclose;
addChild(closebutton);


The closing function

Source code

1
2
3
4
5
6
7
function CloseStill(evt:MouseEvent)
{
		//krpano.set("still_helmi.visible,false"); //I tried setting it
		//krpano.set("plugin[still_helmi].visible, false"); //I've tried to hide the whole plugin
		krpano.call("action(hideallimages)"); //Ive tried to let Krpano hide it from itself by calling an action that closes it

}


No luck at all. I remember something about a Flash limitation of removing itself, but I could be mistaken. Alsoo Instead of removing it, im hiding it, could this lead to performance issues? And if so, what would be a correct solution?
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).

2

Monday, November 24th 2008, 1:51pm

Hi,

the set visible false code should work,

but the syntax is a little bit wrong:
you give the set function only one string as parameter,
the correct syntax is - set(variablename, value);

wrong:
krpano.set("plugin[still_helmi].visible, false");
correct:
krpano.set("plugin[still_helmi].visible", false);
(see the red marked notes)

if visible of the plugin is set to false and there are not timers running the plugin it shouldn't take any peformance,
but if you want you can also remove the plugin with a removeplugin call,
e.g. - call from the plugin itself

Source code

1
krpano.call("removeplugin(still_helmi);");

but note - if the plugin adds elements to the "stage" it must remove it by it's own!

best regards,
Klaus