PDA

View Full Version : Execute xml function inside swf plugin


Vincent Ogloblinsky
11-02-2008, 03:02 PM
Hi all,

I try to develop a special plugi for FPP using UMAP component.

I can easily show my map using a special function in my plugin and in my xml file:

<spot id="btn_map" visible="1" alpha="1" url="images/black_a.png" pan="50" tilt="15" onClick="load_map()" />
load_map = "
pano.blur=25,500;
blurQuality=5,500;
pano.pan=0,1000;
pano.tilt=0,1000;
pano.disableControls=0;

"

hotspots.addEventListener(MouseEvent.CLICK, doClick, false, 0, true);
function doClick (event:Event) {
// find object with property "attributes" (all hotspots has this object)
var obj:Object = event.target;
while (!obj.hasOwnProperty("attributes")) {
if (obj.hasOwnProperty("parent")) {
obj = obj.parent;
} else {
return;
}
}
// try to get propery alt (stored in XML: <spot url="1.jpg" alt="My Picture" />)
var id:String = obj.attributes.getParam("id");
if (id == "btn_map")
{
trace("yeahh");
sprite.alpha = 1;
umap.visible = true;
addChildAt(umap,this.numChildren);

}
}


I had near the map a close button, i attach it a eventlistener:

sprite.addEventListener(MouseEvent.CLICK, closemap);
function closemap(event:MouseEvent) {
trace("closemap");
panoController.externals.hotspots.executeFunction("closem");
}

And the closem funstion is inside my xml file and is here to close it:

closem = "
pano.blur=0,500;
blurQuality=0,500;
pano.pan=50,1000;
pano.tilt=0,1000;
pano.disableControls=0;
"

but it seems to doesn't work, i get a "Unrecognized object: " error for getting my function.

Vincent Ogloblinsky
11-03-2008, 01:27 PM
Ok, i found the solution by doing reverse engineering on hotspots.swf

just simply do this:

panoController.externals.hotspots.executeFunction("global.closem");