Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Regular Contributor
Posts: 57
Registered: ‎01-12-2012
My Device: Playbook
My Carrier: 3

Threading or backgroundworker

Do anyone know if it is possible through AIR to do threading? or any kind of backgroundworker? Am working on a webservice tests and could use a threading to fetch data through webservices for caching in the app as the application seem to hang until the data have been fetched and gives a horrible user experience.

Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Threading or backgroundworker

What are you using to fetch the data? I use an URLLoader which can asynchronously fetch the data and dispatches an event when the data is ready. This way the UI stays responsive.

 

Adobe AIR has no threads I'm afraid and no backgroundworkers. This is mostly resolved wiht asychronous calls, but there is another solution called green threading. No personal experience though.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Threading or backgroundworker

ditto of what @zezke said. I've been doing AS3 for about 7 years and have yet to find a need for threading. You do need to be a little more creative in what you are doing where a thread would make it easier. If your url requests are still too slow, I am guessing you are requesting a lot of information at one time. You need to "page" the requests in chucks to keep the UI responsive.
Regular Contributor
Posts: 57
Registered: ‎01-12-2012
My Device: Playbook
My Carrier: 3

Re: Threading or backgroundworker

Hi,

Yes it was not a small amount of data, so I rewrote the webservice on the serverside to provide less information for the initial view and then created a syncronize function for caching of data since last a synch was done instead, and that helped. But also think that using amCharts is a little heavy for the PB when trying to load 4 graphs onto the same page - or I still might need to optimize the code some further.

 

I am still messing around with AIR and trying to see what I can get out of the API's

 

btw is there an easy way to invoke C++ dll's? tried to edit image metadata with no luck and since I already have an dll who can do the job for images, ms documents and sound tags, then thought, that I might give that a try on the PB as well.

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Threading or backgroundworker

To do anything with C or C++ you'd want to investigate ANEs, or Adobe Native Extensions. Should be info here or in the NDK forum about it, though it's early days for most people with that yet, so relatively little hard info available.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Threading or backgroundworker

By the way, at some future time, it will likely be possible to use some form of general-purpose threads with Flash on the PlayBook.

 

See http://matthewfabb.com/blog/2011/09/02/multithreading-in-flash-update/ or this page with a collection of thread-related info on it: http://www.bobsgear.com/display/ts/Multithreading+in+flash


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Threading or backgroundworker

That was interesting, thank you for sharing.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Developer
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: Threading or backgroundworker

Vote for this feature in JIRA: https://www.blackberry.com/jira/browse/TABLET-422

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Threading or backgroundworker

It's not a public issue.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!