Archive for Everything

Could this be the Grail I’ve been looking for?

I googled “touch sprite google map api” and found a lovely thread with this comment that made my eyes light up:

[T]he marker icon can be any DisplayObject.  create a DisplayObject of your choice and tell Google Maps to use that as the marker icon through MarkerOptions.  In your new DisplayObject set up the touch events and you should be good to go.

Could this be it?? I’ll try it and let you know!

Comments off

Apparently LinkedIn really is good for something!

I got my LinkedIn update yesterday and saw my friend PDR had posted a link to his blog. Brilliant! I thought. What a perfect way to advertise a new blog to other developers and maybe get some help. So I added this blog to my profile yesterday, and already I’m getting help from a colleague who–get this–sits right next to me, that I didn’t know knew AS3.

Yay, help!

Comments off

oh good god (more about Markers)

It’s never going to work, I swear.

My problem seems to be in my lack of understanding how the google map api and the touchsprites work together. The markers need to be added to the map with addOverlay, but to be clickable they need to be touchsprites. Guess what doesn’t accept a touchsprite as an argument? Yeah, that’d be addOverlay.

Just kill me.

I gave the code to T in the hopes that a fresh eye will be able to make better sense of it. Four weeks and counting to when this hellish app needs to be in review.

Comments (2)

I hate clickable markers

I went back to the previous iteration of code, and put my marker into a TouchSprite:

for (var i:int = 0; i < lat.length; i++) {
    var newLat:Number=lat[i];
    var newLng:Number=lon[i];
    var temp:Number=i;
    var touchMarker:TouchSprite = new TouchSprite();
    var museumMarker:Marker = new Marker(
     new LatLng(newLat, newLng),
     new MarkerOptions({
          // label:  museums[i]
     })
    );
    map.addOverlay(touchMarker);
    touchMarker.addChild(museumMarker);
    touchMarker.addEventListener(TouchEvent.TOUCH_DOWN, this.openMarkerLabel, false, 0, true);
    
   }

Now I’m getting the following errors:

1067: Implicit coercion of a value of type id.core:TouchSprite to an unrelated type com.google.maps.interfaces:IOverlay.
1067: Implicit coercion of a value of type com.google.maps.overlays:Marker to an unrelated type flash.display:DisplayObject.

*head desk*
*head desk*
*head desk*

I just want to get one thing working today. I originally wanted two, but I’ll take one at this point.

Comments off

Still working on Clickable Markers

So, it turns out I was wrong. After much digging in the sample files sent by Ideum, I finally found where they declare the markers as TouchSprites. D’oh!

Off I go to try to work that into my function, which now looks something like this:

  private function onMapReady(event:MapEvent):void {
   lat=new Array(“34.056415″,”34.059065″,”34.01583″,”34.0729″,”33.763479”);
   lon=new Array(“-117.750086″,”-118.443755″,”-118.283498″,”-118.4414″,”-118.164778″);
   museums=new Array(“museum1″,”museum2″,”museum3″,”museum4″,”museum5”);
   //map.enableScrollWheelZoom();
   //map.crosshairsEnabled();
   //map.enableContinuousZoom();

   for (var i:int = 0; i < lat.length; i++) {
    var newLat:Number=lat[i];
    var newLng:Number=lon[i];
    var lat_long:LatLng = new LatLng(lat[i],lon[i]);
    var point:Point = map.fromLatLngToViewport(lat_long);
    
    var temp:Number=i;
    
    var marker:CustomMarker = new CustomMarker(i);
    this.addChild(marker);
    marker.x = point.x;
    marker.y = point.y;
    marker.visible = false;
    
    markerArray.push(marker);
    markerLL.push(lat_long);
    
    var mediaPoint:Point = new Point(point.x,point.y);
    mediaPos.push(mediaPoint);
    
    markerArray[i].name=i;
    markerArray[i].addEventListener(TouchEvent.TOUCH_DOWN, openMarkerLabel, false, 0, true);
    
    if (i+1==lat.length) {
     map_holder.addEventListener(TouchEvent.TOUCH_DOWN, touchDownHandler);
     map_holder.addEventListener(TouchEvent.TOUCH_UP, touchUpHandler);
    }
    /*var museumMarker:Marker = new Marker(
     new LatLng(newLat, newLng),
     new MarkerOptions({
          // label:  museums[i]
     })
    );*/
    /*museumMarker.addEventListener(TouchEvent.TOUCH_DOWN, this.openMarkerLabel, false, 0, true);*/
    //map.addOverlay(museumMarker);
   }
   map.removeEventListener(MapEvent.MAP_READY, onMapReady);
  }

Hoo-rah!

Comments off

« Newer Posts · Older Posts »