Accessing attributes of pano loaded with MXML SWFLoader

Using Pano2VR/Object2VR SWF files with your own Flash projects
Post Reply
NFSTC
Posts: 11
Joined: Fri Feb 04, 2011 8:38 pm

Accessing attributes of pano loaded with MXML SWFLoader

Post by NFSTC » Tue Jul 10, 2012 8:00 pm

Hi, I'm having a heck of time getting data back out from my pano.

The project is in Flash Builder 4.5 and I've used the following code to create an MXML component that displays the pano .swf file. The pano behaves well and it's hotspots load other panos into the window when clicked. What I cannot seem to do, however, is access info from the pano currently being displayed. The 'photoClicked' function should pull key bits back from the pano to feed to the 'saveViewInfo' function but running through all the attributes of the SWFLoader hasn't yielded any fruit.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
				   xmlns:s="library://ns.adobe.com/flex/spark"
				   xmlns:mx="library://ns.adobe.com/flex/mx"
				   xmlns:panos="nfstc.panos.*"
				   width="550" height="530" backgroundColor="#959595" chromeColor="#808080">
	<fx:Script>
		<![CDATA[
			import mx.controls.Alert;
			import mx.events.FlexEvent;
			
			protected function photoClicked(e:MouseEvent):void {
				// Here is where I need to access info from the pano,
				var pan:Number = 0;
				var tilt:Number = 0;
				var fov:Number = 0;
				var swf:String = ''; // Should show name of currently displayed pano if user has moved into a different room than the original source.
				saveViewInfo(pan,tilt,fov,swf);}
			
			protected function saveViewInfo(pan:Number,tilt:Number,fov:Number,swf:String):void {
				// TODO: Function stub
				}
			
			protected function loaded(e:Event):void {
				loader.height = 350;
				loader.width = 525;}
		]]>
	</fx:Script>
	
	<s:Panel left="10" right="10" top="10" bottom="10" backgroundColor="#808080"
			 chromeColor="#808080" fontSize="20" title="Scene View">
		<s:Label x="29" bottom="24" color="#970000" fontSize="12" text="Shift to Zoom In - Ctrl to Zoom Out"/>
		<s:HGroup right="30" bottom="20" height="20" gap="5" verticalAlign="middle">
			<s:Button id="btnTakePhoto" height="20" label="Capture Photo" 
					  chromeColor="#80FF80" color="#000000" cornerRadius="10"
					  fontFamily="Arial" fontSize="14" fontWeight="normal"
					  click="photoClicked(event)"/>
			<s:Button id="btnTakeEvidence" height="20" label="Collect Evidence"
					  chromeColor="#80FF80" color="#000000" cornerRadius="10"
					  fontFamily="Arial" fontSize="14" fontWeight="normal"/>
		</s:HGroup>
		<s:SWFLoader id="loader" horizontalCenter="-1" top="0" autoLoad="true"
					 scaleContent="true" maintainAspectRatio="false" maintainProjectionCenter="false"
					 source="nfstc/panos/Cafe_1_sm_out.swf" complete="loaded(event)"/>
	</s:Panel>
</s:BorderContainer>
	

NFSTC
Posts: 11
Joined: Fri Feb 04, 2011 8:38 pm

Re: Accessing attributes of pano loaded with MXML SWFLoader

Post by NFSTC » Tue Jul 10, 2012 8:05 pm

Here's a shot of the component in the Design View mode of Flash Builder
Image

Here's the whole application running in a browser...
Image

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests