Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 6.1. Creating a Programmatic Skin > Setting Up a Testing Harness

Setting Up a Testing Harness

The first step of this exercise is to create a simple Flex application to test your button skin. You’ll run this test several times throughout this exercise to verify that the ActionScript you write is drawing graphics as expected. Testing often is especially important when drawing complex graphics because you’ll catch problems sooner, which will make them easier to fix.

1.
In Flex Builder, create a new Flex Project by choosing File > New > Flex Project.

2.
Name the project CVE_601_ProgrammaticSkinning and accept the rest of the default values in the New Flex Project dialog by clicking Finish.

3.
If you’re prompted to switch to the Flex Development perspective, go ahead and click Yes.

4.
A file called CVE_601_ProgrammaticSkinning.mxml is automatically created with the new project. In this file, you’ll create a couple of buttons, one enabled and one disabled, as shown in Listing 6.1-1.

Listing 6.1-1. Testing harness with two buttons, one enabled and one disabled

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
      xmlns:mx="http://www.adobe.com/2006/mxml"
      layout="vertical" >

      <mx:Button enabled="true" label="Enabled" />
      <mx:Button enabled="false" label="Disabled" />

</mx:Application>

Note

Make sure you change the value layout property to vertical so that the enabled and disabled buttons do not overlap.

5.
Run this application to make sure you have two buttons, one enabled and one disabled, as shown in Figure 6.1-3.

Figure 6.1-3. The testing harness before skinning



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial