Sie sind nicht angemeldet.

1

Montag, 9. November 2009, 20:30

Flex plugin

Hi,

I tried to make one Flex plugin for krPano today, just to see how it's working.

It's works great, except the registerEvent and updateEvent which are not triggered. However, the button is OK. I see the 'click' trace in krPano.

Here's the MXML code of my plugin :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/halo"
			   add="addedToStage(event)"
			   addedToStage="addedToStage(event)"
			   >
	<fx:Script>
		<![CDATA[
			
			public var _krpano:krpano_as3_interface = null;
			
			public function addedToStage(evt:Event):void
			{
				_krpano = krpano_as3_interface.getInstance();
				_krpano.trace (1, evt);
				_krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);
				_krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_UPDATE,   updateEvent);
			}
			
			public function registerEvent (evt:DataEvent):void
			{
				_krpano.trace (1, 'registerEvent');
				_krpano.trace (1, evt);
				_krpano.trace (1, evt.data);
			}
			
			public function updateEvent (evt:DataEvent):void
			{
				_krpano.trace (1, 'updateEvent');
				_krpano.trace (1, evt);
				_krpano.trace (1, evt.data);
			}
			
			
		]]>
	</fx:Script>
	
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:Button x="10" y="10" label="Button" click="_krpano.trace (1, 'click')" />
</s:Application>


Klaus, do you have an idea why the functions are not triggered ?

Regards,
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

2

Dienstag, 17. November 2009, 17:20

Hi,

the "addPluginEventListener" functions needs the real "root" object of the flash file,

e.g. here:

Quellcode

1
_krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);


maybe the parent object is needed (or the parent.parent),
I don't know the Flex structure yet...
maybe this is also a Flex function to get the root (Sprite or Moviceclip) object...

e.g.

Quellcode

1
_krpano.addPluginEventListener(parent, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);


best regards,
Klaus

3

Dienstag, 17. November 2009, 18:04

Hi,

a small test show me that root is parent :

Quellcode

1
_krpano.trace (1, root == parent);


return true

But with

Quellcode

1
_krpano.addPluginEventListener(parent, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);


registerEvent is still not triggered :-(
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

4

Dienstag, 17. November 2009, 20:22

Hi,

what is the result of:

Quellcode

1
2
3
_krpano.trace (1, root);
_krpano.trace (1, this);
_krpano.trace (1, parent);

?

5

Dienstag, 17. November 2009, 23:54

Hi,

this is the result :

Quellcode

1
2
3
INFO: [object _testFlexForKrpano_mx_managers_SystemManager]
INFO: instance9.instance21.n0.instance31.krpanoaccueil
INFO: [object _testFlexForKrpano_mx_managers_SystemManager]


*smile*

testFlexForKrpano is the name of the Application (of the mxml files)

I believe that n0 is the name of the plugin, and krpanoaccueil the name of the id in the the index.html inside swfobject.embedSWF function (??)

Hope this helps

Regards
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

6

Donnerstag, 19. November 2009, 10:01

Hope this helps
unfortunately no ...
currently I have no idea, sorry...

7

Donnerstag, 26. November 2009, 17:46

Hi Klaus,

Is there a way to know the "pluginpath" of the plugin, except whith the DataEvent object of the registerEvent method ?

Thanks !
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

8

Donnerstag, 11. März 2010, 13:13

Hi Klaus,

Still no way about integrating flex in krPano ?

Regards
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

9

Donnerstag, 25. März 2010, 12:47

Hi

I'm very interessed in this topic too - "Flex plugin".

Correct me if i'm wrong, but we'll be able to get the "pano" MXML tag in the 1.0.9 version?

If so, when do you think that release would be available?

Thanks
myky

10

Donnerstag, 25. März 2010, 17:56

Not to speak for Klaus BUT;

1.0.8 is not even released. 1.0.9 beta 1 is a long way away. Gathered from other posts, there is no estimated date for 1.0.9

11

Mittwoch, 26. Mai 2010, 21:42

Flex plugin for Krpano solved "sort of"

Not sure if you solved the problem at your end, so here is the way we solved it.

Mainly, th solution consist in building an AS3 plugin and load the Flex part dynamically using the Loader class. The key part is to intercept for 2 system events generated by Flash player for Flex apps : mx.managers.SystemManager.isBootstrapRoot and mx.managers.SystemManager.isStageRoot

Here is parts of code :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	[SWF(width="400", height="300", backgroundColor="#FFFFFF")]
	public class testplugin extends Sprite

		private var krpano:krpano_as3_interface = null;

		public function testplugin()
		{
 	  		
			if (stage == null)
			{
				this.addEventListener(Event.ADDED_TO_STAGE,  startplugin);
				this.addEventListener(Event.REMOVED_FROM_STAGE, stopplugin);
			}
			else
			{
				// direct startup - show version info
				...
			}
		}
		
		
		// start of plugin
		private function startplugin(evt:Event):void
		{
			// get krpano interface
			krpano = krpano_as3_interface.getInstance();
			
			...
			
			// register event to get plugins name
			krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);
		}
		
    	private function registerEvent(evt:DataEvent):void
    	{
    		...

        	// testApp.swf is the Flex meat
			var url:URLRequest = new URLRequest("testApp.swf");
			
        	var loader:Loader = new Loader();
			
        	// THAT'S THE IMPORTANT STEP
			loader.addEventListener("mx.managers.SystemManager.isBootstrapRoot", systemManagerHandler);
			loader.addEventListener("mx.managers.SystemManager.isStageRoot", systemManagerHandler); 
			
			loader.load(url);	
			
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadIt);
			loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, error);
			
			addChild(loader);
			
    	}
    	
    	// Intercept key system events
    	private function systemManagerHandler(event:Event):void { event.preventDefault(); }
	
    	
    	private function loadIt(e:Event):void
		{
			var loderinfo:LoaderInfo = e.target as LoaderInfo;
    	
        	// we have to wait for the flex app to be properly initialized
    		loderinfo.content.addEventListener("applicationComplete", onApplicationComplete);   	
		}
	}
}


I hope it'll help.

Laurent

12

Samstag, 29. Mai 2010, 15:12

Thanks Laurent,

I've made a dirty examples with a Timer, and check every milisecond if the krpano interface answer something other than null ... *huh*

Your solutions looks better ! ;-)
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

13

Freitag, 12. November 2010, 11:28

Still no way of setting pluginEventListener directly in mxml Application ?