Hey Nathan, If you don't feel like reading this whole thing Main point: I feel your pain man, there is no good solution, there are workarounds but they would have to be implemented by the google API folks and they are not necessarily trivial nor worthwhile as they really extend the time it takes... although I suppose for UI and UX it might be better to wait a few moments more and remain responsive.
Yeah what you're saying is basically what is happening, the UI gets locked up because both the data processing and UI share a single thread and if the CPU is dealing with data processing to take place then the UI isn't being updated (I mean to be fair data is data and instructions are instructions so really the distinction I'm making between UI instructions and data instructions doesn't exist but I hope you get my point), I find this to be a royal pain. I've looked around for some sort of way to get rid of the problem (we actually have this issue when loading/parsing a few XML files and the progress bar and our cool preloader gets all choppy) from what I've seen you basically need to pause the processing of data manually then let the animation continue and then switch back to processing data from where you were. It's not necessarily easy to split any given problem into something that can be processed in chunks like this, and you actually add to the load time by adding indirection since you're doing more method calls. This is in my eyes one of the most glaring deficiencies of Flash, and where silverlight really shines (likely one of the first times I'd side with the Microsoft over Adobe). I've heard reasons this hasn't been implemented like it having some conflict with the event model or something, and dealing with different platforms but I don't see how this can work in Java on all platforms (and doesn't the C function fork work on all platforms?) and not be doable in Flash, same with overloading, I just don't get why they can't include that language feature. I mean I realize they're coming from a basic scripting language and trying to make it OOP and trying to conform to ECMA standards but still... come on, these are huge feature gaps (probably wouldn't care about this if I didn't take design patterns, but now I'm all software engineery). Another argument I've seen is not enough people write apps that expect the client machine to do a lot of processing and you can just defer the processing to the server, but as in this case there's no way you can defer the instantiation of the map to a server to handle. Also if it's expected that enterprise quality apps can be made with AIR then wtf, lots of users especially business people have at least dual core laptops and quad core is not all that uncommon for desktops, workstations, and geeky home sytems. I've got a quad-core with Hyper Threading so it shows as 8 separate processors but its all for nil if you can't thread (just means I can run more single threaded operations at a time but my app could never actually utilize the processing power my hardware offers). I have to give them some props for doing some hardware acceleration and PixelBender which does data manipulation and has a language called Hydra can apparently do multi-threading but I don't think you can write a Hydra script to read XML or load a map... btw none of this is really relevant unless the user has a multi-core processor, I think if you created a new thread to do data processing on a single thread machine you'd have the same issue. If you look up Pseudo Thread Flash you should get the thing I was looking at a few days ago I think it was written by a guy named Alex it's the closest thing I've found to a solution to this problem but still isn't a real solution. AVM is open source now maybe instead of just complaining about it I should try and make something happen but right now my life is consumed with a 100 other projects I've got back logged. Also I understand the people at Adobe are probably a pretty brilliant group of people and I don't mean to be demeaning to them at all or to knock the quality of their product. I'm sure the decisions they've made were reasonable within the context they were working with, but the game is changing and if they believe that Flash isn't just for for animation anymore, then they need to fully embrace that and make their language, feature rich.(at least enough to compete with Java and Silverlight/.Net) I've seriously been considering plunging into some .net stuff because of this limitation... major thing that stops me is the ubiquity of the flash player. Also if you're interested check out the Merapi project its a Java->Air/Flash bridge so you can defer heavy processing to java so it can utilize threading then return the result to Air/Flash, problem with this is mostly deployment all the clients need to have java and doing installation I would imagine is more complex though I haven't tried yet. My apologies for continuing this conversation on the maps forum seeing as how we are talking mostly Flash issues, but I just wanted to put in my two cents on this issue as it bothers me as well. I'm done ranting thanks. Shaun Alex's post http://blogs.adobe.com/aharui/2008/01/threads_in_actionscript_3.html How to port to Flash http://www.joristimmerman.be/wordpress/2009/01/11/pseudo-threading-in-actionscrip-as3/ On Oct 28, 1:41 pm, Nathan Weber <[email protected]> wrote: > This is true, and I see your point. However, I would think that the > loading could be spread across several frames. I'm pretty sure what's > happening is that all of the loading is happening all at once, which > is locking the Flash Player into a single frame until all of the > processing is complete. If the loading were to be spread out the > application should appear more responsive. All of the loading from > the api is getting done when that first Map is added to the stage. > > On Oct 23, 12:48 pm, Jonathan Wagner <[email protected]> wrote: > > > This is less of a Google Maps API issues, and more of flash issue, > > flash is single threaded, so if there is a large computational > > transaction flash will freeze until the transaction is resolved. If in > > your large AIR app you are getting 30 seconds of freezing+, this is > > probably something you're doing, as opposed to the Google Maps API. > > The freezing with the API is probably being caused when all the tiles > > are requested and added for the first time, but there would be no > > reason for the freezing of the API to compound with larger apps. > > > 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 -~----------~----~----~----~------~----~------~--~---
