Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

GPXService.load is synchronous #1

Open
vitch opened this issue Sep 23, 2010 · 2 comments
Open

GPXService.load is synchronous #1

vitch opened this issue Sep 23, 2010 · 2 comments

Comments

@vitch
Copy link

vitch commented Sep 23, 2010

The comment in the example gives the impression that the point of the GPXService is to allow you to parse a file asynchronously. However, it seems that the GPXService is pointless as the call to load will block the flash player and the ParseEvent.PARSE_COMPLETE will fire before the following line of code is reached. e.g.

private function onXmlLoaded(event:Event):void 
{
    var gpxSrv:GPXService = new GPXService();
    gpxSrv.addEventListener(ParseEvent.PARSE_COMPLETE, onGpxParse);
     var loadedData:String = xmlLoader.data;
    gpxSrv.load(new XML(loadedData));
    trace('NEXT LINE', getTimer());
}

private function onGpxParse(event:ParseEvent):void 
{
    var gpx:GPX = event.gpx;
    trace('DONE', getTimer());
    trace(gpx);
}

Will trace:

DONE 10613
[object GPX]
NEXT LINE 10613
@vitch
Copy link
Author

vitch commented Sep 23, 2010

(my test gpx file is largish at 897kb with around 5000 trkpt nodes so it takes 10 seconds to parse!)

@ryanstewart
Copy link
Owner

Hmmmm, let me take a look at this and see what's up. Thanks for posting the issue!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants