I tried to find out but Google didn't help. Is there some way to get the cpu usage in flash or adobe AIR?
I'm using ActionScript 3.0 and flash CS5.
In Flash, there is no way. In AIR, only native helper could do it. Flash platform has tough time with system programming, it's not its strength.
Related
Hi i am developing an application using adobe air for iOS using flex.
i have the user take a snapshot and my intention is to upload the photo to my api.
the problem is when compressing the byteArray and then encoding it to a base64 String to send it up the apps freezes for 1-2 minutes.
My question is: is there a way to multithread this process in adove air, so i have it going in the background ?
and from your experience does an adobe native extension use another thread on the device for itself or no, maybe i can handle the background encoding and upload in a native extension.
Thank you all.
AS3, up until recently, was entirely single threaded. As of FP11.4 and AIR 3.4, you have access to Workers, which is essentially offloading tasks to a second thread. Beta support was added to Android in 3.8 or 3.9 and I believe it is out of beta now in 13.0. Workers are not supported by iOS, though. This is, I believe, because they have to cross compile to Objective-C to support iOS at all, so their methods won't work.
You're only option is to load the processing onto an ANE, which may or may not be a good idea. ANEs are meant to behave as a bridge between AIR and native OS APIs. While this would work, I think it goes beyond the scope of what an ANE is intended for.
Unless your photos are insanely large, I would suggest just not doing compression. Resizing photos (using the BitmapData class) is fairly quick on 4S+, so I don't think that is much of an issue (4S is closing in on being 3 years old at this point. Having old hardware means things run less than ideally, so anything older will just have to accept poorer performance)
Worker Documentation
I am planning to develop a HTML5 with Three.js pages, so that i can achieve 3D screens using that and support for Mobile platforms easily in Cross platform method. I read Three.js uses WebGL, but iOS and Android browsers doesn't support it, so i cannot develop such combination apps.
Could someone please advise, whether i can develop HTML5 with Three.js pages to achieve 3D interactions on iOS and Android apps or not as web app? If not, please give me the official links where it is mentioned that it is not supported.
Thank you.
Three.js will work fine without WebGL. You can use the Canvas renderer -- it's described in the Three.js documentation, I'm sure you can find it on github using google or even Bing. It's not as fast as using WebGL, but one doesn't race Monte Carlo in a Nissan Sentra.
You should not expect high performance 3D on any mobile platform -- mostly becasue javascript performance can be numbingly slow. Try accessing some of the various Three.js examples using mobile devices (both with and without webgl) to get some idea of performance.
I tried to run Three.js Canvas demos on my iPad Air and it was awful. Usually Safari crashes and even if render works it performs 2-3 fps. So seems it's very raw on iOS devices right now
iOS Safari and Android Chrome have supported WebGL for several years now.
The issue you might be referring to is Android's WebView or iOS's UIWebView (the control you can put in a native app to display a webpage) may or may not support WebGL. WebGL is supported in WebViews as of Android 5.0 apparently although people have run into issues
Another option is to use something like CocoonJS. They apparently provide custom webview implementations for Android 4.0+ and iOS 8+.
As for performance, three.js will perform just fine on simple scenes with mobile. There are plenty of examples. 3D on mobile in general though requires optimized assets (lower polygon models, smaller textures, simpler shaders, less lights, etc...) relative to desktop and particularly with three.js
iOS and Android browser support webgl not as well as Web browser, sometimes you can reduce the render effects to make it work. This usually do. For app, android webview render ability is low. Ios have a better one.
And you can plugin some render engine into you app, such as XWalkView, Here is a post of mine how to use it to render the 3D models with three.js in my android4.2.0 App. For IOS there is also relevance solutions.
The chosen answer to this question recommends using the Three.js CanvasRenderer, but as shown here in the Three.js documentation, CanvasRenderer has been deprecated:
NOTE: The Canvas renderer has been deprecated and is no longer part of the Three.js core.
It is important to note that it can still be used for simple 3d scenes and can be found on Github here
WebGL is supported in Androids WebView v36 and above, as seen here.
Alternatively with older Android Chrome browsers WebGL can be enabled by typing: chrome://flags into the browser and selecting the Enable link that appears under the Enable WebGL header in the browser window, or by updating webview from the Android Google Play Store.
WebGL has been supported on Mobile Safari since iOS 8.0b.
At mobilehtml5.org you can see what mobile device versions support specific HTML5 features:
Sony Xperia Android 2.3 also supports WebGL.
I'm trying to build a game for iOS using Adobe Air and Flash Builder 4.7, I need to read the gyroscope data to find out what is my alpha rotation value(0-360), I've been searching around for libs and native extensions to use with adobe air, but I'm a bit lost.
Is there any easy way I can get this value on my app?
Something like this guy does here:
Understanding How the Accelerometer and Gyroscope Work in the Browser
What I would need is an event that would give me an alpha rotation value, or a way to calculate this value using x/y/z and/or pitch/yaw/roll values.
Thanks
You can find example code and links to tutorials in the official documentation:
flash.sensors.Accelerometer
I've recently heard about the converting feature of Adobe Air but how well does it work?
Does it emulate every bit of code a complex Flash game using tons of libraries outputs or should you expect a lot of work to go around if you were to convert one?
I'm thinking of making a complex cross-platform game but not sure which is better/easier, to use Flash and Adobe Air for its abundant game libraries, resources and faster development or to simply go with Java.
It Would really save lots of time if I can use Flash. Though, I can imagine it would also give me headaches to worry about all the time. Like what if adobe/apple stops supporting Flash or what if the converting feature won't work.
Any advice and any bit of information would be welcome. Thanks.
AIR works well on iOS in my experience although native apps will always perform better. I cant think of any aspects of Flash that wont work when converted to run on iOS.
Whether AIR performance is good enough really depends on the individual case - how gpu and cpu intensive the game is.
You have to consider the trade-off: use existing Flash skills to create a 'good' game quickly; or learn new skills to create a 'better' game slowly - is it worth spending weeks/months learning new skills to get a few extra percent of performance? Only you can decide that.
Regarding Adobes AIR support in the future; who knows - they dont have a great track record (think flash on mobile) - but i would suggest AIR will be around for at least the medium term, if not long-term.
My personal opinion is that "mobile" is not going anywhere and now is the best time to start learning Java for Android and/or Objective-C for iOS. Like PhoneGap, Flash mobile Apps don't give you complete access to the devices entire API/SDK options, even though what they do offer usually suffices. Flash is still a respectable tool but developing "native" gives you full control over your app's memory, device interaction, cutting edge APIs, etc ...
Depending on how optimized your action script 3 code is written, you may experience some performance issues vs utilizing native graphics libraries. I assume the latest version of AIR (I know Flash 11.2 and on included some nice graphic stuff) may address performance but haven't seen any benchmarks for AIR on mobile devices yet.
If you are hoping to go the AIR route, I'd say why not take a few days and try to port it over. If all else fails get a nice iOS or Android book and cuddle with it every night until you are confident you can recreate your App natively.
I've long thought of Flash Lite as something similar to actionscript, for mobile browsers.
But today I tried to create a Flash Lite project in flash cs5 but found it seems to be some kind of Flash Player ?
Which is the case ?
If it's the latter case, is actionscript for Flash Lite the same as actionscript for Flash Player or has some kind of difference?
Flash lite is indeed a stripped down flash player for embedded devices. With the latest round of smartphones using the "real" flash player you may be better off ignoring it. (I do flash lite development in my day job for around 60,000 devices worldwide, but I still recommend bypassing it and just concentrating on Flash 10+)
Basically, take all the advanced features out of flash and make it small enough to fit on now archaic devices. (Sorry, it's the truth!)