EzDevInfo.com

air interview questions

Top air frequently asked interview questions

Download a file with Adobe AIR

How do I download a file from the internet in a Flex based AIR application.

I tried using a file with url set to the address, but I got a file does not exist error when I tried to save it. And it is really hard to google for help on this issue.


Source: (StackOverflow)

ADD COLUMN to sqlite db IF NOT EXISTS - flex/air sqlite?

I've got a flex/air app I've been working on, it uses a local sqlite database that is created on the initial application start.

I've added some features to the application and in the process I had to add a new field to one of the database tables. My questions is how to I go about getting the application to create one new field that is located in a table that already exists?

this is a the line that creates the table

stmt.text = "CREATE TABLE IF NOT EXISTS tbl_status ("+"status_id INTEGER PRIMARY KEY AUTOINCREMENT,"+" status_status TEXT)";

And now I'd like to add a status_default field.

thanks!

Thanks - MPelletier

I've add the code you provided and it does add the field, but now the next time I restart my app I get an error - 'status_default' already exists'.

So how can I go about adding some sort of a IF NOT EXISTS statement to the line you provided?


Source: (StackOverflow)

Advertisements

AIR 3 Native Extensions for Android - Can I/How to include 3rd party libraries?

With all the new hype surrounding native extension support in AIR 3, I haven't found a single thing that confirms or denies it is possible to include and use an external JAR inside the native Android implementation.

All of the examples basically showcase the ability to hook into the built-in Android APIs. But what if someone wants to use one of hundreds of libraries that make it easier? Certainly it seems like this should be possible. I'll try to outline what I've done and maybe someone will spot a flaw:

  1. Successfully created native Android library, using compiled-in imports from 3rd party Android library XYZ.
  2. Exported Android project as JAR file. Note: The referenced 3rd party JAR is in /lib inside the jar.
  3. Successfully created ActionScript library (SWC) to interface with native Android library.
  4. Created ANE package from SWC, extension.xml, Android JAR, and library.swc (for platform Android-ARM, extracted from SWC).
    Note: Have also tried putting the 3rd party library in file structure outlined here: http://help.adobe.com/en_US/air/extensions/WSf268776665d7970d-24823354 12ffea65006-8000.html#WSf268776665d7970d-6be13ace1308aaebeca-7fff. I think this is more geared to runtime type execution with JNI or whatever, so that article has left me a little confused.
  5. Used ANE in example Flex Mobile project.
  6. Built and installed APK file on test DroidX device.
  7. Can successfully see AIR application loading (and trace statements) in LogCat "ActivityManager: Displayed com.me.androidapp/.AppEntry"
  8. Can successfully see native Android Java code being invoked via runtime by AIR app to instantiate extension & context. "mye_native: MyExtension.initialize", "mye_native: MyExtensionContext.createContext"
  9. As soon as AIR app tries to call native function, it blows up, not able to find the classes from 3rd party Android library: E dalvikvm: Could not find class 'com.thirdparty.SomeClass', referenced from method com.me.nativeExtentions.MyExtensionFunction.call

Any ideas? It seems like it should work this way.

One thing I have noticed is that when I blow apart the APK and Dex from a pure Java Android app of mine (that also has 3rd party android libraries), it appears that the classes from the 3rd party have been included inside it (not just a jar reference). When I do the same thing with my Flex APK, I find only my own Java classes plus Adobe's, and the 3rd party ones are nowhere to be found that I can see.

I posted this on the Adobe forums, but I thought I'd give the SO think-tank a try. Thank you.


Source: (StackOverflow)

Switching to ColdFusion? [closed]

I am currently building an Adobe Air desktop app for a medium sized company and I truley believe that I could use this same app for many other 'like-companies'. It will greatly improve their efficiency and save them money; and hopefully make me some money too! :) I am in the process of designing the database structure and the layout of the application.

My current skills:

  • intermediate at PHP
  • intermediate at Actionscript 3.0
  • and rather new to flex and adobe air

From what I understand, AMF is the 'best' form of communication between Flex and the server-side language. Also, I know that AMF is native for [ColdFusion to Flex] communication whereas PHP requires WebOrb, Zend AMF, or AMFPHP for [PHP to Flex] communication. I really like how ColdFusion is an 'all in one'.

