PanoSalado public functionsThis is description of public functions defined in "PanoSalado.as". It contains lists of avaible arguments for each function and examples of their usage. This page covers descriptions of r136 release (Feb 10, 2009), older releases may alter slighlty. List of PanoSalado public functionsCalling PanoSalado public functionsFunctions of PanoSalado can be called in two ways: import flash.system.ApplicationDomain;
import flash.utils.Dictionary;
[...]
var panoSalado:Object;
var PanoSalado:Class;
var ModuleLoader:Class;
var layerByName:Dictionary;
PanoSalado = ApplicationDomain.currentDomain.getDefinition("PanoSalado") as Class;
ModuleLoader = ApplicationDomain.currentDomain.getDefinition("ModuleLoader") as Class;
moduleLoader = ModuleLoader(this.root.parent); // for example
layerByName = Dictionary(moduleLoader["layerByName"]);
panoSalado = PanoSalado(layerByName["PanoSalado"]);
var targetSpace="concert1"
// Use same syntax as in calling form xml file
panoSalado.execute("loadSpace:" + targetSpace);
// Or call function directly
panoSalado.loadSpace(targetSpace);From xml file (as pseudo-function) <hotspot [...]>
[...]
onClick="loadSpace:concert1"
</hotspot> Calling functions from code in above way requires calling file to be set as "layer" in *.xml file. As for calling from *.xml file, values of atrributes need to be in specific form. Special chars are colon [ : ] , comma[ , ] and semicolon [ ; ] Semicolon separates functions (spaces between functions allowed), colon separates function name from its arguments (no space between them allowed) and comma separates arguments of specific function (no spaces between function arguments allowed). PanoSalado defines arguments of some xml nodes, which values (here refered as "function") are processed after mouse interaction with objects on scene (here refered as "interaction"). [interaction] = [function]
[interaction] = onClick | onOver | onOut | onPress | onRelease | onMouseMove
[function] = [a]:[b]; | [c];
[a] = loadSpace | tween | tweenXML | change | removeLastSpace | dispatchBroadcast | keyUp | keyDown | toggleFullscreen | toggleAutorotator
[b] = strings separeted with comas as function arguments
[c] = if argument is inside "space" parent node, then calling it doesnt require specifing "id" of the space
[c] = [c1].[c2]
[c1]= otherwise "id" value of specific xml node (e.g. hotspot)
[c2]= name of argument in this node, which value will be executed as pseudo-function
Many function can be called one after another, they need to be separated by semicolon [ ; ]. Only Exception is tween function that uses "then do" for calling function after tween is finished. Currently "then do" is supportet only in syntax of deprciated "tween" function, in any other case the ony valid separator is semicolon. As for stucture described above as [c1].[c2], called argument doesn't have to be in the same node.
<space [...]
spaceFunction1="spaceFunction2"
spaceFunction2="hotspot1.hotspotFunction2"
[...]
>
[...]
<hotspot id="hotspot1"
[...]
onClick="hotspot1.hotspotFunction1"
hotspotFunction1="spaceFunction1"
hotspotFunction2="loadSpace:concert1; removeLastSpace"
[...]
</hotspot>
</space>
<space [...]>
[...]
<hotspot id="hotspot2"
[...]
onClick="tween:allCameras.alpha to 0 over 3 seconds using Linear.easeIn then do hotspot2.afterTweenFinished;
hotspot2.beforeTweenFinished"
afterTweenFinished="removeLastSpace"
beforeTweenFinished="toggleAutorotator; dispatchBroadcast:myCystomEvent,arg1=value1,arg2=value2"
>
[...]
</hotspot>
</space> PanoSalado public functions brief:
loadSpace
loadSpace:[a];
[a] = "id" value of space specified in *.xml file
onClick="loadSpace:concert1" example source: panoSalado.loadSpace("concert1");
tween
tween:[a] [b] [c] over [d] seconds using [e] then do [f];
[a] = [a1].[a2]
[a1] = allCameras | allViewports | "id" value of any node representing 3d object
[a2] = property
allCameras
property = x | y | z | rotationX | rotationY | rotationZ | zoom | focus
allViewports
property = x | y | scaleX | scaleY | height | width | alpha | rotation
"id" value of hotspot node
property = x | y | z | rotationX | rotationY | rotationZ | alpha
"id" value of cube, sphere, ect. node
property = x | y | z | rotationX | rotationY | rotationZ
[a] = [a1].[a2].[a3]
[a1] = lastSpace | currentSpace | loadingSpace | "id" value of specific space node
[a2] = viewport | camera
[a3] = property
viewport
property = x | y | scaleX | scaleY | height | width | alpha | rotation
camera
property = x | y | z | rotationX | rotationY | rotationZ | zoom | focus
[b] = from | to
[c] = target property value
[d] = duration time in seconds
[e] = [e1].[e2]
[e1] = Back | Bounce | Circ | Cubic | Elastic | Expo | Linear | Quad | Quart | Quint | Sine
[e2] = easeIn | easeOut | easeInOut
[f] = xml argument described in Calling PanoSalado public functions as [c]
Default tween value called where left with epmty value: "currentSpace.viewport.alpha from 0 over 1.5 seconds using Expo.easeIn"
There is difference between appending another function after semicolon [ ; ] and using "then do": The second one waits for the tween to be complete (see example in Calling PanoSalado public functions)
Be very accurate with spaces or command won't be parsed correctly. Tween is depreciated, try using tweenXML instead. Preview of behaviour of [e] can be viewed at blog.greensock.com/tweenliteas3/
<hotspot id="hotspot3"
[...]
onClick="tween:hotspot3.rotationX to 30 over 3 seconds using Linear.easeIn then do hotspot3.tween3; hotspot3.tween2"
tween2="tween:allViewports.rotation to 90 over 3 seconds using Linear.easeIn"
tween3="tween:currentSpace.camera.alpha to 0.5 over 3 seconds using Linear.easeIn"
>
[...]
</hotspot>examples source: panoSalado.tween("allViewports.alpha to 0.5 over 3 seconds using Linear.easeIn then do hotspot3.tween3");
tweenXML
tweenXML:[a];
[a] = "id" of specified node, that contains attributes defining tween. Those attributes are:
target = same as [a] in tween
property = same as [a] in tween
direction = from | to
endValue = end value of the specified property
time = duration time in seconds
easeClass = Back | Bounce | Circ | Cubic | Elastic | Expo | Linear | Quad | Quart | Quint | Sine
easeFunction = easeIn | easeOut | easeInOut
onComplete = [c1].[c2]
[c1]= "id" value of specific xml node
[c2]= name of argument in this node, which value will be executed.
Node tweenXML need to be placed in the *.xml file, after spaces node, preferable wrapped with <tweens> node. Tween nodes are identyfied by "id" values, so they can have any name, but most convenient is name <tween/>
[...]
<spaces [...]>
<space [...]>
[...]
<hotspot id="hotspot4"
[...]
onClick="tweenXML:xmlTween1"
somethingElse="toggleFullscreen"
/>
[...]
</hotspot>
</space>
</spaces>
<tweens>
<tween id="xmlTween1"
target="currentSpace.viewport"
property="alpha"
direction="to"
endValue="0"
time="3"
easeClass="Expo"
easeFunction="easeInOut"
onComplete="hotspot4.somethingElse"
/>
</tweens>example source: panoSalado.tweenXML("xmlTween1");
change
change:[a]=[b];
[a] = [a1].[a2]
[a1] = "id" value of node representing 3d object, like hotspot, sphere, cube, ect.
[a2] = x | y | z | rotationX | rotationY | rotationZ | alpha
[b] = target value
Using this couses rerendering of scene, so applied changes are instantly visible. There can be any numbers of pairs [a]=[b] separeted byc commas.
onClick="change:hotspot1.x=2000,hotspot1.rotationX=45" example source: panoSalado.change("hotspot1.x=2000", "hotspot1.rotationX=45");
removeLastSpace
Takes no arguments. Removes last leaved space, so it would not bloat entire application. It should be called after tween or tweenXML has finished animation for changing spaces.
onClick="removeLastSpace" example source: panoSalado.removeLastSpace();
dispatchBroadcast
dispatchBroadcast:[a],[b];
[a] = Name of your custom event.
[b] = Any number of pairs paramName=paramValue seperated by comas.
Name of your custom event can be defined as static constant value in zephyr.BroadcastEvent for more convinience.
onClick="dispatchBroadcast:myEvent,param1=hello,param2=cruel,param3=world" example source: panoSalado.dispatchBroadcast("myEvent", "param1=hello,param2=cruel,param3=world");
// or it can be dispatched directly form ModuleLoader
moduleLoader.dispatchEvent(new BroadcastEvent("myEvent", { param1:"hello", param2:"cruel", param3:"world" } ) );
// then events can be got by referring to moduleloader
moduleLoader.addEventListener("myEvent", myFunction, false, 0, true);
keyDown
keyDown:[a];
[a] = up | down | left | right | shift | control
Argument values are not case sensitive. Shift stays for zoom in, control for zoom out.
onOver:"keyDown:up" example source: panoSalado.keyDown("up");
keyUp
keyUp:[a];
[a] = up | down | left | right | shift | control
Argument values are not case sensitive. Shift stays for zoom in, control for zoom out.
onOver:"keyUp:up" example source: panoSalado.keyUp("up");
toggleFullscreen
It takes no arguments, it is called for entering/exiting fullscreen mode.
onClick="toggleFullscreen" example source: panoSalado.toggleFullscreen();
toggleAutorotator
It takes no arguments, it is called for starting/stopping autorotation.
onClick="toggleAutorotator" example source: panoSalado.toggleAutorotator();
|