ActionScript Reference

Methods

360PanViewerPro.setImage

Availability

Flash Player 7

Usage

myPanViewer.setImage( imgPath:String, [iniObj:Object, [hotSpots:Array]] )

Parameters

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

Returns

Nothing.

Description

Method; Sets the pan image. This method is executed also when the source property is set.

Example

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 ] );

 

 

360PanViewerPro.startAutoPan

Availability

Flash Player 7

Usage

myPanViewer.startAutoPan( time:Number, speed_x:Number, speed_y:Number )  

Parameters

time - Number of seconds to wait before autopanning starts
speed_x - Horizontal speed factor of autopanning
speed_y - Vertical speed factor of autopanning

Returns

Nothing.

Description

Method; Sets auto panning properties.

Example

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 );

 

 

360PanViewerPro.stopAutoPan

Availability

Flash Player 7

Usage

myPanViewer.stopAutoPan()  

Parameters

None.

Returns

Nothing.

Description

Method; Stops auto panning.

Example

The following example will interrupt autopanning.

myPanViewer.stopAutoPan();

 

 

360PanViewerPro.createHotSpot

Availability

Flash Player 7

Usage

myPanViewer.createHotSpot( hotSpotObject:Object )  

Parameters

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.

Returns

Nothing.

Description

Method; Creates hotspot on current pan image. Execute this method only when pan image exists, or is loaded.

Example

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 );

 

 

360PanViewerPro.setPosition

Availability

Flash Player 7

Usage

myPanViewer.setPosition( x:Number, y:Number )  

Parameters

x - Number; horizontal position of the pan image

x - Number; vertical position of the pan image

Returns

Nothing.

Description

Method; sets the top-left position of pan image

Example

The following example will set pan image coordinates 100, 30 in the top left corner of the component

myPanViewer.setPosition( 100, 30 );

 

 

Properties

360PanViewerPro.zoom

Availability

Flash Player 7

Usage

myPanViewer.zoom

Description

Property; Scale percentage of the pan image. You can get and set this value.

Example

The following example will scale image to 110%

myPanViewer.zoom = 110;

Example 2

The following example will scale image to 10% more of the current value (zoom in)

myPanViewer.zoom += myPanViewer.zoom / 10;

 

 

360PanViewerPro.pointer

Availability

Flash Player 7

Usage

myPanViewer.pointer

Description

Property; Reference to the current panViewer mouse pointer movieclip.

Example

The following example will display current frame of the mouse pointer movieclip in the output panel

trace( myPanViewer.pointer._currentframe );

 

 

360PanViewerPro.is360

Availability

Flash Player 7

Usage

myPanViewer.is360

Description

Property; Boolean value indicating if pan image is full 360 degrees image(true) or not(false)

Example

The following example will disable "endless" scrolling of image

myPanViewer.is360 = false;

 

 

360PanViewerPro.speedIndex

Availability

Flash Player 7

Usage

myPanViewer.speedIndex

Description

Property; Number representing the speed of pan movement

Example

The following example will set speedIndex value to 30

myPanViewer.speedIndex = 30;

 

 

360PanViewerPro.slowDownIndex

Availability

Flash Player 7

Usage

myPanViewer.slowDownIndex

Description

Property; Number representing the speed of slowing down

Example

The following example will set slowDownIndex value to 8

myPanViewer.slowDownIndex = 8;

 

 

360PanViewerPro.source

Availability

Flash Player 7

Usage

myPanViewer.source

Description

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

Example

The following example will load 360PanViewerPro XML file named "pan.xml"

myPanViewer.source = "pan.xml";

Example 2

The following example will load JPEG image named "myPan.jpg" and use it as pan image

myPanViewer.source = "myPan.jpg";

Example 3

The following example will use movieclip from the library with identifier name "360pic" for pan image

myPanViewer.source = "360pic";

 

 

Events

360PanViewerPro.onProgress

Availability

Flash Player 7

Usage

myPanViewer.onProgress = function( percentage:Number ) {};  

Parameters

