Using an XML file
You can set the image and properties of the 360PanViewerPRO externally using an XML file. The name of the XML file to load can be entered in the pan source property in the Component Inspector. You may also assign the XML file dynamically through ActionScript like this:
myPanViewer.source = "pan2.xml";
XML format
This is how the format of the XML file may be:
<?xml version="1.0" encoding="utf-8"?>
<panviewer>
<image>
<path>sunset.jpg</path>
<width>650</width>
<height>300</height>
<mouseAction>press</mouseAction>
<is360>true</is360>
<speedIndex>23</speedIndex>
<slowDownIndex>10</slowDownIndex>
<autopan>
<horizontalSpeed>4</horizontalSpeed>
<verticalSpeed>8</verticalSpeed>
<delay>1</delay>
</autopan>
<displacement>
<angleIndex>60</angleIndex>
<distortionIndex>120</distortionIndex>
</displacement>
<hotspots>
<hs name="xmlHS">
<width>160</width>
<height>85</height>
<x>500</x>
<y>140</y>
<color>0x00ff00</color>
<borderColor>0xffffff</borderColor>
<alpha>30</alpha>
<events>
<over action="test">testing</over>
<out action=""></out>
<press action="load">pan2.xml</press>
<release action=""></release>
</events>
</hs>
<hs name="xmlHS2">
<width>20</width>
<height>25</height>
<x>0</x>
<y>60</y>
<color>0xcde343</color>
<borderColor>0xffffff</borderColor>
<alpha>30</alpha>
</hs>
</hotspots>
</image>
</panviewer>
Most of the properties are the same as the properties found in the component panel. The hotspot properties are the same as the properties explained in the createHotSpot method. All of the properties (except for the path property, which contains the image name) are optional. If any of these properties are omitted, the default component parameters will be used instead.
Specifying hotspots in the XML
The events tag of each hotspot tag can have 4 nodes for each event that the hotspot triggers. The action attribute of each event tag is evaluated using the eval actionscript function and is passed the string parameter of the event node value. There is an exception if the action is load. In this case, the xml file with the path set as the node value will be loaded into the component.
In the example above, when the user places the mouse pointer over the hotspot named xmlHS, _level0.test will be called and passed the parameter "testing". This is the same as if the following actionscript has been executed:
eval( "test" )( "testing" );When a user clicks on the same hotspot, the 360PanViewerPro will automatically load the file pan2.xml, which has the same effect as if the following actionscript has been executed:
myPanViewer.source = "pan2.xml";