Also, if you have something that you know is going to be intensive,
and you need asynchronous behavior, you can use

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/package.html#setTimeout()

or the Timer class to let the app breathe. Also something that is
really useful is setting the setTimeout to a delay of 0, what this
will do is force the code to fire in the next frame. This is really
useful for all kinds of situations.

Also if you're using the timer to execute a function you have another
option as well:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/TimerEvent.html#updateAfterEvent()

Good Luck,

Jonathan
Scribblemaps.com

On Oct 19, 11:32 am, Nathan Weber <[email protected]> wrote:
> When a map is created for the first time, the application freezes
> (accepting no input and displaying no visual changes) until the map is
> fully loaded.  This problem seems more pronounced in larger projects
> and especially in AIR projects.  I have a project that displays a
> progress bar, but the progress bar freezes (along with the rest of the
> application) while loading a map.
>
> Here is a sample application to illustrate the bug:
> When I run this application the progress bar freezes at the 26% mark
> for a few seconds.  In a much larger AIR project, loading a map causes
> the application to freeze for around 30 seconds.
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:WindowedApplication
>         xmlns:mx="http://www.adobe.com/2006/mxml";
>         xmlns:maps = "com.google.maps.*"
>         layout="vertical"
>         creationComplete="handleCreationComplete(event)">
>
>         <mx:Script>
>                 <![CDATA[
>                         import com.google.maps.Map;
>
>                         protected function handleCreationComplete( 
> event:Event ):void
>                         {
>                                 progress.setProgress(0,50);
>                                 
> addEventListener(Event.ENTER_FRAME,onEnterFrame);
>
>                                 var timer:Timer = new Timer( 500 );
>                                 timer.addEventListener( TimerEvent.TIMER, 
> loadMap );
>                                 timer.start();
>                         }
>
>                         private function onEnterFrame(event:Event):void
>                         {
>                                 progress.setProgress( progress.value + 1, 50);
>                                 if ( progress.value >= 50 )
>                                 {
>                                         
> removeEventListener(Event.ENTER_FRAME,onEnterFrame);
>                                 }
>                         }
>
>                         protected function loadMap(obj:*=null):void
>                         {
>                                 var map:Map = new Map();
>                                 map.url = "your url";
>                                 map.key = "your key";
>                                 map.width = 500;
>                                 map.height = 500;
>                                 map.setStyle( 'verticalCenter', 0 );
>                                 map.setStyle( 'horizontalCenter', 0 );
>
>                                 addChild( map );
>                         }
>                 ]]>
>         </mx:Script>
>
>         <mx:ProgressBar visible="true" id="progress" mode="manual"
> width="300" top="10" horizontalCenter="0" fontWeight="normal"/>
>
> </mx:WindowedApplication>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to