percentage - Number; percentage of pan image file loaded

Description

Event handler; invoked while pan image is loading.
You must define a function that executes when the event is invoked.

Example

The following example will output percentage of pan image loaded

var listener:Object = {};  
listener.onProgress = function( perc:Number )  {
  	trace( perc + "%" );
}  
myPanViewer.addListener( listener );

 

 

360PanViewerPro.onMove

Availability

Flash Player 7

Usage

myPanViewer.onMove = function( x:Number, y:Number, p:Number ) {};  

Parameters

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

Description

Event handler; invoked while pan image is moving
You must define a function that executes when the event is invoked.

Example

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 );

 

 

360PanViewerPro.onLoad

Availability

Flash Player 7

Usage

myPanViewer.onLoad = function() {};  

Parameters

None;

Description

Event handler; invoked when pan image is loaded
You must define a function that executes when the event is invoked.

Example

The following example will output message when pan image is finished loading

var listener:Object = {};  
listener.onLoad = function()  {
  	trace( "Image Loaded!" );
}  
myPanViewer.addListener( listener );

 

 

360PanViewerPro.onStart

Availability

Flash Player 7

Usage

myPanViewer.onStart = function() {};  

Parameters

None;

Description

Event handler; invoked when panning starts
You must define a function that executes when the event is invoked.

Example

The following example will output message when pan image starts panning

var listener:Object = {};  
listener.onStart = function()  {
  	trace( "Panning started!" );
}  
myPanViewer.addListener( listener );

 

 

360PanViewerPro.onEnd

Availability

Flash Player 7

Usage

myPanViewer.onEnd = function() {};  

Parameters

None;

Description

Event handler; invoked when panning ends
You must define a function that executes when the event is invoked.

Example

The following example will output message when pan image stops moving

var listener:Object = {};  
listener.onEnd = function()  {
  	trace( "Panning finished!" );
}  
myPanViewer.addListener( listener );

 

 

360PanViewerPro.onOver

Availability

Flash Player 7

Usage

myPanViewer.onOver = function() {};  

Parameters

None;

Description

Event handler; invoked when mouse is moved over the component
You must define a function that executes when the event is invoked.

Example

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 );

 

 

360PanViewerPro.onOut

Availability

Flash Player 7

Usage

myPanViewer.onOut = function() {};  

Parameters

None;

Description

Event handler; invoked when mouse is moved out of the component area
You must define a function that executes when the event is invoked.

Example

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 );

 

 

360PanViewerPro.onMove

Availability

Flash Player 7

Usage

myPanViewer.onMove = function( x:Number, y:Number ) {};  

Parameters

x - Number; horizontal position of pan image
y - Number; vertical position of pan image

Description

Event handler; invoked while pan image is moving
You must define a function that executes when the event is invoked.

Example

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 );

 

 

360PanViewerPro.onStop

Availability

Flash Player 7

Usage

myPanViewer.onStop = function() {};  

Parameters

None;

Description

Event handler; invoked when pan image stops gaining velocity
You must define a function that executes when the event is invoked.

Example

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 );

 

 

360PanViewerPro.onEdge

Availability

Flash Player 7

Usage

myPanViewer.onEdge = function( direction:String ) {};  

Parameters

direction - String; Can be "left", "right", "top" and "bottom"

Description

Event handler; invoked when pan image reaches the edge while moving
You must define a function that executes when the event is invoked.

Example

The following example will be invoked when edge is reached

var listener:Object = {};
listener.onEdge = function( dir:String )  {
  	trace( dir );
}
myPanViewer.addListener( listener );

 

 

360PanViewerPro.onHotSpot

Availability

Flash Player 7

Usage

myPanViewer.onHotSpot = function( eventName:String, hotSpot:Object ) {};  

Parameters

eventName - String; name of the mouse event. Can be "over", "out", "press" and "release"
hotSpot - Object; hotSpot object that triggered the event

Description

Event handler; invoked when mouse pointer interacts with hot spot
You must define a function that executes when the event is invoked.

Example

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 );