View Full Version : Embed Pano problems
tektonic
10-23-2007, 01:43 PM
I am trying to find a way to embed a pano into another swf and then recieve variables from the hotspots to check whether thay have been clicked or not.
My navigation controls work fine as they can access the pano object directly. Is there any way, other than localConnection, to directly access the hotspot objects and the values that are set within them?
In a previous version I have used ExternalInterface, but I am now working within the contstraints of a template that does not seem to allow for the html wrapper side of things.
Any help would be appreciated!
zleifr
10-23-2007, 02:13 PM
Hi,
Here is a collection of email responses from Denis on exactly this subject. I never did quite get it to work, probably because I didn't follow up on his last suggestion of making a timer and waiting for things to load (probably checking if (pano.parsed) { goAhead } would work. If you do get this to work, please do share the code. I for one would find it very useful.
The set of parameter for local connection is constrained, you can't get values of internal objects, you can set them using execute().
Using direct AS3 calls you have more possibilities, you can get control objects like: hotspots.getGlobal(), hotspots.getPano() and hotspots.getSpot(name:String) to control their values directly.
You can have an access to any loaded plugin using reference
panoMain.externals (type Object).
So, the link to Hotspots is
panoMain.externals.hotspots
link to Global object:
panoMain.externals.hotspots.getGlobal()
You can use it like this:
hotspots.getGlobal().brightness=1;
or
hotspots.getGlobal().onDeactivate="pano.saturation=-1,1000"
(On asking why getGlobal() gives error that it doesn't exist):
Check all references, most probably externals.hotspots dosn't exist when you call it. It will be inited after the loader plugin is loaded. Make a waiting script to be sure that external.hotspots is accessible.
Hope this helps
tektonic
10-23-2007, 02:31 PM
thanks for pointing me in the right direction. Hopefully I will get it working and will be able to post something useful in return.
tektonic
10-23-2007, 03:04 PM
have now been able to trace out the id of hotspots object which comes back in the output window as "Hotspots" but cant seem to access an individual hotspot ...
function checkClicked (e:Event) {
if(panorama.externals.hotspots){
trace(panorama.externals.hotspots.id);
populateText(0);
}else{
trace("empty");
}
}
getGlobal() certainly does not seem to work
zleifr
10-23-2007, 03:37 PM
Well, you might try the hotspots link:
panorama.externals.hotspots.getSpot(name:String)
I've not tried using that one. I always tried using getGlobal() because I wanted a globaly property.
Zephyr
tektonic
10-23-2007, 04:14 PM
no I have tried all the paths in your post and none of them seem to work.
I will now try the checking statement although Iam not too sure what form this should take?
zleifr
10-23-2007, 05:14 PM
You might try enumerating the dynamically added properties:
for (var p:String in obj) {
textDump.text += p + " : " + obj[p] + "\n";
}
trace(textDump);
Or you might try object introspection and see if you can find the static method or class that will get you there (these were the next steps I was going to take, but never got around to it):
trace(describeType(panorama.externals.hotspots));
Let me know what you find out. Hope this helps.
tektonic
10-24-2007, 08:10 AM
ok this is the xml that is traced out when you do
trace(panorama.externals.hotspots.hotspots_obj)
not really sure where to go from here.... Im fairly new to Actionscript 3.0 (although I have a good grasp of Actionscript 1.0 and 2.0).....
continued on next post.......
<?xml version="1.0" encoding="utf-8"?>
<type name="Hotspots" base="flash.display::Sprite" isDynamic="false" isFinal="false" isStatic="false">
<extendsClass type="flash.display::Sprite"/>
<extendsClass type="flash.display::DisplayObjectContainer"/>
<extendsClass type="flash.display::InteractiveObject"/>
<extendsClass type="flash.display::DisplayObject"/>
<extendsClass type="flash.events::EventDispatcher"/>
<extendsClass type="Object"/>
<implementsInterface type="flash.display::IBitmapDrawable"/>
<implementsInterface type="flash.events::IEventDispatcher"/>
<constructor>
<parameter index="1" type="flash.display::DisplayObject" optional="false"/>
<parameter index="2" type="Object" optional="false"/>
</constructor>
<method name="panoCreated" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="Object" optional="false"/>
</method>
<method name="doHSClick" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="flash.events::Event" optional="false"/>
</method>
<method name="doHSPress" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="flash.events::Event" optional="false"/>
</method>
<method name="panoFiltersChanged" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="*" optional="false"/>
</method>
<accessor name="pano2" access="readonly" type="Object" declaredBy="Hotspots"/>
<method name="addGlobal" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="Object" optional="false"/>
</method>
<method name="hideSpot" declaredBy="Hotspots" returnType="Object">
<parameter index="1" type="String" optional="false"/>
</method>
<method name="getPano" declaredBy="Hotspots" returnType="Object"/>
<method name="addPanoBase" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="Object" optional="false"/>
<parameter index="2" type="AttributesPano" optional="false"/>
</method>
<method name="doHSOver" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="flash.events::Event" optional="false"/>
</method>
<method name="getSpots" declaredBy="Hotspots" returnType="Object"/>
<method name="doRender" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="flash.events::Event" optional="true"/>
</method>
<method name="executeFunction" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="String" optional="false"/>
<parameter index="2" type="String" optional="true"/>
</method>
<method name="spotFiltersChanged" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="*" optional="false"/>
</method>
<method name="addPano" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="Object" optional="false"/>
</method>
<method name="getGlobal" declaredBy="Hotspots" returnType="Object"/>
<method name="spotChanged" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="*" optional="false"/>
</method>
<method name="getLink" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="Array" optional="false"/>
</method>
<method name="addSpot" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="Object" optional="false"/>
<parameter index="2" type="int" optional="false"/>
<parameter index="3" type="String" optional="false"/>
</method>
<method name="getSpot" declaredBy="Hotspots" returnType="Object">
<parameter index="1" type="String" optional="false"/>
</method>
<method name="getPano2" declaredBy="Hotspots" returnType="Object"/>
<method name="fullscreen" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="Array" optional="false"/>
</method>
<accessor name="panoName" access="readonly" type="String" declaredBy="Hotspots"/>
<method name="doHSOut" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="flash.events::Event" optional="false"/>
</method>
<accessor name="pano" access="readonly" type="Object" declaredBy="Hotspots"/>
<method name="moveSpot" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="String" optional="false"/>
<parameter index="2" type="String" optional="false"/>
</method>
<method name="execute" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="String" optional="false"/>
<parameter index="2" type="String" optional="true"/>
</method>
<method name="panoChanged" declaredBy="Hotspots" returnType="*"/>
<method name="loadPano" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="Array" optional="false"/>
</method>
<method name="change" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="Array" optional="false"/>
<parameter index="2" type="Array" optional="false"/>
<parameter index="3" type="int" optional="true"/>
<parameter index="4" type="String" optional="true"/>
</method>
<method name="removeSpot" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="String" optional="false"/>
</method>
<method name="showSpot" declaredBy="Hotspots" returnType="Object">
<parameter index="1" type="String" optional="false"/>
</method>
<method name="globalFiltersChanged" declaredBy="Hotspots" returnType="*"/>
<method name="doHSRelease" declaredBy="Hotspots" returnType="*">
<parameter index="1" type="flash.events::Event" optional="false"/>
</method>
<method name="startDrag" declaredBy="flash.display::Sprite" returnType="void">
<parameter index="1" type="Boolean" optional="true"/>
<parameter index="2" type="flash.geom::Rectangle" optional="true"/>
</method>
<accessor name="buttonMode" access="readwrite" type="Boolean" declaredBy="flash.display::Sprite"/>
<accessor name="graphics" access="readonly" type="flash.display::Graphics" declaredBy="flash.display::Sprite"/>
<accessor name="useHandCursor" access="readwrite" type="Boolean" declaredBy="flash.display::Sprite"/>
<method name="stopDrag" declaredBy="flash.display::Sprite" returnType="void"/>
<accessor name="soundTransform" access="readwrite" type="flash.media::SoundTransform" declaredBy="flash.display::Sprite"/>
<accessor name="dropTarget" access="readonly" type="flash.display::DisplayObject" declaredBy="flash.display::Sprite"/>
<accessor name="hitArea" access="readwrite" type="flash.display::Sprite" declaredBy="flash.display::Sprite"/>
<method name="addChild" declaredBy="flash.display::DisplayObjectContainer" returnType="flash.display::DisplayObject">
<parameter index="1" type="flash.display::DisplayObject" optional="false"/>
</method>
<method name="swapChildren" declaredBy="flash.display::DisplayObjectContainer" returnType="void">
<parameter index="1" type="flash.display::DisplayObject" optional="false"/>
<parameter index="2" type="flash.display::DisplayObject" optional="false"/>
</method>
<method name="getChildByName" declaredBy="flash.display::DisplayObjectContainer" returnType="flash.display::DisplayObject">
<parameter index="1" type="String" optional="false"/>
</method>
</type>
tektonic
10-24-2007, 08:37 AM
this seems to work perfectly....
button1.addEventListener(MouseEvent.MOUSE_DOWN, checkClicked);
function checkClicked (e:Event) {
spot1 = panorama.externals.hotspots.hotspots_obj.getSpot("pic1");
spot1.alpha=0.5;
}
thanks a lot for your help zleifr, that was some invaluable advice :)
tektonic
10-24-2007, 08:48 AM
I ran this code to trace out all the properties of the required hotspot...
spot1 = panorama.externals.hotspots.hotspots_obj.getSpot("grinder");
trace(describeType(spot1));
this gave me everything I need to access the properties of the hotspot I need
tektonic
11-06-2007, 03:32 PM
by the way ... this only seems to work if your hotspots are named using lower case only ;)
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.