Posts Tagged touchsprite

Kill the drag

Things have been moving right along on our little project. We’re in the final inning, though, as it ‘goes live’ on Monday, and we’re still developing. (Review process? We don’t need no stinking review process!)

Our current ‘unsolveable’ project has been making a touchsprite NOT be draggable. We need it touchable, or in some cases we need its children to be touchable, but when it is (touchable, that is), it drags, and we can’t turn that property off. (Yes, we’ve tried stopTouchDrag(), and no, it doesn’t work.)

This means that our pretty navigation orb opens a pretty nav window that, instead of sticking with the nav orb, can be dragged away and left out in the cold*. And that’s just one example.

If you know how we can make it stop, please please please speak up!

*It’s no longer left in the cold, as we have code that snaps it back to its original position, but we don’t want it to ever leave its original position!

Comments off

We’re a little closer

T googled ‘converting variables in as3’ and figured out that we were extending the class as an Application instead of as a  TouchSprite! We think this is key, except the TouchSprite class doesn’t work as the main app class. But now that I’ve separated the two so the main app class calls the TouchSprite class, I’m getting the dreaded Error #1009: Cannot access a property or method of a null object reference.

ARGGGGHHHHHH!

I’ve been looking for the premature call for over an hour and so far haven’t found a damned thing. Sometimes I really hate Flash. Would it have killed them to give a line number with that error??

ETA: Yeah, this wasn’t the problem. We had to stop using the Marker() class provided by google and create custom markers that we then placed manually on the map. Live and learn!

Comments off

Just kill me now

Using a function I found in Ideum’s files, I was able to create custom markers that appear where I want. Woo! And yet? Still not clickable.

W! T! F!

Here’s the function:

  private function createMarker(imgURL,lat,lng,Name,desc,j):void { 
   var markerHolder:TouchSprite = new TouchSprite();
   var options:MarkerOptions = new MarkerOptions({icon:new Triangle()});
   var marker=new MapMarker(lat,lng,options);
   marker.imageUrl=imgURL;
   marker.imageTitle=Name;
   marker.imageDescription=desc;
   map.addOverlay(marker);
   marker.addEventListener(MapMouseEvent.CLICK, markerClicked);
  }

It’s straight from their own code! And yet, notice how they declare a TouchSprite, but never actually use it. WUWT? And that’s exactly the piece we can’t seem to figure out–how the mapmarkers become TouchSprites and still get recognized by the map as mapmarkers.

So, day 327, still no clickable markers. Grrrrrrrrrr!

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

Older Posts »