Using parameters

How to pass parameters to the player

  1. Query string
  2. Flashvars
  3. SWFObject
  4. Additional XML file

Parameters description

  1. Image loader params (panoName, panoSuffixes, image_f, image_r, image_b, image_l, image_u, image_d, loaderTextColor, loaderBackColor, loaderText, loaderTextDenied, loaderTextFailed, loaderAttempts, loaderConsecutive, policyFile, disableLoading)
  2. Visualization params (segments, qualityMotion, qualityStatic, zoomMax, zoomMin, zoomHome, panHome, tiltHome)
  3. Controller params (behaviour, sensitivity, keySensitivity, friction, threshold, keys, disableKeys, disableTilt, disablePan, disableWheel, disableControls)
  4. Plugins loader (layer_N parameter).

How to pass parameters to the player

Query string

Query string format is simple: player_name.swf?param1=value1&param2=value2&param3=value3

Use player name (swf name), then question-mark "?", then all needed parameters divided by ampersand "&"

For example: http://www.flashpanoramas.com/player/test/nature.swf?tiltHome=80&zoomHome=2. This gives a panorama from the simple tutorial with initial point of view in the sky (80 degrees above the horizon) with magnification (zoom factor is 2).

This gives you a possibility to run panoramas without any additional HTML or XML files.

It works as well for HTML code:

<PARAM NAME=movie VALUE="pano.swf?panoName=folder/mypano">

Flashvars

The same as query string but using a special property in OBJECT/EMBED tag:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="550" height="400" id="pano1" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="pano.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="flashvars" value="panHome=180&tiltHome=-20" />
<embed src="pano.swf" quality="high" bgcolor="#ffffff" flashvars="panHome=180&tiltHome=-20" width="550" height="400" name="mymovie" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
</object>

Read more about using Flashvars property here: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16417

SWFObject

More reliable way to embed a Flash movie in html is SWFObject.

It uses a special function addVariable to pass parameters to the Flash movie:

<script type="text/javascript">
var so = new SWFObject("pano.swf", "mypano", "600", "400", "9", "#FFFFFF");
so.addParam("allowFullScreen","true");
so.addParam("allowScriptAccess","sameDomain");
so.addVariable("panoName", "images/pano1");
so.addVariable("sensitivity", "50");
so.addVariable("keySensitivity", "50");
so.write("flashcontent");
</script>

or if you are using Flash version detector plugin:

<script type="text/javascript">
var so = new SWFObject("show_pano.swf", "mypano", "600", "400", "6.0.65", "#FFFFFF");
so.addParam("allowFullScreen","true");
so.addParam("allowScriptAccess","sameDomain");
so.addVariable("movie", "pano.swf");
so.addVariable("panoName", "images/pano1");
so.addVariable("sensitivity", "50");
so.addVariable("keySensitivity", "50");
so.addVariable("redirect", window.location);
so.write("flashcontent");
</script>

Additional XML file

You can create a special file with all parameters you want to pass to the player.

This is the most universal way, works online and offline.

The default name of this file is [player_name].xml. This means that in the example above the player nature.swf tries to load nature.xml data file before it will try to load panorama images. You can set your own name using a special variable xml_file: http://www.flashpanoramas.com/player/test/nature.swf?xml_file=files/test.xml& (note: always use & as a terminating symbol of URL because some browsers fail while processing the URL with ".xml" at the end).

Syntax of the XML file is simple:

<?xml version = '1.0'?>
<panorama>
    <parameters>
        tiltHome=80
        zoomHome=2
    </parameters>
</panorama>

Specify all your parameters between <?xml version = '1.0'?><panorama><parameters> and </parameters></panorama>. Use line feed or ";" as a separator.

To pass additional parameters for Flash Panorama Player plugins, use corresponding tags after <parameters></parameters> tag:

<?xml version="1.0" ?>
<panorama>
    <parameters>
        tiltHome = 80
        zoomHome = 2
        layer_1 = fps.swf
        layer_2 = autorotator.swf
        layer_3 = borders.swf
    </parameters>
    <autorotator>
        speed = -0.1
        interval = 30
        pause = 1000
        quality = low
    </autorotator>
    <borders>
        pan_min = -40
        pan_max = 40
        tilt_min = -10
        tilt_max = 80
    </borders>
