embed panorama in flash with AS3

Using Pano2VR/Object2VR SWF files with your own Flash projects
Post Reply
prav2pkp
Posts: 13
Joined: Fri Mar 08, 2013 12:23 pm

HI,
need help with AS3. I am trying to make responsive pano tour in flash professional CC. i have used AS3 code to embed panorama swf file from this site- http://ggnome.com/wiki/Flash_API_(Pano2VR)

Code: Select all

import flash.display.*;
import flash.net.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(flash.events.Event.COMPLETE, 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
and its working fine, but i want it to load when i click on a button and unload and close it on clicking on a close button.


Thanks
AGilkes
Posts: 3
Joined: Fri Jul 29, 2016 10:01 pm

Hi, did you ever get this resolved? I'm trying to do a similar thing - I have a menu screen to open various panoramas pretty much fullscreen with a button to close, but on the pc it crashes after I've accessed a few panos. Doesn't seem to crash on the mac though. Unfortunately the delivery platform is pc.
User avatar
stalwart
Posts: 651
Joined: Thu Oct 02, 2008 11:52 am

Hi all,

I have exactly the same issue with Animate CC (with AIR 21.0 Desktop project). Did you ever resolve this? It seems there is something particular to these panoramas that doesn't get cleaned up. This resource explains how to use another method to clean up but it also fails:

http://ggnome.com/wiki/Flash_API_(Pano2 ... e_Panorama

Is this an issue with the format or with Adobe Animate or with the API?

cheers

Stu
Post Reply