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.

1

Friday, February 11th 2011, 4:25am

problems with parent="stage"

Hi! I'm having problems with parent="stage" in my plugin.
When I use parent=stage I receive a lot of error due to trying to access nulling objects.
It works fine without parent=stage.
The problem is really strange
I have a method registered for XML access:

Source code

1
plugininterface.actualizarradar  = interface_actualizarradar;

that method is called inside xmlcomplete when I use loadpano:

Source code

1
2
3
4
<events onxmlcomplete="action(xmlcomplete);" />
     	<action name="xmlcomplete">
				plugin[mapa].actualizarradar();
	 	</action>

but when that method is called, I get a null reference inside it:

Source code

1
2
3
4
5
6
public function interface_actualizarradar():void
   	{
			if(krpano!=null)
				krpano.trace(1, "actualizarradar");
       	//krpano and plugininterface are null here !!
		}


and that's really strange because if the method is called is because it was registered with plugininterface before, so, why plugininterface is null later?
and again, it works fine without parent=stage, so I'm losing something there I guess...

Does somebody know where is the problem?

Thanks !!

2

Saturday, February 12th 2011, 4:16pm

Please Klaus (or someone), I really need help with this.
I think this is an internal functionality of Krpano.
Maybe Krpano is adding two times the plugin when we use parent=stage, or something like that.
Because the PLUGINEVENT_REGISTER is fired, I get the krpano interface, also the plugininterface, and I can register a custom function for XML usage, but then when the function is called from the loaded XML I get a null reference to krpano interface and plugin interface, and that is happening only when I use parent=stage...

It's really strange...

3

Saturday, February 12th 2011, 4:30pm

try this

Source code

1
krpano.trace(krpano_as3_interface.INFO, "actualizarradar");

4

Saturday, February 12th 2011, 5:24pm

Hi Job, I can't use krpano.trace because krpano is null !
And I don't know why, because krpano has the interface when the plugin starts, because PLUGINEVENT_REGISTER is fired, because plugininterface is obtained, because my AS3 method is registered for XML usage, because the method is called from my XML with sucess, but then, inside my method, krpano is null !
And is null only if I use parent=stage.
So I think krpano is doing something different with parent=stage that makes krpano null after register the plugin.

Do you know if we must code something different when we use a make a plugin with parent=stage?

Also, I'm using googlemaps... my own plugin (not krpano googlemaps), I'm mentioning it because I found that googlemaps plugin from krpano was not working in previous versions with parent=stage.

This post has been edited 1 times, last edit by "enridp" (Feb 12th 2011, 5:50pm)


5

Monday, February 14th 2011, 3:38pm

Hi,

do you have ADDED_TO_STAGE and REMOVED_FROM_STAGE events in your page?

if yes, this can be the problem, because when the plugin will be moved from a displayobject to another one (that happens when changing the parent), then this events will be called,

e.g. do the plugin start/stop functions in that way:

Quoted

this.addEventListener(Event.ADDED_TO_STAGE, startplugin);
this.addEventListener(Event.UNLOAD, stopplugin);

...

private function startplugin(evt:Event):void
{
this.removeEventListener(Event.ADDED_TO_STAGE, startplugin);

krpano = krpano_as3_interface.getInstance();

...
}

private function stopplugin(evt:Event):void
{
...
}
best regards,
Klaus

6

Thursday, February 17th 2011, 2:41pm

Yes! that was the problem, thanks Klaus !!!! *thumbsup*

Similar threads