</panorama>

Here is a template file with all possible params: template.xml. Remove unused param lines and change values to create your own Flash Panorama Player param file.

Parameters description

Image loader params

panoName sets the panorama name

It's using as an identifier of the panorama. It can contain a path to the panorama (panoName="images/pano/mypano", panoName="../path2/mypano").

Default value is the name of swf file without ".swf" (nature.swf -> nature).

panoSuffixes sets the suffixes to derive image URLs

Can contain from 1 to 6 suffixes (empty suffixes disable image loading).

Example:

panoSuffixes=_0.png|_1.png|_2.png|_3.png|_4.png|_5.png

This will load [panoName]_0.png, [panoName]_1.png and so on.

Defaut panoSuffixes value for pano.swf file is _f.jpg|_l.jpg|_b.jpg|_r.jpg|_u.jpg|_d.jpg

Defaut panoSuffixes value for pano0.swf file is _0.jpg|_1.jpg|_2.jpg|_3.jpg|_4.jpg|_5.jpg

Defaut panoSuffixes value for panoStripe.swf file is .jpg (will load only one picture panoName.jpg, stripe of cube faces).

No more differences between pano.swf, pano0.swf and panoStripe.swf.

image_f sets front side image URL
image_r sets right side image URL
image_b sets back side image URL
image_l sets left side image URL
image_u sets up side image URL
image_d sets down side image URL

This is an alternative way to set image URLs.

Use empty string to disable image loading (image_r=&image_l=&).

Example: image_f=http://mysite/pano/image1.jpg

Default values are calculated from panoName and panoSuffixes params.

loaderTextColor sets the text color for image preloader.

Default value is #FFFFFF (white).

loaderBackColor sets the background color for image preloader

Default value depends on security sandbox of Flash Player. "Remote" mode (Flash Player on a web site) gives gray background #666666, "localWithFile" gives red background #880000, "localWithNetwork" gives yellow #888800, "localTrusted" (inside any exe application) gives green background #008800.

loaderText sets the text template for loader

All special symbols inside the template should be URL-encoded. Use empty string to make the text loader invisible.

Text template can contain variables $0-$7. They will be replaced with actual info during the loading process: $0 - text color (described in loaderTextColor parameter), $1 - loaded for front side image in percents, $2 - loaded for right side, $3 - back, $4 - left, $5 - up, $6 - down, $7 - loaded total for all images.

Default value is <font face='Arial' size='30' color='#$0'>loading: $7</font>. Encoded version looks like: loaderText=%3Cfont%20face%3D%27Arial%27%20size%3D%2730%27%20color%3D%27%23%240%27%3Eloading%3A%20%247%3C%2Ffont%3E

Encode/decoder for loader text is here: http://flashpanoramas.com/player/test/encoder.swf

loaderTextDenied sets the text message if image loading failed

All special symbols inside the message should be URL-encoded.

Default value is failed.

loaderTextFailed sets the text message if image is inaccessible for security reasons

All special symbols inside the message should be URL-encoded.

Default value is denied.

loaderAttempts sets the number of attempts to load an image

It protects the player against incomplete images (slow or overladen server can return "load complete" when only a part of image was loaded). If the image is broken or incomplete, the player will try to reload it once again.

Default value is 3.

loaderConsecutive is used to disable simultaneous image loading

Use loaderConsecutive=1 for XML to make loader to load images one after another.

It's used to reduce the server load.

Default value is 0.

policyFile is used to load the policy file before the images

Use it to place the player file to the one domain and to load panorama images from another one.

Read this document to get to know more about Flash Player 9 security: http://www.adobe.com/devnet/flashplayer/articles/flash_player_9_security.pdf

Default value is empty string (no policy file be loaded).

disableLoading is used to disable image loading at all

Can be used, for example, in Flash application if panorama bitmaps should be generated in some custom way.

Default value is 0.

Visualization params

segments defines the number of pieces for each image

segments=25 means that each image will  be divided into 25*25=625 pieces (6*625=3750 polygons for panorama in total) which could be rotated in 3D space.

This param determine the quality of the panorama rendering (the more pieces the image is divided, the better quality the panorama is).

