EzDevInfo.com

flex interview questions

Top flex frequently asked interview questions

How would I start learning how to program in Flex? [closed]

Can anyone give me pointers to good books or web sites that teach how to do Flex programming?


Source: (StackOverflow)

How do I correctly pass the string "Null" (an employee's proper surname) to a SOAP web service from ActionScript 3?

We have an employee whose last name is Null. Our employee lookup application is killed when that last name is used as the search term (which happens to be quite often now). The error received (thanks Fiddler!) is:

  <soapenv:Fault>
   <faultcode>soapenv:Server.userException</faultcode>
   <faultstring>coldfusion.xml.rpc.CFCInvocationException: [coldfusion.runtime.MissingArgumentException : The SEARCHSTRING parameter to the getFacultyNames function is required but was not passed in.]</faultstring>

Cute, huh?

The parameter type is string.

I am using:

  • WSDL (SOAP).
  • Flex 3.5
  • ActionScript 3
  • ColdFusion 8

Note that the error DOES NOT occur when calling the webservice as an object from a ColdFusion page.


Source: (StackOverflow)

Advertisements

How to view shell commands used by eclipse "run configurations"

Given a "run configuration" in Eclipse, I want to print out the associated shell command that would be used to run it.

For example: Right now, in Eclipse, if I click "play" it will run:

mvn assembly:directory -Dmaven.test.skip=true

I don't see that command, I just know that's what the IDE must run, at some point. However, some of the other run configurations are far more complex with long classpaths and virtual machine options and, frankly, sometimes I have no idea what the equivalent shell command would be (particularly when it comes to Flex).

There must be some way to access the shell command that would be associated with a "Run Configuration" in Eclipse/Flex Builder. This information must be available, which leads me to believe someone has written a plugin to display it. Or maybe there's already an option built into Eclipse for accessing this.

So is there a way to, essentially, convert an Eclipse run configuration into a shell command?

(for context only: I'm asking because I'm writing a bash script that automates everything I do, during development--from populating the Database all the way to opening Firefox and clearing the cache before running the web app. So every command I run from the IDE needs to exist in the script. Some are tricky to figure out.)


Source: (StackOverflow)

Flash/Flex conditional compilation "else"

In AS3 you can pass a constant to the compiler

-define+=CONFIG::DEBUG,true

And use it for conditional compilation like so:

CONFIG::DEBUG {
   trace("This only gets compiled when debug is true.");
}

I'm looking for something like #ifndef so I can negate the value of debug and use it to conditionally add release code. The only solution I've found so far was in the conditional compilation documentation at adobe and since my debug and release configurations are mutually exclusive I don't like the idea of having both DEBUG and RELEASE constants.

Also, this format works, but I'm assuming that it's running the check at runtime which is not what I want:

if (CONFIG::DEBUG) {
   //debug stuff
}
else {
   //release stuff
}

I also considered doing something like this but it's still not the elegant solution I was hoping for:

-define+=CONFIG::DEBUG,true -define+=CONFIG::RELEASE,!CONFIG::DEBUG

Thanks in advance :)


Source: (StackOverflow)

HTTP Basic Authentication with HTTPService Objects in Adobe Flex/AIR

I'm trying to request a HTTP resource that requires basic authorization headers from within an Adobe AIR application. I've tried manually adding the headers to the request, as well as using the setRemoteCredentials() method to set them, to no avail.

Here's the code:

<mx:Script>
    <![CDATA[
    	import mx.rpc.events.ResultEvent;
    	import mx.rpc.events.FaultEvent;

    	private function authAndSend(service:HTTPService):void
    	{
    		service.setRemoteCredentials('someusername', 'somepassword');
    		service.send();
    	}

    	private function resultHandler(event:ResultEvent):void
    	{
    		apiResult.text = event.result.toString();
    	}

    	private function resultFailed(event:FaultEvent):void
    	{
    		apiResult.text = event.fault.toString();
    	}
    ]]>
</mx:Script>

<mx:HTTPService id="apiService"
    url="https://mywebservice.com/someFileThatRequiresBasicAuth.xml"
    resultFormat="text"
    result="resultHandler(event)"
    fault="resultFailed(event)" />

<mx:Button id="apiButton"
    label="Test API Command"
    click="authAndSend(apiService)" />

<mx:TextArea id="apiResult" />

However, a standard basic auth dialog box still pops up prompting the user for their username and password. I have a feeling I'm not doing this the right way, but all the info I could find (Flex docs, blogs, Google, etc.) either hasn't worked or was too vague to help.

Any black magic, oh Flex gurus? Thanks.


EDIT: Changing setRemoteCredentials() to setCredentials() yields the following ActionScript error:

[MessagingError message='Authentication not supported on DirectHTTPChannel (no proxy).']


EDIT: Problem solved, after some attention from Adobe. See the posts below for a full explanation. This code will work for HTTP Authentication headers of arbitrary length.

import mx.utils.Base64Encoder;
private function authAndSend(service:HTTPService):void
{
        var encoder:Base64Encoder = new Base64Encoder();
        encoder.insertNewLines = false; // see below for why you need to do this
        encoder.encode("someusername:somepassword");

        service.headers = {Authorization:"Basic " + encoder.toString()};                                                
        service.send();
}

Source: (StackOverflow)

How do I get from an instance of a class to a Class object in ActionScript 3?

How do you get an instance of the actionscript class Class from an instance of that class?

In Python, this would be x.__class__; in Java, x.getClass();.

I'm aware that certain terrible hacks exist to do this, but I'm looking for a built-in language facility, or at least a library routine built on something reliable.


