Flash Player 7
myPanViewer.setImage( imgPath:String, [iniObj:Object, [hotSpots:Array]] )
imgPath - Absolute or relative URL of the image, or the library movieclip identifier name
iniObj - (Optional) Initialization object with the following properties:
Property name |
Description |
width |
Number; width of pan viewer |
height |
Number; height of pan viewer |
is360 |
Boolean value indicating if the image is a full 360 degree image (true) or not (false) |
speedIndex |
Number representing the speed of the pan movement |
slowDownIndex |
Number representing the slowdown index (when the mouse is out of the panning area) |
moveOnRelease |
Boolean value indicating if the movement should start when the mouse is over the panning area (false) or not (true) |
useDisplacement |
Boolean value indicating if image displacement should be enabled (true) or not (false). This feature requires flash player 8 |
angleIndex |
Number representing the "flat" area of the displacement map |
distortionIndex |
Number representing the amount of edge distortion for the image displacement |
hotSpots - (Optional) Array of hotspot objects
Nothing.
Method; Sets the pan image. This method is executed also when the source property is set.
The following example will load the pan image and initialize the component according to the initialization object and hotspots array.
var iniObj = { width: 600, height: 300, moveOnRelease: false, is360: true, speedIndex: 22, slowDownIndex: 4, angleIndex: 60, distortionIndex: 140, useDisplacement: true } var hotSpotObj1 = { id:"door", x:10, y:92 } var hotSpotObj2 = { id:"window", x:230, y:22 } myPanViewer.setImage( "myPanImage.jpg", iniObj, [ hotSpotObj1, hotSpotObj2 ] );
Flash Player 7
myPanViewer.startAutoPan( time:Number, speed_x:Number, speed_y:Number )
Nothing.
Method; Sets auto panning properties.
The following example will cause 360PanViewerPro to start autopanning after 5 seconds of inactivity with horizontal speed of 20 and vertical speed of 10
myPanViewer.startAutoPan( 5, 20, 10 );
Flash Player 7
myPanViewer.stopAutoPan()
Nothing.
Method; Stops auto panning.
The following example will interrupt autopanning.
myPanViewer.stopAutoPan();
Flash Player 7
myPanViewer.createHotSpot( hotSpotObject:Object )
hotSpotObject- object with following properties:
| Property name |
Description |
|---|---|
| width | Number; width of hot spot (Optional) |
height |
Number; height of hot spot (Optional) |
x |
Number; horizontal position of hot spot |
y |
Number; vertical position of hot spot |
name |
String; name of the hot spot (Optional) |
| id | String; library identifier of the hotspot movieclip to use (Optional) |
| color | Number; fill color of the hotspot (Optional) |
| borderColor | Number; border color of the hotspot (Optional) |
| alpha | Number; alpha of the hotspot (Optional) |
In case the object contains an 'id' property, color, borderColor and alpha properties are not considered.
Nothing.
Method; Creates hotspot on current pan image. Execute this method only when pan image exists, or is loaded.
The following example will load pan image and initialize the component according to initialization object and hotspot array
var listener:Object = {};
listener.onLoad = function()
{
var hotSpotObj = {
name:"door",
width:30,
height:100,
color:0xff0000,
alpha:40,
borderColor:0x00ff00,
x:10,
y:92
}
myPanViewer.createHotSpot( hotSpotObj );
}
myPanViewer.addListener( listener );
Flash Player 7
myPanViewer.setPosition( x:Number, y:Number )
x - Number; horizontal position of the pan image
x - Number; vertical position of the pan image
Nothing.
Method; sets the top-left position of pan image
The following example will set pan image coordinates 100, 30 in the top left corner of the component
myPanViewer.setPosition( 100, 30 );
Properties
Flash Player 7
myPanViewer.zoom
Property; Scale percentage of the pan image. You can get and set this value.
The following example will scale image to 110%
myPanViewer.zoom = 110;
The following example will scale image to 10% more of the current value (zoom in)
myPanViewer.zoom += myPanViewer.zoom / 10;
Flash Player 7
myPanViewer.pointer
Property; Reference to the current panViewer mouse pointer movieclip.
The following example will display current frame of the mouse pointer movieclip in the output panel
trace( myPanViewer.pointer._currentframe );
Flash Player 7
myPanViewer.is360
Property; Boolean value indicating if pan image is full 360 degrees image(true) or not(false)
The following example will disable "endless" scrolling of image
myPanViewer.is360 = false;
Flash Player 7
myPanViewer.speedIndex
Property; Number representing the speed of pan movement
The following example will set speedIndex value to 30
myPanViewer.speedIndex = 30;
Flash Player 7
myPanViewer.slowDownIndex
Property; Number representing the speed of slowing down
The following example will set slowDownIndex value to 8
myPanViewer.slowDownIndex = 8;
Flash Player 7
myPanViewer.source
Property; String pointing to the source of pan image. Can be path(URL) of the image(or swf) file, identifier name of the movieclip in the library or path(URL) of the 360PanViewerPro XML file
The following example will load 360PanViewerPro XML file named "pan.xml"
myPanViewer.source = "pan.xml";
The following example will load JPEG image named "myPan.jpg" and use it as pan image
myPanViewer.source = "myPan.jpg";
The following example will use movieclip from the library with identifier name "360pic" for pan image
myPanViewer.source = "360pic";
Events
Flash Player 7
myPanViewer.onProgress = function( percentage:Number ) {};
percentage - Number; percentage of pan image file loaded
Event handler; invoked while pan image is loading.
You must define a function that executes when the event is invoked.
The following example will output percentage of pan image loaded
var listener:Object = {};
listener.onProgress = function( perc:Number ) {
trace( perc + "%" );
}
myPanViewer.addListener( listener );
Flash Player 7
myPanViewer.onMove = function( x:Number, y:Number, p:Number ) {};
x - Number; horizontal position of pan image
y - Number; vertical position of pan image
p - Number; percentage of the image width where center of the viewfield is
Event handler; invoked while pan image is moving
You must define a function that executes when the event is invoked.
The following example will output horizontal and vertical position of pan image
var listener:Object = {};
listener.onMove = function( x:Number, y:Number, p:Number ) {
trace( "x: " + x + ", y: " + y + ", p: " + p );
}
myPanViewer.addListener( listener );
Flash Player 7
myPanViewer.onLoad = function() {};
None;
Event handler; invoked when pan image is loaded
You must define a function that executes when the event is invoked.
The following example will output message when pan image is finished loading
var listener:Object = {};
listener.onLoad = function() {
trace( "Image Loaded!" );
}
myPanViewer.addListener( listener );
Flash Player 7
myPanViewer.onStart = function() {};
None;
Event handler; invoked when panning starts
You must define a function that executes when the event is invoked.
The following example will output message when pan image starts panning
var listener:Object = {};
listener.onStart = function() {
trace( "Panning started!" );
}
myPanViewer.addListener( listener );
Flash Player 7
myPanViewer.onEnd = function() {};
None;
Event handler; invoked when panning ends
You must define a function that executes when the event is invoked.
The following example will output message when pan image stops moving
var listener:Object = {};
listener.onEnd = function() {
trace( "Panning finished!" );
}
myPanViewer.addListener( listener );
Flash Player 7
myPanViewer.onOver = function() {};
None;
Event handler; invoked when mouse is moved over the component
You must define a function that executes when the event is invoked.
The following example will output message when mouse is moved over the component
var listener:Object = {};
listener.onOver = function() {
trace( "Mouse is over!" );
}
myPanViewer.addListener( listener );
Flash Player 7
myPanViewer.onOut = function() {};
None;
Event handler; invoked when mouse is moved out of the component area
You must define a function that executes when the event is invoked.
The following example will output message when mouse is moved out of components area
var listener:Object = {};
listener.onOut = function() {
trace( "Mouse is out!" );
}
myPanViewer.addListener( listener );
Flash Player 7
myPanViewer.onMove = function( x:Number, y:Number ) {};
x - Number; horizontal position of pan image
y - Number; vertical position of pan image
Event handler; invoked while pan image is moving
You must define a function that executes when the event is invoked.
The following example will output horizontal and vertical position of pan image
var listener:Object = {};
listener.onMove = function( x:number, y:Number) {
trace( "x: " + x + ", y: " + y );
}
myPanViewer.addListener( listener );
Flash Player 7
myPanViewer.onStop = function() {};
None;
Event handler; invoked when pan image stops gaining velocity
You must define a function that executes when the event is invoked.
The following example will output message when pan mouse pointer is on "_stop" frame
var listener:Object = {};
listener.onStop = function() {
trace( "_stop frame!" );
}
myPanViewer.addListener( listener );
Flash Player 7
myPanViewer.onEdge = function( direction:String ) {};
direction - String; Can be "left", "right", "top" and "bottom"
Event handler; invoked when pan image reaches the edge while moving
You must define a function that executes when the event is invoked.
The following example will be invoked when edge is reached
var listener:Object = {};
listener.onEdge = function( dir:String ) {
trace( dir );
}
myPanViewer.addListener( listener );
Flash Player 7
myPanViewer.onHotSpot = function( eventName:String, hotSpot:Object ) {};
eventName - String; name of the mouse event. Can be "over", "out", "press" and "release"
hotSpot - Object; hotSpot object that triggered the event
Event handler; invoked when mouse pointer interacts with hot spot
You must define a function that executes when the event is invoked.
The following example will output the name of the hotspot under the mouse pointer
var listener:Object = {};
listener.onHotSpot = function( ev:String, hs:Object ){
if ( ev == "over" ) {
trace( hs.name );
}
}
myPanViewer.addListener( listener );