On the other hand this parameter affects to panorama rotation speed and smoothness.

segments=10 provides low interpolation quality (straight lines on the panorama may look wavy) but it requires less processor power and therefore it produces a fast and smooth rotation even for slow and old computers.

segments=20 provides good interpolation quality and smooth enough motion.

segments=30 provides the best image quality, use it for quality and fullscreen panoramas. Can be slow for weak computers.

Default value is 20. Minimal value is 10.

qualityMotion determines the antialiasing value when user drags the panorama
qualityStatic determines the antialiasing value if user does not move the panorama

Possible values: low (no antialiasing), medium, high and best (maximal smoothing).

Use qualityMotion=low to make the panorama motion quick and smooth, use qualityStatic=medium to avoid cogged lines in the static position, use qualityStatic=high or best for big and quality panoramas with many small details.

Default value for qualityStatic is medium; default value for qualityMotion is low.

zoomMax sets the maximum value of the zoom factor

Default value is 2. Minimal value is 0.45.

zoomMin set the minimal value of the zoom factor

Default value is 0.45. Minimal value is 0.45.

zoomHome sets an initial value of the zoom factor

This param is applied to zoom factor at start or when the key "Home" is pressed.

The param value should be inside the interval [zoomMin, zoomMax].

Default value is 1. Minimal value is 0.45.

panHome sets an initial value of the pan factor

This param is applied to the panorama position at start or when the key "Home" is pressed.

The value is set in degrees. panHome=90 means that the initial point of view is towards the center of the right side of the cube.

Default value is 0. Possible values: [0, 360].

tiltHome sets an initial value of the tilt factor

This param is applied to the panorama position at start or when the key "Home" is pressed.

The value is set in degrees. tiltHome=50 means the initial point of view is towards 50 degrees above the horizon.

Default value is 0. Possible values: [-90, 90].

Controller params

behaviour determines how panorama interacts with the mouse movements

behaviour=0 means you can simply drag your panorama,

behaviour=1 gives a smooth motion when the user holds and shifts your mouse,

behaviour=2 provides a smooth motion with inertia effects. Inertia effects apply to all keyboards movements as well.

Use behaviour=-1 to disable any interaction.

Default value is 2.

sensitivity sets the mouse sensitivity

Default value is 10 (slow and smooth movement).

keySensitivity sets the sensitivity for keyboard movement

Default value is 10 (slow and smooth movement).

friction sets the coefficient of deceleration for panorama motion (works together with behaviour=2)

friction=1 prevents any inertia effects.

friction=0 means no friction, move panorama once and it will move infinitely.

Default value is 0.9.

threshold sets the threshold of motion speed (works together with behaviour=2)

This parameter determine the order of values when motion calculations stops and panorama goes to the static mode.

Default value is 0.0000001.

keys can change the keyboard codes for active buttons

Use "|" to separate code numbers. order of codes is: "right key|left key|up key|down key|zoom in key|zoom out key||home key|hold key".

Default value is 39|37|38|40|16|17|36|32.

disableKeys is used to disable the keyboard events

Use disableKeys=1 if you want to disable the keyboard support.

Default value is 0.

disableTilt is used to forbid to tilt the panorama

Use disableTilt=1 if you want to restrict the panorama vertical rotation.

Default value is 0.

disablePan is used to forbid to panning the panorama

Use disablePan=1 if you want to restrict the panorama horizontal rotation.

Default value is 0.

disableWheel is used to disable the mouse wheel for zoom navigation

Use disableWheel=1 if you want to disable the mouse wheel actions.

Default value is 0.

disableControls is used to disable mouse and keyboard interaction with a panorama

Use disableControls=1 to deactivate both mouse and keyboard.

Default value is 0.

Plugins loader

layer_1, layer_2, layer_3 and so on are used for loading of external modules

Any number of external plugins can be attached to the panorama. Read Using plugins tutorial to learn more about this technique.

Example: layer_1=autorotator.swf

Plugin with the greater layer number appears higher in the player window.

Example 1. This content requires Adobe Flash Player.
Example 2. This content requires Adobe Flash Player.

Copyright © 2006 flashpanoramas.com. All rights reserved.