Hi Laxmidi,
The MX progress bar wraps the flash-only ProgressbarMapControl control
in a Flex Canvas so you can add it in flex applications. Since you're
using Flex already (because google use it) then you should use the MX
one as it'll maintain the user interface of the rest of your
application. If you were writing a flash only application then you
could use the flash one which is probably faster and would use less
memory etc than importing the flex classes.
Re getting the thing to show actual progress, you could try starting
the progress monitor in the MAP_READY event for your map and then
updating it in the OVERLAY_ADDED and TILES_LOADED_PENDING events
(which tell you about progress in displaying/loading the map). You'd
need to count how many overlays you're supposed to be adding to know
what total to give the progress bar. Also the marker manager might
confuse things (eg: markers being added and removed when you dont
expect).
Re: the documentation: it doesn't seem to match the actual classes -
eg: the examples show the progress bar constructor taking a Map object
but the real thing does not. I presume the intention in the original
doco was that the progress bar would automatically show itself and
then the remove method would remove it.
Anyway, to make it show you could change the constructor of
ProgressbarMapControlMX to something like this:
import mx.managers.PopupManager;
import flash.display.DisplayObject;
private var map:DisplayObject = null;
public function ProgressbarMapControlMX(map:DisplayObject)
{
super();
this.map = map;
progress = new ProgressbarMapControl();
rawChildren.addChild(progress);
addEventListener(ResizeEvent.RESIZE, onResize);
PopupManager.addPopup(this, map, true);
resizeProgress();
}
And add a remove method like:
public function remove()
{
PopupManager.removePopup(this);
}
Which should show the progress bar as a popup modal window in front of
the map - modal windows in flex aren't really modal (ie they dont
pause execution of the rest of the program, they just stop you
clicking out of the window) so the map should continue to load in the
background. If you dont want the popup window then you could just
replace the addPopup line with:
map.addChild(this)
and the removePopup line with:
map.removeChild(this)
Cheers,
Chris
On Sep 3, 6:54 am, laxmidi1994 <[email protected]> wrote:
> Hi Pamela,
>
> Thank you for the ProgressBarControl!
>
> I'm setting it up to track the progress of markers as they are
> rendered on the map.
>
> Unfortunately, I've got the progressbar displaying only after all of
> the markers are rendered. So, there is no progressbar, the markers are
> drawn, and then the progressbar displays showing that everything was
> rendered.
>
> In the example enclosed in the folder, he uses the setTimeout method
> in order to get the browser to update the screen and show changes in
> the progressbar. I tried it, but I couldn't figure it out. I noticed
> that the example uses GMarkers. Is there an all-Flex marker example?
>
> In the documentation, it mentions the remove method, which I didn't
> find with code hinting. Flex wouldn't let me use remove.
>
> Please find below my code. The code places markers and the progressbar
> shows after all of the markers are rendered. What do I need to add in
> order to get the progressbar to show "progress"?
>
> public function pointsBuilder():void {
>
> var progressMX:ProgressbarMapControlMX = new ProgressbarMapControlMX;
> progressMX.x = 200;
> progressMX.y = 200;
> progressMX.width = 150;
> progressMX.height = 100;
> addChild(progressMX);
>
> markerBoss = new MarkerManager(map, {maxZoom: 16});
>
> var myArrayLength:uint = myData.length;
> progressMX.start(myArrayLength);
>
> var i:int;
>
> for (i=0; i < myArrayLength; i++) {
> progressMX.updateLoader(1);
> myMarkers = new Marker(new LatLng(myData[i].latitude, myData
> [i].longitude),
> new MarkerOptions({
> strokeStyle: new StrokeStyle({color: 0x000000}),
> fillStyle: new FillStyle({color: 0x223344, alpha: 0.8}),
> radius: 12,
> hasShadow: true
> })
>
> );
>
> markerBoss.addMarker(myMarkers, 16, 16);
>
> }
>
> markerBoss.refresh();
>
> }
>
> Also, what's the difference between ProgressbarMapControl.as and
> ProgressbarMapControlMX.as?
>
> If anyone has any suggestions, please let me know.
> Thank you.
>
> -Laxmidi
>
> On Sep 1, 9:38 am, "pamela (Google Employee)" <[email protected]>
> wrote:
>
>
>
> > Hi Laxmidi-
>
> > Ok. I guess I would have expected faster performance with the MarkerManager.
>
> > I've just uploaded the ProgressBarControl from Tony, try it
> > out:http://groups.google.com/group/google-maps-api-for-flash/web/GoogleMa...
>
> > - pamela
>
> > On Tue, Sep 1, 2009 at 11:19 PM, laxmidi1994<[email protected]> wrote:
>
> > > Hi Pamela,
>
> > > Thank you for your message.
>
> > > 1) I'm placing a lot of markers-- from a hundred (which runs okay) to
> > > several thousand (which crawls or crashes). I know that's a lot of
> > > markers. Obviously, I could reduce the number of markers placed on the
> > > map, but that wouldn't be a good solution in my case.
>
> > > 2) I am using the markerManager, so that only the markers in the
> > > viewport are rendered.
>
> > > 3) I'm very interested in the ProgressBarControl that you mentioned.
>
> > > Keep up the good work.
>
> > > Thank you!
>
> > > -Laxmidi
>
> > > On Sep 1, 1:48 am, "pamela (Google Employee)" <[email protected]>
> > > wrote:
> > >> Hi Laxmidi-
>
> > >> How many markers are you displaying? Tony Leonard, from this group,
> > >> says that he ported the ProgressBarControl from JS to AS3, and that
> > >> would be pretty much what you described wanting. I've pinged him to
> > >> see if he can share that code with the group.
>
> > >> If you're displaying many markers, you might also want to use
> > >> MarkerManager. It will load all markers into memory, and then only
> > >> render the markers in the viewport - so the rendering should be
> > >> faster.
>
> > >> - pamela
>
> > >> On Sun, Aug 30, 2009 at 9:07 AM, laxmidi1994<[email protected]>
> > >> wrote:
>
> > >> > I have a lot of markers and I'm trying to improve performance.
>
> > >> > I use mySQL and php to return latitude and longitude coordinates. I
> > >> > then iterate over the result to make the markers. I use the
> > >> > markerManager class.
>
> > >> > for (i=0; i <
> > >> > myData.length; i++) {
> > >> > myMarkers = new
> > >> > Marker(new LatLng(myData[i].latitude,
> > >> > myData
> > >> > [i].longitude), new MarkerOptions({
> > >> > icon: new
> > >> > myIcon, iconOffset: new Point
> > >> > (2,2), iconAlignment:1, hasShadow:true
> > >> > }));
> > >> >
> > >> > markerBoss.addMarker(myMarkers, 15, 15);
> > >> > }
>
> > >> > Is there a way to create LatLng's or markers directly in php? Would
> > >> > this be faster?
>
> > >> > If there isn't a way to speed up creating the markers is there a way
> > >> > to show each marker as it is rendered? Presently, all of the markers
> > >> > are calculated and then shown at one time. If the markers were shown
> > >> > as they were built it would be more interesting for the user than
> > >> > looking at a spinning clock.
>
> > >> > Looking forward to your suggestions. Thank you!
>
> > >> > -Laxmidi
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---