Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

Zephyr

Profi

  • »Zephyr« ist der Autor dieses Themas

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

1

Montag, 30. März 2009, 14:46

using krpano as a event dispatcher?

Hi,

I rounded up my Interface plugin, now Im trying to create another plugin, a Google Analytics plugin. This plugin needs diffent kinds of information from the interface.

For example when a hotspot is clicked, krpano sends a event with an id to the interface. The interface does all kinds of stuff (adding a compass, changing textfields etc all based on this id) and then it changes the location.

I want to send information about, what location people go to, if fullscreen button is pressed etc to Google Analytics plugin. The tricky part is, I dont want to "embed" the GA plugin into the interface. I Just want it as a plugin node in the xml, so I can remove it without rebuilding the Swf. The most information I can derive from either stage event listeners (fullscreen for example) or by the id (what location are people going to). But other stuff happening in the interface, I need to listen to certain events.

Well as some as you guys might know, communication between 2 different swf's is not that easy. I usually make a globalevents class, dispatch all my events to it, and embed the globalevent class intoo the plugin. I find that a little bit messy for some reason. But then I thought, Hey! Krpano can dispatch events, why not use that instead of a globalevents class. And this is where Im stuck.

According to the documentation:

Zitat

example - call a as3/plugin function:
as3/plugin code: function myfunction(p1:String)
{
// ... do something ...
}

krpano.set("events.myfu", myfunction);

xml code: ... onclick="events.myfu(hello from xml);" ...
But instead of creating a onclick function on a hotspot in the xml, I want a make a call to dispatch the event in the Interface from a function. And in the GA plugin I want the listener.
But this doesn't seem to work:
Interface plugin:

Quellcode

1
2
3
4
function somefunction(evt:Event):void
{
krpano.call("events.myfu(hello from xml)")
}


GA plugin:

Quellcode

1
2
3
4
5
6
function myfunction(p1:String)
{
 krpano.trace(0, p1);
}

krpano.set("events.myfu", myfunction);


No errors, but nothing happening either. The Event doesn't get triggered in GA. Any ideas? As before, I like to skip xml actions and let flash handle the most part so the xml only has hotspots in it.

Zephyr

Profi

  • »Zephyr« ist der Autor dieses Themas

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

2

Dienstag, 31. März 2009, 12:45

I solved the problem by creating a localconnection class. However I'm still curious how to create a krpano "event" like above. Btw Something I noticed, I can't seem to listen to the event in both plugins.

in my xml:
onclick="events.myfu(hello from xml)"

in interface fla
function myfunction(p1:String)
{
trace(p1)
}
krpano.set("events.myfu", myfunction);

in GA fla
function myfunction(p1:String)
{
trace(p1)
}
krpano.set("events.myfu", myfunction);

It wil only execute one. First I thought the GA fla wasn't properly registered with krpano, but when I changed one of the hotspots to events.myfu2 and did the same in the fla, it worked. Somehow the event gets removed as soon as it arrives.

3

Samstag, 4. April 2009, 09:42

Hi, with

Quellcode

1
krpano.set("events.myfu", myfunction);
you are not "registering" an event,
only a "link" to the function will be created,
so if a other plugin overwrites it, the old "link" will be gone

4

Freitag, 24. Juli 2009, 14:38

However I'm still curious how to create a krpano "event" like above.


So am I :-)
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

Ähnliche Themen