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.
|
|
Quellcode |
1 2 |
<!-- COMPASS --> <spot id="deltarotation" rotation="0" /> |
|
|
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 |
//////////// COMPASS AS3 START CODE ///////////////////////////////////
//var movie:Sprite;///
//var hotspot:Object;///
//var pano:Object;///
var hotspots:Object;///
//
loaderInfo.addEventListener(Event.INIT, initHandler);
//
var sTimer:Timer; ///
function initHandler (event:Event) {
if (loaderInfo.loader!=null) {
// get link to hotspots plugin object:
hotspots = loaderInfo.loader.hotspots;
// setting refreshing timer
sTimer = new Timer(50);
sTimer.addEventListener("timer", updateFov);
sTimer.start();
}
}
function updateFov (e:Event) {
//
// get link to pano object:
pano = hotspots.getPano();
// get link to deltarotation hotspot
deltaRotation = hotspots.getSpot('deltarotation'); // deltarotation = hotspot ID
// calculating fov new rotation:
fovRotation = -pano.pan + deltaRotation.rotation;
//compass_ring_btn
compass_ring_btn.rotation = +fovRotation // rotate the compass accordingly to the pano pan
}
//////////// COMPASS AS3 END CODE ///////////////////////////////////
|
|
|
Quellcode |
1 |
<hotspot name="deltarotation" url="any.png" handcursor="false" visible="false" ath="100" atv="0" > |
|
|
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 |
// timer that reads hlookat and fov and updates the compass
updatetimer = new Timer(1000/30,0); // 30fps
updatetimer.addEventListener(TimerEvent.TIMER, updateFov);
updatetimer.start();
function updateFov (e:Event) {
//
// get link to pano object:
var view:Object = krpano.get("view");
// get link to deltarotation hotspot
var pluginobject:Object = krpano.get("plugin[deltarotation]");
// calculating fov new rotation:
deltaRotation.rotation = Number( krpano.get("plugin[deltarotation].ath") );
//compass_ring_btn
compass_ring_btn.rotation = deltaRotation.rotation // should rotate the compass accordingly to the pano pan
}
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »zadda« (12. November 2008, 12:03)
)|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 |
function updateFov (e:Event)
{
var view:Object = krpano.get("view");
var hotspotobject:Object = krpano.get("hotspot[deltarotation]");
var rotation:Number = Number( hotspotobject.ath ) - view.hlookat;
compass_ring_btn.rotation = rotation; // should rotate the compass accordingly to the pano pan
}
|

|
|
Quellcode |
1 2 3 4 5 6 |
this.addEventListener(Event.ADDED_TO_STAGE, startup_in_krpano);
function startup_in_krpano (evt:Event):void
{
// e.g. - set here anything to note you're running on krpano
}
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
function updateFov (e:Event)
{
var rotation:Number = 0; // default value
if (krpano.get != null)
{
var view:Object = krpano.get("view");
var hotspotobject:Object = krpano.get("hotspot[deltarotation]");
// real value
rotation = Number( hotspotobject.ath ) - view.hlookat;
}
compass_ring_btn.rotation = rotation; // should rotate the compass accordingly to the pano pan
}
|

|
|
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 |
this.addEventListener(Event.ADDED_TO_STAGE, startup_in_krpano);
//}
function startup_in_krpano (evt:Event):void
{
// timer that reads hlookat and fov and updates the compass
updatetimer = new Timer(1000/30,0); // 30fps
updatetimer.addEventListener(TimerEvent.TIMER, updateFov);
updatetimer.start();
//
function updateFov (e:Event)
{
var rotation:Number = 0; // default value
//
if (krpano.get != null)
{
var view:Object = krpano.get("view");
var hotspotobject:Object = krpano.get("hotspot[deltarotation]");
// real value
rotation = Number( hotspotobject.ath ) - view.hlookat;
}
//
compass_ring_btn.rotation = rotation; // rotate the compass accordingly to the pano pan
}
}
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
function updateFov (e:Event)
{
var rotation:Number = 0; // default value
if (krpano.get != null)
{
var view:Object = krpano.get("view");
var hotspotobject:Object = krpano.get("hotspot[deltarotation]");
if (hotspotobject == null) // <= NEW - check if hotspot object exsits
return;
// real value
rotation = Number( hotspotobject.ath ) - view.hlookat;
}
}
|