My Question Is:

If this is a program that I plan on spending a few years or more on, would I be better off going with ColdFusion or PHP?

  • I do not like the fact that I would have to rely on a 'third-party program' with PHP
  • ColdFusion, Flex, and Adobe Air are all Adobe -> solid integration
  • yet, I would have to learn ColdFusion

Please Help, any information would be greatly appreciated!


Source: (StackOverflow)

Can't get Flash Builder 4.6 debugger to run

I've tried everything, firewalls, reinstalling etc etc. I can't get the debugger to connect no matter what I do.

I'm just writing a simple Air application, with Flex and Actionscript. But any type of debugging on any type of application doesn't work. I get this message

The Flash Builder debugger failed to connect to the running application.

Initial Error

Then often when I try again, I get this message

Unrecognized Windows Sockets error: 0: JVM_Bind

Secondary Error

Running the program without debugging works fine.


Source: (StackOverflow)

as3: check if value is a number

how can i simply check if a returned value is a number i.e, 12 , 12.5, 12.75

if (_myValue == [[NUMBER]])
{
    fire()
}

?


Source: (StackOverflow)

How to put\save files into your application directory? (adobe air)

How to put\save files into your application directory? (adobe air) (code example, please)


Source: (StackOverflow)

What is the maximum amount memory Adobe AIR can utilize?

I've been doing some rapid prototyping for a game I'm thinking of building. one of the main things i want to do is map generation for a tile type map. While generating the map i end up using large amounts of ram. I'm building the map as an array of random integers for my test. When i try to generate maps of a large scale flash gives me the out of memory error:

Error: Error #1000: The system is out of memory.

I've already figured i could write to a file instead, to solve that problem. but does anybody know the actual maximum size? I've tried searching around to no avail.

Activity monitor reports that ADL is using around 500MB "real memory" and around 700MB "virtual memory". The System.privateMemory property seems to match the "real memory" value.

as a side note i'm developing in OSX Snow Leopard (64) with 8gb ram

EDIT:

Here the example test i am running

var ba:ByteArray = new ByteArray();
for(var i:uint = 0; i<100000000; i++)
{
    ba.writeInt(int(Math.random()*100));
}

trace("end", ba.length, System.totalMemory);

This example runs fine, afterwards the total memory property reports around 500MB of ram used. Now increasing the target value to 400,000,000 i eventually receive the 'out of memory' error.

note: Testing in Flash CS5.5 with the timeout set to 120 seconds (the test never reaches that time)

EDIT:

i've created a better testing example:

var i:uint = 0;
var loopLength:Number = 500000000; // 500,000,000
var ba:ByteArray = new ByteArray();

for(i=0;i<loopLength;i++){
    try{ba.writeInt(1);}
    catch(e:Error){
        MEM_TI.appendText(e.message);
        break;
    }
}    

ba.position = 0;
MEM_TI.appendText("\nTM: "+System.totalMemory+" FM: "+System.freeMemory+" PM: "+System.privateMemory+" BALENGTH: "+ba.bytesAvailable/4);

When i run this script from a browser, stand-alone debugger or AIR i get roughly the same memory usage readouts (which i know vary anyway). What is constant however is the final length of the byte array:

Browser (Firefox): TM: 540413952 FM: 19116032 PM: 562573312 BALENGTH: 134217728

Stand-alone: TM: 540577792 FM: 1810432 PM: 545361920 BALENGTH: 134217728

AIR (2.6): TM: 5410816 FM: 1159168 PM: 551464960 BALENGTH: 134217728

My testing methods might not be perfect, though i dont know how to do deeper profiling.


Source: (StackOverflow)

Can I assign a global hotkey to an Adobe AIR app?

Is it possible to assign a global hotkey to a specific feature in an Adobe AIR app, i.e. the app feature responds to the hotkey whether the app is active or not (it must be running of course, but only in the system tray).


Source: (StackOverflow)

How does binding in ActionScript work?

