I´m having 9 frames on my project. The first one is a topview drawing of the place with buttons where panos are located. At the press of one of the buttons, it should send the user to the frame where this pano is imported (eg. button "pano1" should send the user to frame "pano1"). I´m using this code on the first Frame:
Code: Select all
stop();
import flash.display.*;
import flash.net.URLRequest;
import flash.events.Event;
/* Click to Go to Frame and Stop
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
*/
pano1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_6);
function fl_ClickToGoToAndStopAtFrame_6(event:MouseEvent):void
{
gotoAndStop("pano1");
}
Code: Select all
back.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_7);
function fl_ClickToGoToAndStopAtFrame_7(event:MouseEvent):void
{
vr.cleanup();
removeChild(loader);
gotoAndStop("start");
}
var loader:Loader = new Loader();
var url:String = "360s/pano1New.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=60;
vr.y=100;
vr.pano.setWindowSize(900,600);
}
}
// 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
I get the following compiler error when exporting:
Code: Select all
Scene 1, Layer 'actions', Frame 3, Line 1 1151: A conflict exists with definition loader in namespace internal.
Scene 1, Layer 'actions', Frame 3, Line 2 1151: A conflict exists with definition url in namespace internal.
Scene 1, Layer 'actions', Frame 3, Line 3 1151: A conflict exists with definition urlReq in namespace internal.
Scene 1, Layer 'actions', Frame 3, Line 4 1151: A conflict exists with definition vr in namespace internal.
Scene 1, Layer 'actions', Frame 3, Line 7 1021: Duplicate function definition.
Scene 1, Layer 'actions', Frame 3, Line 10 1021: Duplicate function definition.
Scene 1, Layer 'actions', Frame 3, Line 16 1021: Duplicate function definition.