Will Yurman
07-30-2008, 08:52 PM
Hi,
Latest Update - the button sort of works, it goes full screen, but contstained by the flash shell(click on the link below to see what I mean)... I've put the most current AS3 code below. I must be close. If someone could help push me over the edge I'd appreciate it :)
I'm working on my first pano, using Patrick's great tutorial on embedding FPP in another Flash container.
To keep it simple, I'm only loading a single panorama, so I've eliminated much of his code - basically it overwhelmed me :)
I've gotten most of it to work, except for the full screen button.
I'm not sure where I've gone wrong - any help would be appreciated.
you can see the show at:
http://www.willyurman.com/_NewAttempt/RoundRochesternew.html
(the design is still a work in progress)
the AS3 code on my Flash container is below. My scripting skills are pretty weak, so I'm largely a copy and paster type...
thanks,
will
stop();
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.display.Sprite;
import flash.events.*;
import flash.net.URLRequest;
import fl.transitions.Tween;
import fl.transitions.*;
import fl.transitions.easing.*;
var panorama:MovieClip;
var loader:Loader = new Loader();
loader.load(new URLRequest("pano.swf"));
addChild(loader);
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, loadComplete);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
function loadComplete(e:Event) {
swapChildren(loader, border);
panorama = loader.content;
panorama.setArea(1,40,900,500);
panorama.loadPanorama("xml_file=pano.xml");
//Variants:
//panorama.loadPanorama("pano.swf?panoName=images/snow"); //load images/snow pano, old syntax
//panorama.loadPanorama("panoName=images/snow&segments=10&pan=100"); //load images/snow with custom params
//panorama.loadPanorama("panoName=images/snow&xml_file=&"); //load images/snow without myPano.xml file
//panorama.loadPanorama("panoName=images/snow&xml_file=my.xml"); //load images/snow with custom xml file
//panorama.loadPanorama("xml_file=my.xml"); //load xml file (panoname within)
//panorama.loadPanorama("panoName=images/snow&layer_1=files/menuFullscreen.swf"); //load menuFullscreen plugin
//panorama.loadPanorama("xml_text="+xml_1); //load with predefined XML data
left_btn.addEventListener(MouseEvent.MOUSE_DOWN, doLeft);
right_btn.addEventListener(MouseEvent.MOUSE_DOWN, doRight);
up_btn.addEventListener(MouseEvent.MOUSE_DOWN, doUp);
down_btn.addEventListener(MouseEvent.MOUSE_DOWN, doDown);
zoomin.addEventListener(MouseEvent.MOUSE_DOWN, doZoomin);
zoomout.addEventListener(MouseEvent.MOUSE_DOWN, doZoomout);
stage.addEventListener(MouseEvent.MOUSE_UP, reset);
if (stage.hasOwnProperty("displayState")) {// check fullscreen feature is accessible or not
stage.addEventListener(FullScreenEvent.FULL_SCREEN , fullscreenHandler);
full_btn.addEventListener(MouseEvent.CLICK, doFullscreen);
} else {
full_btn.visible=false;
}
}
function doLeft(e:Event) {
panorama.pano.panKey = -1;
}
function doRight(e:Event) {
panorama.pano.panKey = 1;
}
function doUp(e:Event) {
panorama.pano.tiltKey = 1;
}
function doDown(e:Event) {
panorama.pano.tiltKey = -1;
}
function doZoomin(e:Event) {
panorama.pano.zoomKey = 1;
}
function doZoomout(e:Event) {
panorama.pano.zoomKey = -1;
}
function reset(e:Event) {
panorama.pano.panKey = 0;
panorama.pano.tiltKey = 0;
panorama.pano.zoomKey = 0;
}
function doFullscreen(e:Event) {
if (stage.hasOwnProperty("displayState")) {
if (stage.displayState == StageDisplayState.FULL_SCREEN) {
stage.displayState = StageDisplayState.NORMAL;
} else {
stage.displayState = StageDisplayState.FULL_SCREEN;
switch (theCurrentPano) {
case "1" :
thePanoToLoad = "panoMidtown";
break;
case "2" :
thePanoToLoad = "panos/large/pano_2/pano_2";
break;
case "3" :
thePanoToLoad = "panos/large/pano_3/pano_3";
break;
case "4" :
thePanoToLoad = "panos/large/pano_4/pano_4";
break;
case "5" :
thePanoToLoad = "panos/large/pano_5/pano_5";
break;
case "6" :
thePanoToLoad = "panos/large/pano_6/pano_6";
break;
default :
thePanoToLoad = "panoMidtown";
break;
}
if (thePL == -1) {
if (panorama.externals.hotspots!=null) {
if (panorama.externals.hotspots.panoName == thePanoToLoad) {
} else {
panorama.externals.hotspots.loadPano(["pano.swf?panoName="+thePanoToLoad]);
addEventListener(Event.ENTER_FRAME, panoLoadWatcher);
}
} else {
panorama.pano.remove();
panorama.loadPanorama("pano.swf?panoName="+thePanoToLoad);
addEventListener(Event.ENTER_FRAME, panoLoadWatcher);
}
}
}
}
}
function fullscreenHandler(e:FullScreenEvent) {
if (e.fullScreen) {
theMask.visible = left_sidebar.visible = bottom_bar.visible = left.visible = right.visible = up.visible = down.visible = zoomin.visible = zoomout.visible = false;
panorama.setArea(0,0,stage.stageWidth,stage.stageH eight);
panorama.mask = null;
full_btn.x = stage.stageWidth-22;
full_btn.y = 22;
} else {
left_sidebar.visible = bottom_bar.visible = left.visible = right.visible = up.visible = down.visible = zoomin.visible = zoomout.visible = true;
panorama.setArea(1,40,900,500);
panorama.mask = border;
full_btn.x = 672;
full_btn.y = 406;
}
}
Latest Update - the button sort of works, it goes full screen, but contstained by the flash shell(click on the link below to see what I mean)... I've put the most current AS3 code below. I must be close. If someone could help push me over the edge I'd appreciate it :)
I'm working on my first pano, using Patrick's great tutorial on embedding FPP in another Flash container.
To keep it simple, I'm only loading a single panorama, so I've eliminated much of his code - basically it overwhelmed me :)
I've gotten most of it to work, except for the full screen button.
I'm not sure where I've gone wrong - any help would be appreciated.
you can see the show at:
http://www.willyurman.com/_NewAttempt/RoundRochesternew.html
(the design is still a work in progress)
the AS3 code on my Flash container is below. My scripting skills are pretty weak, so I'm largely a copy and paster type...
thanks,
will
stop();
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.display.Sprite;
import flash.events.*;
import flash.net.URLRequest;
import fl.transitions.Tween;
import fl.transitions.*;
import fl.transitions.easing.*;
var panorama:MovieClip;
var loader:Loader = new Loader();
loader.load(new URLRequest("pano.swf"));
addChild(loader);
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, loadComplete);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
function loadComplete(e:Event) {
swapChildren(loader, border);
panorama = loader.content;
panorama.setArea(1,40,900,500);
panorama.loadPanorama("xml_file=pano.xml");
//Variants:
//panorama.loadPanorama("pano.swf?panoName=images/snow"); //load images/snow pano, old syntax
//panorama.loadPanorama("panoName=images/snow&segments=10&pan=100"); //load images/snow with custom params
//panorama.loadPanorama("panoName=images/snow&xml_file=&"); //load images/snow without myPano.xml file
//panorama.loadPanorama("panoName=images/snow&xml_file=my.xml"); //load images/snow with custom xml file
//panorama.loadPanorama("xml_file=my.xml"); //load xml file (panoname within)
//panorama.loadPanorama("panoName=images/snow&layer_1=files/menuFullscreen.swf"); //load menuFullscreen plugin
//panorama.loadPanorama("xml_text="+xml_1); //load with predefined XML data
left_btn.addEventListener(MouseEvent.MOUSE_DOWN, doLeft);
right_btn.addEventListener(MouseEvent.MOUSE_DOWN, doRight);
up_btn.addEventListener(MouseEvent.MOUSE_DOWN, doUp);
down_btn.addEventListener(MouseEvent.MOUSE_DOWN, doDown);
zoomin.addEventListener(MouseEvent.MOUSE_DOWN, doZoomin);
zoomout.addEventListener(MouseEvent.MOUSE_DOWN, doZoomout);
stage.addEventListener(MouseEvent.MOUSE_UP, reset);
if (stage.hasOwnProperty("displayState")) {// check fullscreen feature is accessible or not
stage.addEventListener(FullScreenEvent.FULL_SCREEN , fullscreenHandler);
full_btn.addEventListener(MouseEvent.CLICK, doFullscreen);
} else {
full_btn.visible=false;
}
}
function doLeft(e:Event) {
panorama.pano.panKey = -1;
}
function doRight(e:Event) {
panorama.pano.panKey = 1;
}
function doUp(e:Event) {
panorama.pano.tiltKey = 1;
}
function doDown(e:Event) {
panorama.pano.tiltKey = -1;
}
function doZoomin(e:Event) {
panorama.pano.zoomKey = 1;
}
function doZoomout(e:Event) {
panorama.pano.zoomKey = -1;
}
function reset(e:Event) {
panorama.pano.panKey = 0;
panorama.pano.tiltKey = 0;
panorama.pano.zoomKey = 0;
}
function doFullscreen(e:Event) {
if (stage.hasOwnProperty("displayState")) {
if (stage.displayState == StageDisplayState.FULL_SCREEN) {
stage.displayState = StageDisplayState.NORMAL;
} else {
stage.displayState = StageDisplayState.FULL_SCREEN;
switch (theCurrentPano) {
case "1" :
thePanoToLoad = "panoMidtown";
break;
case "2" :
thePanoToLoad = "panos/large/pano_2/pano_2";
break;
case "3" :
thePanoToLoad = "panos/large/pano_3/pano_3";
break;
case "4" :
thePanoToLoad = "panos/large/pano_4/pano_4";
break;
case "5" :
thePanoToLoad = "panos/large/pano_5/pano_5";
break;
case "6" :
thePanoToLoad = "panos/large/pano_6/pano_6";
break;
default :
thePanoToLoad = "panoMidtown";
break;
}
if (thePL == -1) {
if (panorama.externals.hotspots!=null) {
if (panorama.externals.hotspots.panoName == thePanoToLoad) {
} else {
panorama.externals.hotspots.loadPano(["pano.swf?panoName="+thePanoToLoad]);
addEventListener(Event.ENTER_FRAME, panoLoadWatcher);
}
} else {
panorama.pano.remove();
panorama.loadPanorama("pano.swf?panoName="+thePanoToLoad);
addEventListener(Event.ENTER_FRAME, panoLoadWatcher);
}
}
}
}
}
function fullscreenHandler(e:FullScreenEvent) {
if (e.fullScreen) {
theMask.visible = left_sidebar.visible = bottom_bar.visible = left.visible = right.visible = up.visible = down.visible = zoomin.visible = zoomout.visible = false;
panorama.setArea(0,0,stage.stageWidth,stage.stageH eight);
panorama.mask = null;
full_btn.x = stage.stageWidth-22;
full_btn.y = 22;
} else {
left_sidebar.visible = bottom_bar.visible = left.visible = right.visible = up.visible = down.visible = zoomin.visible = zoomout.visible = true;
panorama.setArea(1,40,900,500);
panorama.mask = border;
full_btn.x = 672;
full_btn.y = 406;
}
}