pano2VR二次开发接口(API)相关说明

  • 格式:doc
  • 大小:85.50 KB
  • 文档页数:10

下载文档原格式

  / 10
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Flash API (Pano2VR) From Garden Gnome Software (Redirected from Pano2VR - Flash API)

Jump to: navigation, search

To embed the pano, please use the following code: Contents

[hide]

∙1Loading the Panorama

o 1.1Actionscript 3.0

o 1.2Actionscript 2.0

∙2Panorama API calls

o 2.1Changing the view

o 2.2Changing the panorama window

o 2.3Hotspots

o 2.4Video

o 2.5Others

∙3Change the default Hotspot handler

o 3.1Actionscript 3.0

o 3.2Actionscript 2.0

Loading the Panorama Actionscript 3.0

import flash.display.*;

import .URLRequest;

import flash.events.Event;

var loader:Loader = new Loader();

var url:String = "panorama.swf";

var urlReq:URLRequest = new URLRequest(url); var vr:MovieClip;// panorama movieclip

// This is done after the swf is loaded.

function finished_loading (e:Event){

}

function initHandler(event:Event):void{

trace("initHandler: "+ event);

vr = MovieClip(loader.content);// cast 'DisplayObject' to 'MovieClip'

// vr.isFlash10=false; // Disable Flash 10 rendering if the container is Flash 9

}

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.x=50;

vr.y=50;

vr.pano.setWindowSize(400,300);

}

}

// call initPanorama every frame

addEventListener(Event.ENTER_FRAME, initPanorama);

// Tell the loader to call 'finished_loading' after the swf is loaded. loader.contentLoaderInfo.addEventListener( PLETE, finished_loading);

// Tell the loader to call 'initHandler' after the swf is initialized. loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);

loader.load(urlReq);

addChild(loader);// add your swf directly to the stage

If you like to remove the panorama use the following code:

vr.cleanup();

removeChild(loader);

You need to call the cleanup method to avoid errors like "Cannot access a property or method of a null object reference" because ActionScript doesn't provide a destructor for objects. Actionscript 2.0

Only for Flash 8 export in Pano2VR 2.x - deprecated

var vr:MovieClip = _root.createEmptyMovieClip("vr", 1);

vr._lockroot=true;

// move the upper left corner

vr._x=100;

vr._y=200;

var myLoader = new MovieClipLoader();

var myListener = new Object();

myListener.onLoadStart = function(){

// Set the dimensions and position of the pano

vr.window_width=500;

vr.window_height=380;

vr.window_x=100;

vr.window_y=10;

};

myListener.onLoadInit = function(){

// your initalisation of the pano, add Hotspots,...

// You can also set the window size here but you need to use the API vr.pano.setWindowSize(500,380);

};

myLoader.addListener(myListener);

myLoader.loadClip("mypanorama.swf", vr);

I never managed to use loadMovie properly, so if you really want to use it you are on your own. The demo at

/samples/pano2qtvr/flashtour/ includes the .fla file with the complete source code. Panorama API calls

After the panorama is initialized and loaded you can make the following API calls at runtime

Changing the view

.pano.getPan();// returns the current pan angle

.pano.setPan(angle_in_degrees:Number);// sets the current pan angle

.pano.changePan(offset_in_degrees:Number);// change the current pan angle

.pano.getTilt();// returns the current tilt angle