UIComponent markers
Hi everyone,
I'm working on a Flex 3 project which uses Modest Maps.
I've made some changes to tom-tweenlite branch in order to use Flex objects (UIComponent) as markers :
1. com.modestmaps.Map.as extends UIComponent (instead of Sprite)
2. com.modestmaps.core.MarkerClip.as extends UIComponent (instead of Sprite)
I look for a better way to do that, without altering the library (maybe by composition or inheritance of Map/MarkerClip ?) .
Thanks,
Arnaud.
I'm working on a Flex 3 project which uses Modest Maps.
I've made some changes to tom-tweenlite branch in order to use Flex objects (UIComponent) as markers :
1. com.modestmaps.Map.as extends UIComponent (instead of Sprite)
2. com.modestmaps.core.MarkerClip.as extends UIComponent (instead of Sprite)
I look for a better way to do that, without altering the library (maybe by composition or inheritance of Map/MarkerClip ?) .
Thanks,
Arnaud.
Follow this discussion to get notifications on your dashboard.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?I don't know a lot about Flex but composition is the way to go otherwise it breaks compatibility with Flash and pure as3 projects – there's no need to do that.
MarkerClip is extremely loosely attached to Map, it's really just a convenience. You can create your own marker clip and add it as a child to map, and attach markers to markerclip directly, and it figures out the rest. We do this for layers of markers.
I would make a UIComponent with a Map as a child, and a UIComponent with a MarkerClip as a child, and then expose the methods you need as conveniences or just make them public.
There is some basic Flex work in the modest maps source tree already, and it would be great if you could fix/extend that as part of what you're doing. Note that the flex stuff in the svn trunk has had some fixes since we branched, so you'll want to look there as well as in the tweening branch. -
Inappropriate?Sorry if I seemed a bit abrupt, above, I was in a hurry. Let me know if there's anything you need to know about Map or MarkerClip, or deeper in TileGrid etc. I'm happy to help!
I'm interested in knowing more about how Flex does things - is there a particular reason that the MarkerClip needs to be a UIComponent? I know that if you add a Sprite as a child of a canvas then you get a run-time-exception. Can you help us out by explaining a bit about what UIComponent gets you otherwise? -
Inappropriate?I know two ways to add a Sprite as a child of a canvas (or anyother Container) :
- create a wrapper
var comp:UIComponent = new UIComponent();
comp.addChild(new Sprite());
canvas.addChild(comp) - or Simpler
canvas.rawChildren.addChild(new Sprite());
But I want to use a UIComponent as marker... So marker's parents (MarkerClip -> Map -> MapComponent -> ... -> Application) must be UIComponents (in my mind). - create a wrapper
-
Inappropriate?I see. Thanks for the clarification, I see now that you can't use UIComponents as markers with the existing classes.
It seems like the main thing you need is a MarkerClip that extends UIComponent – it doesn't need to be a child of Map though, just on stage with the same parent (so the positioning works correctly).
I just checked in a quick change to Map and MarkerClip so that MarkerClip takes care of provider changes for itself. Now the only thing that Map does for MarkerClip is turn captured mouse events into MarkerEvents – you could dispatch those from your marker clip UIComponent instead and set them to bubble, and you wouldn't need Map to know about MarkerClip at all. This is the way we'll be going with future versions because we have different kinds of custom overlays for all our projects and MarkerClip is just an example really. -
Inappropriate?Perhaps you could explain why you want a UIComponent rather than a Sprite? If it's because you want to use the layout features in Flex so you can have a complex marker then I would be concerned that the measure and layout phases won't get done on the UIComponent marker if it's added as a child of a Flash object, a Sprite.
An alternative might be that Flex markers are added to the Flex Map (com.modestmaps.flex.map), thus leaving the Flash side (com.modestmaps.map) Flex free? I think this would mean having marker management code in the Flex map to reposition the Flex markers when the map pans, zooms or resizes? But I think this could be implemented outside of the modestmaps too. -
Inappropriate?Hi RichardJ,
I think this thread could answer your query. I would be interested for ModestMaps to implements UIComponent rather than Sprite too.
http://www.mail-archive.com/flexcoder...
I’m excited
-
Inappropriate?I unable to post the url here. But I include the google result. Click on the 4th link from the flexcoder
Click here
I've found another tutorial on how to put image in Sprite using Class. I'll post here if I can find the link
I’m excited
Loading Profile...



EMPLOYEE
