Panorama Flash API

Specific Q&A about the new Flash export
User avatar
thomas
Chief Gnome
Posts: 2611
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

Ok, since a lot of people like to embed the panos into thier own Flash application I added some API functions which you can use.

To embed the pano, please use the following code:

Code: Select all

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.onLoadInit = function () {
  // your initalisation of the pano, add Hotspots,... f.e
  vr.pano.setWindowSize(500,400);
};

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.

Possible API calls are:
  • <panoclip>.pano.getPan(); - returns the current pan angle
    <panoclip>.pano.setPan(<angle in degrees>); - sets the current pan angle
    <panoclip>.pano.getTilt(); - returns the current tilt angle
    <panoclip>.pano.setTilt(<angle in degrees>); - sets the current tilt angle
    <panoclip>.pano.getFov(); - sets the current FoV
    <panoclip>.pano.setFov(<angle in degrees>); - sets the current FoV
    <panoclip>.pano.setWindowSize(<width>,<height>); - sets the current panorama window size
    <panoclip>.pano.addHotspot(<string-id>,<pan-angle>,<tilt-angle>,<movieclip>); - Adds a Hotspot to the panorama
Maybe the addHotspot call need some explanation:
<id> - This is just a string. No use for it now but maybe in the future.
<pan-angle>,<tilt-angle> - define the position within the panorama.
<movieclip> - this can be anything you created in the library or code.
Basically only the _x and _y are moved by the pano so the depth of your movieclip defines f.e. the visibility. Also you can let the movieclip do what ever you want f.e. open a URL change the color on mouse over.... animations will always run with the speed of the pano so don't expect wonders. On a normal PC this would result in 10-20 fps. If you have questions, ideas, whishes what so ever please let me know. I will provide a .fla soon in the meantime you can have a look at http://www.pano2qtvr.com/sample/flashtour
MfG, Thomas
panorama
Posts: 15
Joined: Mon Sep 18, 2006 4:28 am

How to add a hotspot with pano2qtvr in a single flash panorama? Thx
panorama
Posts: 15
Joined: Mon Sep 18, 2006 4:28 am

hi Thomas, I want creat a muti flash panorama tour like your tour,How can I do it ? How to creat some hotspots in a panorama? Can you give me a .fla file?Thanks
My email: webpanorama@hotmail.com
andras
Posts: 13
Joined: Sat Sep 30, 2006 9:06 pm

Code: Select all

myListener.onLoadInit = function () { 
  // your initalisation of the pano, add Hotspots,... f.e 
  vr.pano.setWindowSize(500,400);
  trace(vr.pano.getFov());
  vr.pano.setFov(50);
  trace(vr.pano.getFov());
}; 
the trace returns the changed values correctly, but the actual FOV does not change (i mean the pano, visually)

EDIT:
calling the setFov function outside of the init sequence does work.
andras
Posts: 13
Joined: Sat Sep 30, 2006 9:06 pm

anybody there?

I also have been unable to add hotspots as descripbed in Thomas' post. In the init sequence, or outside it . . .

Tried referencing library items, as well as instances of those as the last argument for the function.

Can anyone assist here?
User avatar
thomas
Chief Gnome
Posts: 2611
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

I have fixed this in beta 6 see http://www.pano2qtvr.com/forum/phpBB2/v ... c.php?t=62

There is also a demo project which will show you the (new) way.
MfG, Thomas
panorama
Posts: 15
Joined: Mon Sep 18, 2006 4:28 am

I have some trouble to use the API " autorotate ",When I use the api in the XML file with flash,the autorotate numerical value only availability with the integer(such as "5"), when I set the autorotate numerical value to decimal fraction (such as"0.5" ) the flash panorama can not autorotate,
but when I publish the flash pano with PANO2QTVR the "autorotate speed" can work well with decimal fraction (such as"0.5" ) .
Why it can not work well with XML set(decimal fraction)?
Beg you reply,THX
kengyu
Posts: 3
Joined: Fri Apr 20, 2007 11:16 am
Contact:

It is wonderful.
SWF of object VR was also able to be imported to FLA.
By this API, it should be horizontally said to FLASH that three object VR is put in order.
Can't two or more pano2qtvr swf be put in order? :o
1eo
Posts: 7
Joined: Tue Apr 24, 2007 10:41 pm

