OnClick Hotspot Code

Using Pano2VR/Object2VR SWF files with your own Flash projects
Post Reply
NFSTC
Posts: 20
Joined: Fri Feb 04, 2011 8:38 pm

I have been searching for a solution to tracking the hotspot clicks in the
Pano utilizing Flash AS 3. What we need to do is track when a hotspot within
the main pano is clicked and then every subsequent one after it. The
scenario is a house and the viewer is outside where they then enter then
move into the hallway and then bedroom (crime scene) to collect evidence.
This is where we need to capture the hotspot click so we can determine the
time spent in each room for evaluation purposes. We came across the code in
the Forum at
(http://gardengnomesoftware.com/forum/vi ... pot#p12722)
to address this but it is not working.

vr.pano.onClickHotspot=function(id:String) {
trace("clicked on hotspot id:", id);
}

This was posted in 2009 and we were wondering since we use the newest
Version 3.0 if there was a fix for this? Or do you have a better way to
accomplish this task? We need an answer asap as we are hitting deadline. Any help is greatly appreciated and welcomed.

We got this response but it is the same code that we are using with no luck.

The problem is the automatic Flash 10 switch. Because of this the pano
object is not available right after the start, but it is generated one
frame later. To make your code work you need to check first if the
pano object exists for example by using the code from the AS3 API
page:


function initPanorama(e:Event) {
// check if the panorama object is available and initialize it
if ((vr!=null) && (vr.pano!=null)) {
removeEventListener( Event.ENTER_FRAME , initPanorama);
vr.pano.onClickHotspot=function(id:String) {
trace("clicked on hotspot id:", id);
}
}
}
// call initPanorama every frame
addEventListener( Event.ENTER_FRAME , initPanorama);
Post Reply