Developing Flash Applications with Flex Builder

Flex Builder is built on top of Eclipse, and it allows you to develop Flash applications on Linux.

When run, the program looks like Figure 2.

Figure 2. First Run of the Quiz Program as Seen in Firefox

As you see, the text is very small. You can set the text size by using htmltext instead of text. I also corrected the problem that the text is too close to the borders of the movie by adding padding, I assigned an ID (name) to the control, so I can refer to it in scripts, and I made it non-editable, which then gives us Listing 2.

I still need to add the answer selections as radio buttons and a Next button. In Listing 3, I have added our first bit of ActionScript, a function that evaluates whether the correct answer is selected and gives immediate feedback by way of a dialog box. Anything other than MXML in a project file is best kept inside CDATA tags, which prevent Flex from parsing it as XML. This applies to both ActionScript and HTML. ActionScript also can be stored in external files and loaded at runtime or during compilation.

Running the program now produces a single question, and clicking Next produces a simple message box (Figure 3).

Figure 3. Quiz Program with Answer-Checking

The dialog and other controls don't look “standard” for most operating systems, and developers will want to customize them. Flex and Flash support various “skinning” techniques that make it simple to change the appearance of controls, but those are beyond the scope of this article.

Obviously, this version of the quiz is only for testing purposes. It has one question and no provision for tabulating results. Now, it's time to create more questions. Because I'm deliberately not connecting to a server-side database for this article, I simply declared an array of data directly in the program's code.

It's a peculiarity of ActionScript (like its parent, ECMAScript) that it doesn't directly support multidimensional arrays. The workaround is to declare an array of arrays, as shown in Listing 4.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Unfortunately, Flex for Linux Is Dead

Anonymous's picture

If you check carefully, you'll find that Flex Builder for Linux hasn't been updated in over a year (other than a minor release so that it would continue functioning after a cutoff date). I've discussed this issue with other Flex developers and unfortunately we all seem to be in agreement... Adobe is not going to continue developing on the Linux platform. You can simply look at the absence of any activity by Adobe on that subject especially after they just released a new version of Flex, now called Flash Builder 4.


P.S. Your article was nice.