Preloading/Flash API

Q&A about the latest versions
Post Reply
oliaros
Posts: 4
Joined: Mon Oct 08, 2007 3:42 pm

Just tested preloading pano swf's in Flash 9 container, seems to work (besides some errormessages from the preloaded panos). Sofar so good.
The only thing now is the API for the Flash9 swf's. Did I miss some document or is it still in the works?

thnx

G
User avatar
thomas
Chief Gnome
Posts: 2613
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

The API calls are the same, but there are still not all functions implemented, most notable the Hotspots. The loading functions in AS3 look a little bit different because you need to cast the object. Here is the code:

Code: Select all

import flash.display.*;
import flash.net.URLRequest;
import flash.events.Event;

var loader:Loader;
loader = new Loader();
var url:String = "park.swf";
var urlReq:URLRequest = new URLRequest(url);
var vr: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.pano.setWindowSize(200,100);
}


// Tell the loader to call 'finished_loading' after the swf is loaded.
loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, finished_loading);
loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
loader.load(urlReq);
addChild(loader); // add your swf directly to the stage
MfG, Thomas
akash
Posts: 10
Joined: Wed Feb 21, 2007 6:48 pm

Hi Oliaros,
Did you figure out how to preload the panos, meaning that if someone's viewing one pano, the others keep loading in the background.

Also, if anybody's figured out how to change the pan, tilt and FOV of the panorama through ActionScript, while it is running.

I did use Thomas' example, but it doesn't work in AS3, the example is:

var cnt:Number=0;

_root.onEnterFrame=function() {
if (cnt<100) { // executed t=0..99
// rotate
vr.pano.changePan(0.5);
} else
if (cnt<200) { // executed t=100..199
// rotate + look up
vr.pano.changePan(0.5);
vr.pano.changeTilt(0.5);
} else
if (cnt<400) { // executed t=200..399
// rotate + look down
vr.pano.changePan(0.5);
vr.pano.changeTilt(-0.5);
} else
if (cnt<500) { // executed t=400..499
// rotate + move back to horizon
vr.pano.changePan(0.5);
vr.pano.changeTilt(0.5);
}
cnt++;
if (cnt>=500) cnt=0; // loop after t=500
}

I am not good at any kind of ActionScript, let alone AS3. I would really appreciate anybody's help.

Thanks,
Akash
oliaros
Posts: 4
Joined: Mon Oct 08, 2007 3:42 pm

I can preload but my Problem lies in the fact that when Iwant to switch a swf i get the errormessage:
TypeError: Error #1009: .
at PanoCube/setup_cube()
at PanoCube/::init_cubefaces()
at PanoCube/init_faces()
at flash3dpano_empty_fla::MainTimeline/flash3dpano_empty_fla::

It happens when I remove the swf from the displaylist, it doesnt stopp the swf from working but this message shows up in IE6 console
User avatar
thomas
Chief Gnome
Posts: 2613
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

Yes, I noticed this problem. I seams that the events are not removed if you delete an object. With beta3 there will be a "clean up" function so that you can fully remove the panorama from the stage.
MfG, Thomas
bigyeti
Posts: 1
Joined: Thu Nov 22, 2007 10:23 am

When will Beta3 be available??

Thanks
Bigyeti
User avatar
thomas
Chief Gnome
Posts: 2613
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

bigyeti wrote:When will Beta3 be available??
I hope 1-2 weeks...
MfG, Thomas
hgsch
Posts: 2
Joined: Thu Dec 20, 2007 10:45 am

thomas wrote:With beta3 there will be a "clean up" function so that you can fully remove the panorama from the stage.
Hi Thomas,

i must call this function separately? Or is this function in the beta3 not included?
User avatar
thomas
Chief Gnome
Posts: 2613
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

hgsch wrote:i must call this function separately? Or is this function in the beta3 not included?
Yes, you need to call it, it is in beta3, and it is called "cleanup" ;)

So you must call

Code: Select all

vr.pano.cleanup();
removeChild(vr);
MfG, Thomas
Post Reply