Sie sind nicht angemeldet.

1

Samstag, 14. November 2009, 11:33

Hotspot Plugin for KRPANO 1.0.8 beta8 does not receive mouse events.

Hello all,

I got a little bit stuck in developing a plugin for hotspots as the plugin does not receive mouse events.

Here is my source 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
/* register event handler - called to register attributes and draw initially */ 
/*****************************************************************************/ 
private function registerEvent(event:DataEvent):void 
{ 
// get plugin path and object and make global for this instance 
// ------------------------------------------------------------ 
plugin_path = event.data; 
plugin_object = krpano.get(plugin_path); 
: 
: 
krpano.set(plugin_path+".enabled","true"); 
krpano.set(plugin_path+".capture","false"); 
krpano.set(plugin_path+".children","true"); 
krpano.set(plugin_path+".zorder",5); 

// add the mlabel and draw 
// ----------------------- 
add_mlabel(); 
} 
/* mouse event listener */ 
/************************/ 
private function mlabelMouseClickHandler(event:MouseEvent):void 
{ 
krpano.trace(0, "XXX: Mouse Clicked"); 
} 

/* add the MLABEL and draw */ 
/***************************/ 
private function add_mlabel():void 
{ 
// create display objects 
// ---------------------- 
this_arrow = new Shape(); 
this.addChild(this_arrow); 

: 
: 
this_arrow.addEventListener(MouseEvent.CLICK, mlabelMouseClickHandler); 

// draw 
// ---- 
update_mlabel(); // here the graphics is drawn 
}


I already tried to register the mouse event handler for the plugin object and for the mlabel object (my plugin sprite). Also tried with other mouse event types like MOUSE_DOWN. No success.

Can anybody help me?
Thanks in advance.

Thomas

2

Sonntag, 15. November 2009, 19:44

Hi,

Quellcode

1
this_arrow = new Shape(); 


a Shape object doesn't support mouse (click) events,

see here:
http://help.adobe.com/en_US/AS3LCR/Flash…l#methodSummary

a quote from there:

Zitat

the Sprite class also includes a graphicsproperty, and it includes other features not available to the Shape class. For example, a Sprite object is a display object container, whereas a Shape object is not (and cannot contain child display objects). For this reason, Shape objects consume less memory than Sprite objects that contain the same graphics. However, a Sprite object supports mouse click events, while a Shape object does not.

so try using a Sprite instead

best regards,
Klaus

3

Montag, 16. November 2009, 07:38

Thanks a lot. It works now.

Dear Klaus,



thanks a lot. Now it works perfectly. Great support! *thumbsup*



Kind regards

Thomas