example on how to use markers in flex
i'm browsing the discussions here for a while. but i havn't found a simple example on how to use markers with flex yet. some people seem to have running flex-applications.. does anyone share his code? that would be nice..
i doesn't understand how to use the methods myMap.map.putMarker() and myMap.map.addChild(). whatever i tried no marker is displayed in the map.
thanks a lot. happy new year! by the way.. ;)
i doesn't understand how to use the methods myMap.map.putMarker() and myMap.map.addChild(). whatever i tried no marker is displayed in the map.
thanks a lot. happy new year! by the way.. ;)
2
people have this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?If you scroll your browser window down 8 posts from this one you will find links to a simple Flex demo with full source.
Alternatively jump to here:
http://ccgi.arutherford.plus.com/blog...
There is a slight bug in the marker delete core function but I mention with fix here:
http://ccgi.arutherford.plus.com/blog...
Al -
Inappropriate?I wrote an ImageMarker.as to put flickr photo, it is used on flex to show my flickr geotagged photos.
use object com.modestmaps.Map inside this class is not a good idea,
but it's the only way I cound implement now.
I use MovieClip to wrap the imageLoader because I want to apply some effect on it. you can use ImageLoader directly.
those code contain the key point to use putMarker.
package com.modestmaps.core
{
import com.modestmaps.Map;
import com.modestmaps.geo.Location;
import flash.display.*;
import flash.events.Event;
import flash.net.URLRequest;
import flash.events.MouseEvent;
import flash.filters.GlowFilter;
import com.modestmaps.events.MapEvent;
import com.modestmaps.events.MarkerEvent;
public class ImageMarker
{
private var _id:String;
private var _url:String;
private var _map:Map;
private var _location:Location;
private var _imageLoader:Loader;
private var _mc:MovieClip;
public function ImageMarker(id:String, url:String, location:Location, map:Map)
{
_id = id;
_url = url;
_map = map;
_location = location;
_imageLoader = new Loader();
_imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
_imageLoader.load(new URLRequest(_url));
_mc = new MovieClip();
_mc.addChild(_imageLoader);
_mc.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
_mc.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
_mc.addEventListener(MouseEvent.CLICK, onMouseClicked);
}
private function onLoadComplete(event:Event):void
{
_map.putMarker(_id, _location, _mc);
}
private function onMouseOver(event:MouseEvent):void
{
}
private function onMouseOut(event:MouseEvent):void
{
}
private function onMouseClicked(event:MouseEvent):void
{
var newEvent:MarkerEvent = new MarkerEvent(MarkerEvent.CLICK, _id, _location);
_map.dispatchEvent(newEvent);
}
}
}
Loading Profile...