Source: (StackOverflow)

adobe air vs flex vs flash builder --- i need an explanation please

Can someone explain to me the difference between Adobe Air, Flex, and Flash Builder?

I went to the Adobe website and it said that with Air I can build standalone apps for the desktop or mobile. They said the same thing with Flex.

It said Flash Builider is an Eclipse based development tool. What does THAT mean? And then it said that I could again build applications for the desktop and mobile.

There is so much overlap, I don't really understand what first to learn and what direction to take. (I know Flash and AS2 & AS3 very well.)


Source: (StackOverflow)

Scroll to selected item in Flex 4 Spark List component

I'm setting selected element in s:List component with Actionscript, it works, but List doesn't scroll to selected item -- need to scroll with scrollbar or mouse. Is it possible to auto-scroll to selected item ? Thanks !


Source: (StackOverflow)

How does JavaFX compare to Flash and Flex? [closed]

I know Flex pretty good but also started to use Java FX. I am a little bit confused. Java FX seems to focus more on low level drawing operations and animations. Less on creating standard UIs like Flex.

So is JavaFX more like Flash than Flex?

On the other side JavaFX also supports Swing components as well as data binding, which makes it appear more like Flex.


Source: (StackOverflow)

How can I get an instance's "memory location" in ActionScript?

FlexBuilder's debugger will show you the "memory location" (or, I can only assume, something roughly analagous) of any in-scope instance:

debugger memory location

But I'd like to get this information in code (sort of like Python's id function), so I could very easily trace how objects move through out the system. For example, I might have:

trace("Returning", id(foo));

Then somewhere else I could use:

trace("Using", id(foo));

To make sure both bits of code are dealing with the same instance.

Now, I know that many AS classes implement the IUID interface... But there are also a bunch of classes which don't (plain old arrays and objects, for example), so that wouldn't solve my problem.

I realize that I could also wrap objects in an ObjectProxy, but that would be less than ideal as well.


Source: (StackOverflow)

how to get a Flex text control to word wrap

I'm creating an Adobe Flex application and I have a Text control (mx:Text), which is supposedly used when you need multiline noneditable text (as opposed to a Label, which is single line noneditable text). My text control does not wrap when I resize the browser window to be smaller than the text (or load it with the browser window already smaller). Upon consulting this doc that I found, it would seem that the word-wrap functionality only happens if you specify an absolute width in pixels. That is exactly what I'm trying to avoid. I want the text to wrap to fit inside the size given to my Flash object so that it is always visible... is there any way to accomplish this, through some property I'm missing or perhaps a different control? Thanks.


Source: (StackOverflow)

konami code in flex

What would be the best way to implement the konami code into a flex application?

I want to create a component to add it on all my proyects, just for fun.

thanks

UPDATE: I made a simple component, thanks to ZaBlanc

<?xml version="1.0" encoding="utf-8"?>
<mx:UIComponent xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">
    <mx:Metadata>
    	[Event(name="success", type="flash.events.Event")]
    </mx:Metadata>
    <mx:Script>
    	<![CDATA[

    		// up-up-down-down-left-right-left-right-B-A
    		public static const KONAMI_CODE:String = "UUDDLRLRBA";

    		// signature
    		private var signatureKeySequence:String = "";

    		private function init():void{
    			systemManager.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
    		}

    		private function onKeyDown(event:KeyboardEvent):void{
    			var keyCode:int = event.keyCode;

    		    switch (keyCode) {
    		        case Keyboard.UP:
    		            signatureKeySequence += "U";
    		            break;

    		        case Keyboard.DOWN:
    		            signatureKeySequence += "D";
    		            break;

    		        case Keyboard.LEFT:
    		            signatureKeySequence += "L";
    		            break;

    		        case Keyboard.RIGHT:
    		            signatureKeySequence += "R";
    		            break;

    		        case 66: //Keyboard.B only for AIR :/
    		            signatureKeySequence += "B";
    		            break;

    		        case 65: //Keyboard.A only for AIR too :(
    		            signatureKeySequence += "A";
    		            break;

    		        default:
    		            signatureKeySequence = "";
    		            break;
    		    }

    		    // crop sequence
    		    signatureKeySequence = signatureKeySequence.substr(0, KONAMI_CODE.length);

    		    // check for konami code
    		    if (signatureKeySequence == KONAMI_CODE) {
    		        dispatchEvent(new Event("success"));
    		        signatureKeySequence = "";
    		    }

    		}
    	]]>
    </mx:Script>

</mx:UIComponent>

to test it

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:konamicode="konamicode.*">
    <mx:Script>
    	<![CDATA[
    		import mx.controls.Alert;
    	]]>
    </mx:Script>
    <konamicode:KonamiCodeCatch success="Alert.show('+30 lives!!!')" />
</mx:Application>

Source: (StackOverflow)

Difference between Adobe AIR and FLEX?

What is the difference between Adobe AIR and FLEX?


Source: (StackOverflow)

Is it feasible to create a REST client with Flex?

I'm starting a project using a Restful architecture implemented in Java (using the new JAX-RS standard)

We are planning to develop the GUI with a Flex application. I have already found some problems with this implementation using the HTTPService component (the response error codes, headers access...).

Any of you guys have some experience in a similar project. Is it feasible?


Source: (StackOverflow)

Adobe AIR to execute program

I would like to press a button from an Adobe AIR application and execute some installed program. For example, I would have a button named "Start Winamp". When this is pressed it should start Winamp.exe directly...I don't want some command line thing executed, I only want an exe to start. Or...is it the same thing ? Please, let me know if this is possible.

Thank you.


Source: (StackOverflow)