Please help, i'm stuck with this. I want to make function that adds
polygon from XML and RETURNS POLYGON OBJECT
(specPoly=makePolygonFromXML("data/xml/Opcine/desinic.xml",
0xfab000,0.3,2)
so I can reference it later to hide it or remove it, or use it in a
loop as an array of polygons.
function makePolygonFromXML works, it makes a polygon from XML file
but it doesn't return the polygon specified
in function call, specPoly.hide() method doesn't work and all code
after this method doesn't execute.
Any help would be much appreciated.
Tnx in advance.
here is the code:
private var specPoly:Polygon //global variable
specPoly=makePolygonFromXML("data/xml/Opcine/desinic.xml",
0xfab000,0.3,2) //works
specPoly.hide() //doesnt'work
private function
makePolygonFromXML(xmlFile:String,col:Number,al:Number,wid:Number):Polygon
{
var polygon:Polygon
polygonLoader = new URLLoader()
polygonLoader.addEventListener(Event.COMPLETE,
function(event:Event):void {
var xmlCont:XML=new XML(polygonLoader.data);
var points:Array = new Array;
for each (var location:XML in xmlCont..*)
{
var LLfromXML:LatLng = new
LatLng([EMAIL PROTECTED],
[EMAIL PROTECTED]);
points.push (LLfromXML)
}
var polygonOptions:PolygonOptions= new
PolygonOptions
var fillStyle:FillStyle = new FillStyle;
fillStyle.alpha = al;
fillStyle.color = col;
polygonOptions.fillStyle = fillStyle;
var strokeStyle:StrokeStyle = new StrokeStyle;
strokeStyle.thickness=wid
strokeStyle.color = 0x000000;
strokeStyle.alpha=1
polygonOptions.strokeStyle = strokeStyle
var polygon = new Polygon (points,
polygonOptions)
gMap.addOverlay(polygon);
})
var request:URLRequest=new URLRequest(xmlFile)
try
{
polygonLoader.load(request);
}
catch(error:Error)
{
}
return polygon
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API For Flash" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---