Chapter 3. Hello Spark: primitives, components, FXG and MXML graphics, and even video
In this chapter, you’ll start learning Spark, which is the new set of components, containers, and graphics primitives in Flex 4. This will be a “how-to” chapter: we’ll save diving into the Spark component model until the next chapter (which discusses view states, containers, CSS styling, and skinning). This chapter provides enough examples of using Spark that when it comes time to tackle the theory you’ll have plenty of examples in your head.
In four of the five workshop sessions in this chapter, we’ll build a fairly small, self-contained Tester.mxml app that has all the code in the example. In session 14, however, I’ll mix things up a little: we’ll build an “Only Connect” game (that bears strong resemblance to a certain trademarked game). We’ll start with a game board that I drew in Adobe Illustrator and saved as FXG. (I’m providing the FXG file I created, so you don’t need to have Adobe Illustrator.) We’ll then build a fully functioning game based on this FXG, before refactoring it and then adding logic for detecting victory. The victory detection logic is more complex code than you saw in the previous chapter, so if you’re new to ActionScript 3 it will be good to read through it. (And if you’re a “rock star” developer, you can refactor my code to be a lot more efficient.)