Hi Sergiu,
Your in luck I have a couple of minutes to wait for this download of
VS 2010 :). AS3 could definitely be scary without any programming
background, I come from the world of Java so with regard to creating
cool visuals/interfaces AS3 is a refreshing change.
You'll need a little understanding of the HTTPService in AS3 to make
this work, so I can better help you can you describe your development
tools and expected deployment environment, something like: I work on
a PC in Flex and will be deploying to a linux server, whatever info
you can provide may end up helping don't worry if you don't know what
one of those things are that I listed just give whatever info you can.
Basically you need to make a http service object then use it to make
the request to get the XML then step through the XML and add your
markers. To get you started on the HTTP request (this is easier than
it all sounds):
import mx.rpc.http.HTTPService;
//in the constructor
var myServiceObject:HTTPService = new HTTPService();
myServiceObject.url = "xmlFiles/myXMLFile.xml"; //could use the full
path here this is a relative path assumes relative to the swf file
where to go (in this case a folder called xmlFiles would have a file
called myXMLFile.xml in it
myServiceObject.addEventListener(ResultEvent.RESULT, myResultHandler);
myServiceObject.addEventListener(FaultEvent.FAULT, myFaultHandler);
myServiceObject.send();
//defined outside the constructor
private function myResultHandler(event:ResultEvent):void
{
trace(event.result);
}
private function myFaultHandler(event:FaultEvent):void
{
trace(event.fault);
}
These lines say create an object, set the URL on that object, add a
listener for when results come back from that object and send a
request using that object (to the URL specified previously), when the
response comes back (in this case the response is just going to be the
contents of your XML file) you can step through them and plot them...
let me know if you get anywhere with this or if you get hung up at
what point and I'll try to help you along, depending on if I get some
time I'll see if I can just throw this together as an example for you
but I'm not sure that I'll have the time.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/rpc/http/HTTPService.html
basically after doing this though you should be able to see the trace
output if you run the swf in debug mode in the result handler you'll
make a loop instead of the trace statement and the loop will use
event.result..region as the collection to step across, each object (or
xml node) in that collection has the lat/lng needed to create a
marker.
Good luck,
Shaun
Post back if you need more guidance.
On Dec 21, 6:43 am, Sergiu Dragomir <[email protected]> wrote:
> Hey guys.
>
> I find myself in a bit of a tight spot here. I promised someone I'll help
> with a map but now i'm stuck. I'm stuck cuz i have rather basic knowledge of
> Flash AS2 code and AS3 looks damn straight scary to me:)
>
> Now what i need is a map that has several markers on it. I want simple not
> custom markers. The markers will need to display a box with some info. I
> need to get the info and coordinates from an XML file.
>
> The XML file looks like this:
>
> <region name="City1" latitude="42.351794" longitude="11.606816" zoom="8">
> <marker name="Location1" longitude="42.350823" latitude="11.606277"
> description="Something someting Dark Side" pinLink="link.com" />
> <marker name="Location2" longitude="42.351596" latitude="11.6075"
> description="Something someting Dark Side" pinLink="link.com" />
> </region>
>
> <region name="City2" zoom="8" latitude="42.326448" longitude="11.589307"
> zoom="8">
> <pin name="Location3" longitude="42.324946" latitude="11.588096"
> description="Something someting Dark Side" pinLink="link.com" />
> <pin name="Location4" longitude="42.324082" latitude="11.587216"
> description="Something someting Dark Side" pinLink="link.com" />
> </region>
>
> I successfuly completed the google maps tutorials and i have a working map.
> But that map has all the information embedded in the flash code. I need to
> get the information from the XML
>
> I need the map to display all the "Pin" Markers from the XML, and when
> clicked, the Pins have to display the Message box with the Name, Description
> and Link
>
> Another thing i need it to do, is to have a couple of buttons for Cities
> that jumps to the city coordinates.
>
> It looks so easy when i look at examples but i can't get it to work for the
> very life of me.
>
> Please help ( if you would be so kind as to explain step by step it would be
> awesome)
>
> Thanks in advance.
--
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.