All of my coding has been through various google searching and other people's examples. I am not sure what this cookbook's approach is. What I did was create my customComponent as an mxml component so I could get the right locations for all of the components needed in the custom Window then I programmed them within its own class file and called the class file.
On 5/9/2011 9:16 AM, Harry L. wrote: > Hi Graham, > > Did you try to use the mxml as a custom component? I got it working > with an AS class file not the the cookbook's approach. It will be so > much easier and open up so many possibilities if we could use mxml to > custom the marker infowindow. > > > Harry > > On May 7, 9:33 am, GPearson <[email protected]> wrote: >> I am not reading information from XML, however I am reading >> information from a Query and passing that information to each marker. >> >> When you have your data you can do >> >> for (var a:uint = 0; a < AvailablePublicSchoolDistricts.length; a++) { >> DistanceFromMarketTower = ((60 * 1.1515) * (180 / Math.PI) * >> (Math.acos((Math.sin(BTARadLatitude) * Math.sin(((Math.PI * >> Number(AvailablePublicSchoolDistricts[a]['SchoolLatitude']))/180))) + >> (Math.cos(BTARadLatitude) * Math.cos(((Math.PI * >> Number(AvailablePublicSchoolDistricts[a]['SchoolLatitude']))/180)) * >> Math.cos(((Math.PI * (BTALongitudeDecimal - >> Number(AvailablePublicSchoolDistricts[a]['SchoolLongitude'])))/ >> 180)))))); >> if (Number(formatDecimals(DistanceFromMarketTower, 3)) < 35) { >> var latlng:LatLng = new >> LatLng(Number(AvailablePublicSchoolDistricts[a]['SchoolLatitude']), >> Number(AvailablePublicSchoolDistricts[a]['SchoolLongitude'])); >> DisplayGoogleMap.addOverlay(CreatePublicSchoolMarker(latlng, >> AvailablePublicSchoolDistricts[a]['NCESSchoolID'], >> AvailablePublicSchoolDistricts[a]['SchoolName'], >> AvailablePublicSchoolDistricts[a]['Address'], >> AvailablePublicSchoolDistricts[a]['City'], >> AvailablePublicSchoolDistricts[a]['State'], >> AvailablePublicSchoolDistricts[a]['ZipCode'], >> AvailablePublicSchoolDistricts[a]['SchoolType'], >> AvailablePublicSchoolDistricts[a]['StateFIPS'], >> AvailablePublicSchoolDistricts[a]['PhoneNumber'])); >> } >> >> } >> >> In my application, I wanted all Public School Districts within 35 >> miles of the marker selected and if it matches then create the marker. >> >> public function CreatePublicSchoolMarker(latlng:LatLng, NCESID:String, >> Name:String, Address:String, City:String, State:String, >> ZipCode:String, SchoolType:String, StateFIPS:String, >> PhoneNumber:String):Marker { >> var markerOptions:MarkerOptions = new MarkerOptions(); >> markerOptions.icon = new PublicSchoolIcon(); >> markerOptions.iconAlignment = MarkerOptions.ALIGN_HORIZONTAL_CENTER; >> markerOptions.hasShadow = true; >> >> // markerOptions.label = Name; >> var marker:Marker = new Marker(latlng, markerOptions); >> >> var options:InfoWindowOptions = new InfoWindowOptions({ >> customContent: new SchoolInformationWindow("School Information", >> NCESID, Name, Address, City, State, ZipCode, PhoneNumber, >> CurrentApplicationVersionNumber) >> }); >> marker.addEventListener(MapMouseEvent.CLICK, function(e:Event):void >> { marker.openInfoWindow(options);}); >> return marker; >> >> } >> >> On May 6, 1:31 pm, "Harry L." <[email protected]> wrote: >> >> >> >> >> >> >> >>> Hi Daniel, >> >>> I couldn't get it to work, some help would be great. I believe others >>> will find it helpful too. Basically, I used the cookbook example and >>> overlay an Xml file. On the example, it says data should be >>> referenced on following event: >> >>> public function >>> onMarkerClick(event:MapMouseEvent):void >>> { >>> // fetch clicked marker >>> var marker:Marker = event.target as Marker; >>> // update any data displayed in info window >>> if needed >> >>> infoWindow.Comp_myDG.dataProvider = marker; >>> // I gave the datagrid >>> on the custom component an id='Comp_myDG' >> >>> // display info window >>> marker.openInfoWindow(new InfoWindowOptions( >>> { >>> width: infoWindow.width, >>> height: infoWindow.height, >>> drawDefaultFrame: true, >>> customContent: infoWindow >>> })); >>> } >> >>> Thanks! >> >>> On May 6, 12:26 pm, Daniel <[email protected]> wrote: >> >>>> Just create your markers in a loop and add the data to the infowindow. >>>> Without looking at it too much, create your component with properties then >>>> as you create the marker load the data into that property. >> >>>> If you need a little more help let me know and I will send you an example >>>> later. Don't have much time right now. >> >>>> On Fri, May 6, 2011 at 8:45 AM, Harry L. <[email protected]> wrote: >>>>> This is a better approach making customization a lot easier. Yet >>>>> getting data to the custom infowindow still is very challenging. I >>>>> wish someone would write a short demo on that, such as reading a xml >>>>> file data to the infowindow when clicking on markers. >> >>>>> On May 6, 9:28 am, Daniel <[email protected]> wrote: >>>>>> That is pretty cool! I made custom content using sprites before but >>>>> making a >>>>>> component seems more logical. >>>>>> On May 6, 2011 6:21 AM, "Harry L." <[email protected]> wrote: >> >>>>>>> Has anyone seen this post? It's really cool! I am still playing with >>>>>>> and couldn't get the xml data loop through and feed it as marker >>>>>>> changes. >> >>>>>>> http://cookbooks.adobe.com/post_Google_Maps_Custom_Info_Window-17492.. >>>>> .. >> >>>>>>> -- >>>>>>> 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. >> >>>>> -- >>>>> 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.-Hide >>>>> quoted text - >> >>> - Show quoted text - > -- 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.
