I tried something you said and it works, I was gona make a cluster
class with it ;
I ve tried define a thumb class extending movieclip and a coverlay
class extending overlaybase class of the api.
put the thumb into the coverlay then on the map;
But I am still think that using marker to mark a large amount of point
is a waste of cpu cos the marker class itself is not efficient
especially when it using the custom icons.
so if you want to using custom icon ,I suggest you to using marker
manager or define a maker holder movieclip instance and put your
custom icon in it then put the maker holder right over the map and
control the holder position while you zoom or drag the map.
here is the code;
package com.controls
{
import flash.display.Bitmap;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.events.Event;
import flash.geom.Rectangle;
import flash.net.URLRequest;
import flash.system.LoaderContext;
import flash.text.TextField;
import mx.core.MovieClipAsset;
public class thum4 extends MovieClipAsset
{ public var m:MovieClip
public var b:Bitmap;
public function thum4()
{
m=new MovieClip();
var _loc_4:Loader = new Loader();
_loc_4.contentLoaderInfo.addEventListener(Event.COMPLETE,
loaded);
var context:LoaderContext = new LoaderContext();
context.checkPolicyFile =false;
_loc_4.load(new URLRequest("shopping_cart.png"),context);
this.addChild(m);
this.graphics.clear();
this.graphics.lineStyle(3);
m.addEventListener(Event.ENTER_FRAME,onEnterFrame);
}
private function loaded(param1:Event):void
{
b=new Bitmap();
b=(Bitmap)(param1.target.content);
m.addChild(b);
}
private function onEnterFrame(evt:Event):void{
evt.target.x+=1;
this.graphics.lineTo(m.x,m.y);
}
}
}
package com.controls
{
import com.google.maps.LatLng;
import com.google.maps.MapEvent;
import com.google.maps.PaneId;
import com.google.maps.interfaces.IMap;
import com.google.maps.interfaces.IPane;
import com.google.maps.overlays.OverlayBase;
import flash.display.Shape;
import flash.events.*;
import flash.geom.Point;
import mx.effects.easing.*;
import mx.events.*;
public class coverlay extends OverlayBase
{
public var map:IMap;
public var line:Shape;
private var latLng:LatLng;
public var img:thum4;
public var pos:Point;
public function coverlay(pos:LatLng)
{
super();
this.latLng=pos;
img=new thum4();
img.width=20;
img.height=20;
this.addEventListener(MapEvent.OVERLAY_ADDED,
onOverlayAdded);
this.addEventListener(MapEvent.OVERLAY_REMOVED,
onOverlayRemoved);
}
public override function getDefaultPane(map:IMap):IPane {
this.map = map;
return map.getPaneManager().getPaneById
(PaneId.PANE_OVERLAYS);
}
private function onOverlayAdded(event:MapEvent):void {
positionOverlay(false);
addChild(img);
}
private function onOverlayRemoved(event:MapEvent):void {
map.clearOverlays();
}
public override function positionOverlay
(zoomChanged:Boolean):void {
pos= this.pane.fromLatLngToPaneCoords
(this.latLng);
img.x=pos.x;
img.y=pos.y;
}
}
}
hope it can help
On May 1, 1:59 am, "Howard, Stephen" <[email protected]> wrote:
> Is it possible to have a Sprite represent a PNG (embedded?) and then use
> that as a Marker?
>
> I know that the Sprite can definitely be used as a Marker, I'm just
> struggling trying to determine if this will work with a Sprite
> representing a PNG.
>
> Thanks,
>
> Stephen
>
> Davis Advertising
> One Bala Plaza #640, Bala Cynwyd, PA 19004
> (610) 227-0435
>
> www.davis.jobs
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---