pardon my ignorance in Flash... but I'm having a hard time locating and sizing my pano.

is there a way to graphically do it? kind of like making a box (rectangle tool) and assigning the pano to the box... so if I change the box size or location the pano will take that shape?

Also if I for example I assign the pano to a button using only

Code: Select all

on (release) {}
and your code

will the pano load only after pressing the button, or it will flash try to load the pano once the flash animation starts playing?

thanks!
leonardo (I'm more of a graphical person than a coder :lol: )
Fass
Posts: 2
Joined: Thu May 24, 2007 8:31 pm

I'm currently trying to load a swf in my Flashfile. In the first place it works perfect, then I'm trying to resize it to the actual fit but somehow it doesn't work... I used the following code:

Code: Select all

var vr:MovieClip = _root.contentGrotezaal.contentHolder.createEmptyMovieClip("vr", 1);
vr._lockroot = true;

// move the upper left corner
vr._x=100;
vr._y=200; 

// Create a Movieclip loader 
var myLoader = new MovieClipLoader();
var myListener = new Object();
myListener.onLoadInit = function() {
	
	// your initalisation of the pano, add Hotspots,... f.e
	vr.pano.setWindowSize(392, 254);
};
myLoader.addListener(myListener);
myLoader.loadClip("360/grote-zaal.swf", vr);
exactly as described... But the resizing doesn't work... Am I overlooking something here?
m_stoss
Posts: 34
Joined: Thu Oct 19, 2006 12:05 pm
Location: Berlin
Contact:

thomas wrote: [...]
Possible API calls are:
  • <panoclip>.pano.getPan(); - returns the current pan angle
    <panoclip>.pano.setPan(<angle in degrees>); - sets the current pan angle
    <panoclip>.pano.getTilt(); - returns the current tilt angle
    <panoclip>.pano.setTilt(<angle in degrees>); - sets the current tilt angle
    [...]
Sorry, I'm not able to simply test this on my own: is there something like .pano.autorotate(true) or so to start/stop the autorotation from outside the panorama by actionscript?

If not, how would I have to do this?

Any help greatly appreciated,

Yours,
Michael
baoputzi
Posts: 14
Joined: Tue Sep 19, 2006 10:28 am
Location: Cologne/Germany
Contact:

Fass wrote:I'm currently trying to load a swf in my Flashfile. In the first place it works perfect, then I'm trying to resize it to the actual fit but somehow it doesn't work... I used the following code:

Code: Select all

var vr:MovieClip = _root.contentGrotezaal.contentHolder.createEmptyMovieClip("vr", 1);
vr._lockroot = true;

// move the upper left corner
vr._x=100;
vr._y=200; 

// Create a Movieclip loader 
var myLoader = new MovieClipLoader();
var myListener = new Object();
myListener.onLoadInit = function() {
	
	// your initalisation of the pano, add Hotspots,... f.e
	vr.pano.setWindowSize(392, 254);
};
myLoader.addListener(myListener);
myLoader.loadClip("360/grote-zaal.swf", vr);
exactly as described... But the resizing doesn't work... Am I overlooking something here?
I just saw your query. if you create the pano container on _root as _root.contentGrotezaal.contentHolder.vr you have to reference each call to the pano accordingly i.e. _root.contentGrotezaal.contentHolder.vr.pano.setPan(-20)
User avatar
jaymzeberly
Posts: 19
Joined: Wed Nov 01, 2006 9:16 pm
Location: lost angeles

Hi I have gotten this to kind of work :)

vr.pano.setPan(40);

mainly I would like to pan across, down, up, etc...

this code is not working:

Vr.pan=vr.pan+1;


is there a list of all of the functions somewhere?
I need zoom in, zoom out, right, left, up , down and auto pan

thanks !!
Jaymz
User avatar
Brian
Posts: 36
Joined: Thu Mar 08, 2007 7:19 pm
Location: Glasgow, Scotland
Contact:

Well, Vr is different from vr in ActionScript
User avatar
jaymzeberly
Posts: 19
Joined: Wed Nov 01, 2006 9:16 pm
Location: lost angeles

nice :) you found the obvious which is so easily overlooked ;)

thanks !
Locked