As far as I understand, binding to a var in ActionScript is carried out via events which are automatically fired when a var is changed. I have a few questions about this:

  1. What happens if the class doesn't explicitly extend EventDispatcher? Is there is some sort of magic that goes on in the compiler which essentially makes the class an EventDispatcher?
  2. How does binding to static vars work? Is some sort of implicit static addEventListener() function added to the class?
  3. I've noticed that you can put [Bindable] on static vars but not static functions, why is this?

Edit:

Thanks to Christophe Herreman for his illuminating answer. However, I have a few follow-ons from my questions above. I wonder if anyone could fill in the gaps for me (I tried to number these questions 4, 5, 6 but they show up 1, 2, 3 for some reason!)

  1. I've added the -keep option to the compiler and looked at the generated binding code. Could anyone explain how this code is applied? The compiler seems to generate a class called BindableProperty for each class, which contains the getter and setter. How does this get folded into the class I wrote? The feature looks kind of like partial classes in C# - is this exclusively behind-the-scenes compiler functionality, or is it something I could use myself?

  2. The BindableProperty class still does not explicitly implement EventDispatcher, how does the generated class implement event dispatching?

  3. In question 3, I asked about binding to static functions, but I actually meant static getter and setter functions. This doesn't seem to be allowed.


Source: (StackOverflow)

starting an Adobe AIR application multiple times

Adobe air runtime prevents more than one instance of an air application to be started at the same time. Is it safe to circumvent this restriction by arbitrarily changing the publisher ID? Does anyone know if Adobe plans to allow multiple concurrent instances in Air 2.0?


Source: (StackOverflow)

Receiving Installation Error: ApplicationVerificationFailed in Flash Builder for iOS

This is the error I'm getting when I try to install my app on my iPhone.

enter image description here

More details:
It did work at one point. I used a different computer recently, working on a different project and had to create a new certificate. This invalidated my other projects (profiles). I went back to working on the first computer and uploaded the certificate from that one. I recreated the app profiles and downloaded the provisioning files based on that previous certificate. None of that worked. In the end I had to start over from scratch as shown in the answer below.


Source: (StackOverflow)

Flex performance considerations

What are the main key-points a Flex developer should remember in order to improve performance of Flex applications? The ones which come to my mind are:

  1. extending ItemRenderers from more lightweight base classes: i.e. UIComponent
  2. using suspendBackgroundProcessing set to true for animations
  3. using ArrayLists instead of ArrayCollections where appropriate.
  4. useVirtualLayout in Spark DataGroups (unfortunately this step requires Scrollers to make this advice effective)
  5. SQLight performance optimizations for AIR apps (transactions etc)
  6. Probably splitting long data processing into different frames? (Never done this though, so I might be mistaken)

What are the key guidelines you try to follow while developing your Flex3/Flex4/AIR applications in order to increase their performance?


Source: (StackOverflow)

C++/Qt vs Adobe AIR

I have to choose a platform for our product. I have to decide between The Qt Framework and Adobe's AIR. I am well versed with Qt as I have worked for the last two years. I looked up at the Adobe's site but all the info about flex, flash, ability to coding in HTML/ActionScript is overwhelming and confusing. I cannot understand the following about the Adobe ecosystem.

I have the following questions on Adobe AIR:

  1. What language do I use for coding my application? (not just defining the looks of UI)
    Like in Qt I use C++. Is it Actionscript?

  2. Can we say AIR is only for making UI's for apps.

  3. Where is the doc for the utility classes along with AIR?
    e.g. http://qt-project.org/doc/ for Qt

  4. Qt ships with a huge set of premade widgets that one can use. Does Adobe ship with any such widget set and if so where can i see it as in url?

  5. I understand flex SDK is open source. Can I make commerical apps and ship them ? Does flex SDK ship everything (compiler, utility classes/widgets)

  6. How much does AIR cost in terms of licensing?

  7. Is there something in AIR that is equivalent to QGraphicsView of QT?


Source: (StackOverflow)

Get Current Operating System In Adobe Air

I'm making an App using Adobe Flex/Air. I was wondering if there is any way to get the Operating System the Air app is running on?


Source: (StackOverflow)