Tải bản đầy đủ (.pdf) (50 trang)

Flash Builder 4 and Flex 4 Bible- P21

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (480.83 KB, 50 trang )

Chapter 31: Deploying Desktop Applications with Adobe AIR
971
FIGURE 31.9
An AIR installer’s confirmation screen
Uninstalling AIR applications
You uninstall an AIR desktop application in the same manner as most other native applications.
Follow these steps to uninstall AIR applications in Windows:
1.
Go to the Windows Control Panel.
2.
Select Add or Remove Programs on Windows XP or Uninstall a program on
Windows Vista or Windows 7.
3.
Select the application entry.
4.
Click Remove on Windows XP or Uninstall on Windows Vista or Windows 7.
5.
When the Adobe AIR Setup dialog box appears, click Uninstall to remove AIR from
your system.
To uninstall an AIR application on Mac OS X, just delete the application package file from the
/Applications
folder by dragging it into the trash.
Note
Running the AIR installation package file after the application is installed also results in displaying the setup
dialog box and displays the uninstall option.
n
Flex Application Tips and Tricks with AIR
As described earlier in this chapter, the subject of developing Flex applications for desktop deploy-
ment with AIR is too large for a single chapter. There are, however, a few specific things you do a
bit differently in a desktop application, and there are many Flex SDK features that are available
only when you’re developing for AIR. These include:


40_488959-ch31.indd 97140_488959-ch31.indd 971 3/5/10 2:49 PM3/5/10 2:49 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Part V: Additional Subjects
972
l
Debugging AIR applications in Flash Builder
l
Rendering and managing HTML-based and PDF-based content
l
Using the
WindowedApplication
component as the application’s root element
l
Creating channels at runtime for communicating with Remoting gateways
In this section, I briefly describe some of these programming and development techniques.
On the Web
If you want to review the sample applications described in this section, extract the contents of the
chap-
ter31.zip
file into the root folder of the
chapter30
Flex desktop application project. Each sample applica-
tion includes both an application file and an application descriptor file.
n
Debugging AIR applications in Flash Builder
For the most part, debugging an AIR application in Flash Builder is just like debugging a Web-
based Flex application. You have access to all the same debugging tools, including the
trace()

function, breakpoints, and the capability to inspect the values of application variables when the

application is suspended.
When you run a Flex application from within Flash Builder in either standard or debug mode, Flash
Builder uses ADL (AIR Debug Launcher) in the background. In some cases, ADL can stay in system
memory with hidden windows even after an AIR application session has apparently been closed.
The symptom for this condition is that when you try to run or debug that or another application,
Flash Builder simply does nothing. Because a debugging session is still in memory, Flash Builder
can’t start a new one.
Follow these steps to recover from this condition in Windows:
1.
Open the Windows Task Manager.
2.
In the Processes pane, locate and select the entry for
adl.exe
.
3.
Click End Process to force ADL to shut down.
4.
Close Task Manager, and return to Flash Builder.
Follow these steps to recover from this condition on the Mac:
1.
In the Apple menu, select Force Quit.
2.
In the Force Quit dialog box, select adl and click the Force Quit button.
3.
Close the Force Quit dialog box, and return to Flash Builder.
You should now be able to start your next AIR application session successfully. One common sce-
nario that can result in this problem is when a runtime error occurs during execution of startup code.
For example, if you make a call to a server-based resource from an application-level
creation
40_488959-ch31.indd 97240_488959-ch31.indd 972 3/5/10 2:49 PM3/5/10 2:49 PM

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Chapter 31: Deploying Desktop Applications with Adobe AIR
973
Complete
event handler and an unhandled fault occurs, the application window might never
become visible. If you’re running the application in debug mode, you can commonly clear the ADL
from memory by terminating the debugging session from within Flash Builder. When running in
standard mode, however, the ADL can be left in memory with the window not yet visible.
To solve this issue, it’s a good idea to explicitly set the application’s initial windows as visible. In
the application descriptor file, the
<initialWindow>
element’s child
<visible>
property is
commented out by default. Because this value defaults to
false
, if the window construction code
never succeeds to a runtime error, you’re left with an invisible window and ADL still in memory.
To solve this, open the application’s descriptor file, uncomment the
<visible>
element, and set
its value to
true
:
<visible>true</visible>
Working with HTML-based content
The Flex framework offers two ways of creating a Web browser object within any application:
l
The
HTMLLoader

class is extended from the Sprite class and can be used in any
Flash or Flex application. Because this class doesn’t extend from
UIComponent
, you
can’t add it to a Flex container with simple MXML code or by using the
addChild()
or
addElement()
methods.
l
The
HTML
control is extended from
UIComponent
and can be instantiated with
either MXML or ActionScript code.
The
HTML
control is quite a bit easier to use and provides the same functionality as
HTMLLoader
.
Declaring an instance of the control results in a Web browser instance that can freely navigate to
any location on the Web (assuming the client system is currently connected).
Instantiating the HTML control
As with all visual controls, the
HTML
control can be instantiated in MXML or ActionScript code.
After it’s been instantiated, its
location
property determines which Web page is displayed. This

HTML
object, for example, displays Adobe’s home page and expands to fill all available space
within the application:
<mx:HTML id=”myHTML” width=”100%” height=”100%”
location=””/>
When you assign the
HTML
control’s
id
property, you can then reset its location as needed from any
ActionScript code. This statement resets the
HTML
control’s
location
to the Wiley home page:
myHTML.location = “”;
The application in Listing 31.2 uses an
HTTPService
object to retrieve an RSS listing from a
URL. When the user selects an item from the
ComboBox
that presents the RSS items, a bit of
ActionScript code causes the
HTML
object to navigate to the selected Web page.
40_488959-ch31.indd 97340_488959-ch31.indd 973 3/5/10 2:49 PM3/5/10 2:49 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Part V: Additional Subjects
974
Note

Because the structure of an RSS feed is consistent regardless of the data provider, this application should work
with any RSS feed from any data provider.
n
LISTING 31.2
A Flex desktop application displaying Web pages from an RSS feed
<?xml version=”1.0” encoding=”utf-8”?>
<s:WindowedApplication xmlns:fx=”
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx”
width=”900” height=”600”
creationComplete=”app_creationCompleteHandler(event)”>
<fx:Declarations>
<s:HTTPService id=”photosXML” url=”{feedURL}”
result=”resultHandler(event)” fault=”faultHandler(event)”/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
private const feedURL:String =
“ /> [Bindable]
private var feed:ArrayCollection;
private function resultHandler(event:ResultEvent):void
{
feed = event.result.rss.channel.item as ArrayCollection;
feedSelector.selectedIndex = 0;
updateHTML();

}
private function faultHandler(event:FaultEvent):void
{
Alert.show(event.fault.faultString, event.fault.faultCode);
}
private function updateHTML():void
{
myHTML.location = feedSelector.selectedItem.link;
}
protected function app_creationCompleteHandler(event:FlexEvent):void
{
photosXML.send();
}
40_488959-ch31.indd 97440_488959-ch31.indd 974 3/5/10 2:49 PM3/5/10 2:49 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Chapter 31: Deploying Desktop Applications with Adobe AIR
975
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout paddingTop=”20” paddingLeft=”10” paddingRight=”10”/>
</s:layout>
<s:HGroup>
<s:Label text=”Select a title:”/>
<s:DropDownList id=”feedSelector”
width=”700”
dataProvider=”{feed}”
labelField=”title”
change=”updateHTML()”/>
</s:HGroup>

<mx:HTML id=”myHTML” width=”100%” height=”100%”/>
</s:WindowedApplication>
On the Web
The code in Listing 31.2 is available in the Web site files in the
chapter31
project as
NewTitlesReader.
mxml
.
n
Figure 31.10 shows the completed application, displaying the contents of the RSS feed in the
DropDownList
and a currently selected Web page in the
HTML
component.
FIGURE 31.10
A simple RSS feed application displaying Web pages in an HTML component instance
40_488959-ch31.indd 97540_488959-ch31.indd 975 3/5/10 2:49 PM3/5/10 2:49 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Part V: Additional Subjects
976
Navigating with the HTML control
In addition to the location property, the
HTML
control implements these methods that enable you
to control navigation with ActionScript code:
l
historyBack()
. Navigates back one step in the control’s history list.
l

historyForward()
. Navigates back one step in the control’s history list.
l
historyGo(steps:int)
. Navigates the number of steps. The value of the
steps

argument can be positive to move forward or negative to move back.
As described earlier, the runtime doesn’t include a copy of Acrobat Reader but instead requires that
this software package is already installed on the client system. You can find out whether the cur-
rent client system is capable of displaying Acrobat PDF documents by evaluating the
HTML
con-
trol’s static
pdfCapability
property. The property’s value is matched to constants in a
PDFCapability
class with these values and meanings:
l
ERROR_INSTALLED_READER_NOT_FOUND
. No version of Acrobat Reader is installed.
l
ERROR_INSTALLED_READER_TOO_OLD
. Acrobat Reader is installed, but it’s older than
version 8.1.
l
ERROR_PREFERED_READER_TOO_OLD
. Acrobat Reader 8.1 or later is installed, but
another older version is viewed by the operating system as the preferred application for
PDF documents.

l
STATUS_OK
. Acrobat Reader 8.1 or later is installed.
The application in Listing 31.3 is a simple Web browser application. The application’s
navi-
gate()
function examines the file extension of a document requested by a client application. If
the file extension is
.pdf
and Acrobat Reader 8.1 or later isn’t detected, the application displays
an error to the user.
LISTING 31.3
A browser application reading PDF content
<?xml version=”1.0” encoding=”utf-8”?>
<s:WindowedApplication xmlns:fx=”
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx”
width=”1024” height=”768”>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
[Bindable]
private var myURL:String = “http://”;
private function navigate():void
{
40_488959-ch31.indd 97640_488959-ch31.indd 976 3/5/10 2:49 PM3/5/10 2:49 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Chapter 31: Deploying Desktop Applications with Adobe AIR
977
myURL = urlInput.text;

if (myURL.substr(0,4) != “http”)
{
myURL = “http://” + myURL;
}
var fileExtension:String = myURL.substr(myURL.length-3, 3);
if (fileExtension.toLowerCase() == “pdf” &&
HTML.pdfCapability != HTMLPDFCapability.STATUS_OK)
{
Alert.show(“This request requires Acrobat Reader 8.1 or later”,
“Acrobat Error”);
}
else
{
myHTML.location = myURL;
status = myURL;
}
}
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout paddingTop=”20” paddingLeft=”10” paddingRight=”10”/>
</s:layout>
<s:HGroup verticalAlign=”middle”>
<s:Label text=”My AIR Web Browser” fontWeight=”bold” fontSize=”14”/>
<mx:Spacer width=”25”/>
<s:Label text=”New URL:” fontWeight=”bold” fontSize=”10”/>
<s:TextInput id=”urlInput” text=”{myURL}” enter=”navigate()”/>
<s:Button label=”Go” click=”navigate()”/>
</s:HGroup>
<mx:HTML id=”myHTML” width=”100%” height=”100%”/>

</s:WindowedApplication>
On the Web
The code in Listing 31.3 is available in the Web site files in the
chapter31
project as
AIRWebBrowser.
mxml
.
n
Using the WindowedApplication component
Flex applications designed for desktop deployment typically use
<s:WindowedApplication>

as the application root element. A beginning desktop application’s code looks like this:
<?xml version=”1.0” encoding=”utf-8”?>
<s:WindowedApplication xmlns:fx=”
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx”>
40_488959-ch31.indd 97740_488959-ch31.indd 977 3/5/10 2:49 PM3/5/10 2:49 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Part V: Additional Subjects
978
<fx:Declarations>
<!-- Place non-visual elements
(e.g., services, value objects) here -->
</fx:Declarations>
</s:WindowedApplication>
The
WindowedApplication
component is extended from

Application
and provides all the
application-level functionality you expect from a typical Flex application. It also adds these capa-
bilities that are unique to Flex desktop applications:
l
Native menus can be displayed and integrated into the overall application look and feel.
l
The application can be integrated with a dock or system tray icon to provide easy access to
common application functions.
l
The application can display operating system-specific “chrome” (the graphics in the appli-
cation window’s border, title bar, and control icons).
l
A status bar can be displayed at the bottom of the application window for string-based sta-
tus messages.
Here’s one example: The
WindowedApplication
component can display a status bar at the bot-
tom of the application window. This display is controlled by two of the
WindowedApplication

component’s properties:
l
showStatusBar:Boolean
. When this property is
true
(the default), the application
window displays a status bar.
l
status:String

. The string value displayed in the status bar.
The following modified custom
updateHTML()
function from the
NewTitlesReader
applica-
tion updates the application’s status bar with the title of the currently selected RSS item:
private function updateHTML():void
{
myHTML.location = feedSelector.selectedItem.link;
status = “Current Title: “ + feedSelector.selectedItem.title;
}
Creating Remoting channels at runtime
When a Web-based Flex application communicates with an application server that supports Flash
Remoting (known as the Remoting Service in LiveCycle Data Services and BlazeDS), it typically
uses a channel definition with dynamic expressions that evaluate at runtime to the location of the
server from which the application was downloaded. This is the default
my-amf
channel delivered
with BlazeDS:
<channel-definition id=”my-amf”
class=”mx.messaging.channels.AMFChannel”>
<endpoint
40_488959-ch31.indd 97840_488959-ch31.indd 978 3/5/10 2:49 PM3/5/10 2:49 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Chapter 31: Deploying Desktop Applications with Adobe AIR
979
url=”http://{server.name}:{server.port}/{context.root}/
messagebroker/amf” class=”flex.messaging.endpoints.AMFEndpoint”/>
</channel-definition>

The
<endpoint>
element’s
url
attribute uses dynamic expressions to evaluate the server name
and port and the context root of the hosting instance of BlazeDS.
This approach doesn’t work with desktop applications deployed with AIR, because the concept of
“the current application server” doesn’t have any meaning in a desktop application. Instead, you
must provide the explicit location of the server-based application to which Remoting requests
should be sent at runtime.
You can solve this in one of two ways:
l
If the location of the server providing Remoting Services is always the same, you can
define a custom channel in the application’s services configuration file with a hard-coded
url
:
<endpoint url=”
class=”flex.messaging.endpoints.AMFEndpoint”/>
l
For flexibility and the capability to set a
url
at runtime, declare a channel in either
MXML or ActionScript code.
The
RemoteObject
component has a
channelSet
property, cast as a class named
ChannelSet
, that contains one or more instances of the

AMFChannel
component. To declare a
runtime channel in MXML, nest the
<mx:ChannelSet>
tag inside a
<mx:RemoteObject>
tag
pair’s
<mx:channelSet>
property. Then nest one or more
<mx:AMFChannel>
tags, and assign
each a
uri
property pointing to the selected server and its Remoting
url
.
Note
If you declare more than one
AMFChannel
tag inside the
channelSet
, they’re treated as a list in order of
preference. The client application always tries to use the first channel; if there’s a communication failure, it
goes to the next one, and so on.
n
The following
RemoteObject
instance declares a single
AMFChannel

at runtime:
<s:RemoteObject id=”myRO” destination=”myRemotingDestination”>
<s:channelSet>
<s:ChannelSet>
<s:channels>
<s:AMFChannel uri=”http://myserver/messagebroker/amf”/>
</s:channels>
</s:ChannelSet>
</s:channelSet>
</s:RemoteObject>
40_488959-ch31.indd 97940_488959-ch31.indd 979 3/5/10 2:49 PM3/5/10 2:49 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Part V: Additional Subjects
980
You can accomplish the same result with ActionScript. The following ActionScript code creates a
ChannelSet
object, populates it with a single
AMFChannel
object, and adds it to the
RemoteObject
component:
var endpointURL:String = “http://myserver/messagebroker/amf”;
var cs:ChannelSet = new ChannelSet();
var customChannel:Channel =
new AMFChannel(“myCustomAMF”, endpointURL);
cs.addChannel(customChannel);
myRemoteObject.channelSet = cs;
Tip
You also can create channels at runtime for use with the Message Service, Proxy Service, and Data
Management Service when using LiveCycle Data Services or BlazeDS.

n
Note
When communicating with remote servers using the
HTTPService
or
WebService
components in a desktop
application, you don’t have to deal with the cross-domain security constraint as you do with Web-based Flex
applications. Because the application loads locally, it isn’t subject to the restrictions of the Web browser’s
security sandbox and can make connections freely over the Web just like any other local application.
n
A Conclusion about Adobe AIR
In addition to the features described in this chapter, AIR applications can accomplish the following
tasks that aren’t possible with Flex Web applications:
l
Full screen and spanned monitor display
l
Integration with native visual components such the operating system’s window and menu
systems
l
Creation of applications with transparency that serve as widgets
l
Reading and writing files and folders on the local file system
l
Persisting data in SQLite, a local database embedded in the runtime
l
Interacting with the system clipboard, including drag-and-drop to and from AIR applica-
tions and the OS
l
Synchronization of data managed on the server by LiveCycle Data Services

l
Access to all network services supported by the Flex framework
The subject of building and deploying AIR-based desktop applications is worthy of an entire book,
and in fact there are many such books available. In particular, check out the Adobe AIR Bible (from
Wiley, of course!).
40_488959-ch31.indd 98040_488959-ch31.indd 980 3/5/10 2:49 PM3/5/10 2:49 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Chapter 31: Deploying Desktop Applications with Adobe AIR
981
Summary
In this chapter, I described how to build and deploy desktop Flex applications with the Adobe
Integrated Runtime. You learned the following:
l
Adobe AIR enables you to build and deploy cross-operating system desktop applications
with Flex, Flash, or HTML.
l
Users can download and install AIR freely from Adobe Systems.
l
Flash Builder 4 includes everything you need to build and deploy AIR applications.
l
Each AIR application requires an application descriptor file that determines how an appli-
cation is packaged and delivered.
l
You must provide a security certificate to create an AIR application installer file.
l
Flash Builder 4 enables you to create a self-signed security certificate suitable for testing or
deployment within an organization.
l
For public deployment of AIR applications, a security certificate issued by a recognized
certificate authority is strongly recommended.

l
Flex applications built for AIR commonly use
<s:WindowedApplication>
as the
application’s root element.
l
The Flex framework’s
HTML
control displays both HTML and PDF content.
l
You can declare channels at runtime for use with Remoting destinations called from a
Flex-based desktop application.
40_488959-ch31.indd 98140_488959-ch31.indd 981 3/5/10 2:49 PM3/5/10 2:49 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
40_488959-ch31.indd 98240_488959-ch31.indd 982 3/5/10 2:49 PM3/5/10 2:49 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
983
and Java, passing data between, 840–841
looping, 119
Menu
control, 494
menu events, handling, 493
versus MXML, 6–8
MXML and, 101–103
named parameters, passing, 744
navigator containers, working with, 477–482
objects, declaring in, 7–8
overview, 114
package declarations in, 541
percentage sizing, 334

to PHP data serialization, 932
pie chart, 651
populating value object data with, 699
Producer
component, 857
RemoteObject
, 830, 882
reverse domain package names, 141
runtime channel, declaring in, 980
serialized objects in, 862
subtopics, filtering messages with, 869–870
syntax, 114
text
property, 255
TextFlow
class, 256
validating data entry with, 691–695
validator object, 688
value objects, 551–552, 842–845, 895–896, 899
variables, declaring, 114–117
WebService
, 784, 795–796
XML structure, hard-coded, 752
XMLListCollection
, 755
ActionScript 3.0 Language Reference, 29
actionscript
adapter, 854–855, 862
ActionScript class option, 238
ActionScript Class Warning dialog box, 67

ActionScript editor, Flash Builder, 50–51, 125–128, 180–181,
191–192
ActionScript File option, 121
ActionScript Virtual Machine (AVM), 99, 727, 786
adapters, Message Service, 850, 854–855
Add or Remove Programs option, 971
A
absolute address, 724
absolute layout, 78, 133, 253, 311, 330
absolute sizing, 333, 334
absolute-layout properties,
Canvas
container, 315
abstraction layer, SOAP-based Web service, 779
acceptDragDrop()
method, 395
access
attribute, CFCs, 878
access modifiers, 115–116, 153, 543, 582
accessor methods, 539, 545–549
Accordion
container, 472, 497, 500–502
acompc command-line tool, 28
Acrobat PDF, 809, 955, 976–977
Acrobat Reader, 976
Action Message Format. See AMF Zend AMF
ActionScript 2, 99
ActionScript 3. See also E4X effects; value objects
ActionScript Virtual Machine, 99
arguments, passing to remote methods, 839

classes, 48, 139–140, 440–441, 897
combining MXML and, 120–128
complex data objects, selecting with, 607–610
component methods, calling with statements, 154–155
conditional statements, 117–119
Consumer
component, 858–859
control properties and styles, setting with, 251
controlling styles with, 366–369
controls, instantiating with, 250–251
custom classes, 237–242, 534, 698
data collections, 554, 578
data conversion from ColdFusion to, 879
defined, 5
effects, declaring in, 375–377
embedded fonts, declaring, 302
event listener, executing single statement in, 210
fault
event, 901
formatter
objects, 306
functions, handling events with, 211–213
handling events of multiple operations, 791
HTTPService
object, creating, 723
41_488959-bindex.indd 98341_488959-bindex.indd 983 3/5/10 2:50 PM3/5/10 2:50 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
984
Index
installing, 958–959

list controls for, 573
LiveCycle Data Services features, 809
local data, retrieving in applications, 578
overview, 11, 955–956, 980–981
Proxy Service, 821
remoting channels at runtime, creating, 978–980
Version 2, 957
WindowedApplication
component, 977–978
Adobe AIR Installer application, 959
Adobe AIR Setup dialog box, 959, 971
Adobe AIR Uninstaller application, 959
Adobe ColdFusion. See ColdFusion
Adobe Community Help application, 29, 55–57
Adobe Creative Suite, 19, 420, 432–439. See also specific
programs by name
Adobe Developer Center Web site, 879
Adobe Dreamweaver, 93–96
Adobe Fireworks, 437–439
Adobe Flash Builder 4. See Flash Builder 4
Adobe Flash Catalyst, 4, 5, 10
Adobe Flash Player. See Flash Player
Adobe Flex 4. See Flex 4
Adobe Flex 4 SDK Command Prompt option, 28
Adobe Illustrator, 433–437, 439
Adobe Integrated Runtime. See Adobe AIR
Adobe Labs Web page, 25
Adobe Open Source Web site, 809, 810
Adobe Photoshop, 432–433
Adobe Web site

AIR installer, 958
Flash Player installation from, 24–26
Flex themes, 342
FXG specifications, 420
getting help from, 29
LiveCycle Data Services features, 809
adt command-line tool, 27
advanced text layout, 288–294
AdvancedDataGrid
control, 572, 641–645. See also list
controls
AdvancedDataGridColumn
control, 642
AdvDataGridDemo.mxml
file, 643
AdvDataGridFlatData.mxml
file, 645
AeonGraphical theme, 342
afterLast
property, 562
AIR, Adobe. See Adobe AIR
AIR Debug Launcher (ADL), 972–973
AIR file, 967, 969
airfare search application, 402–406
AIRWebBrowser.mxml
file, 977
Add Watch Expression dialog box, 191–192
AddAction
class, 415
AddChild

element, 408
addChild()
method, 148, 483
addChildAt()
method, 483
addData()
method, 392, 393
addElement()
method, 112, 148, 252
addElementAt()
method, 112
addEventListener()
method
custom event class, 245
event name constants, 226–227, 240
fault
event, 734–735
menu events, 493
overview, 223
PopUpManager
, 525
PopUpMenuButton
, 518
RemoteObject
component, 901
removing event listener, 227
result
event, 732, 833, 885
setting up event listener, 223–225
for single method, 791–792

void
return type, 213
WebService
, 785, 788
addItem()
method, 555, 576
addItemAt()
method, 555
Additional compiler arguments section, Properties dialog
box, 942, 944, 945
addPopUp()
method, 524, 525
addResourceBundle()
method, 948
addResponder()
method, 740
AddressRenderer.mxml
file, 624
ADL (AIR Debug Launcher), 972–973
adl command-line tool, 27
Adobe Acrobat PDF, 809, 955, 976–977
Adobe Acrobat Reader, 976
Adobe AIR
architecture of, 956–958
debugging applications, 972–973
desktop application, creating
application descriptor file, 963–967
Flex project for, 960–963
installing, 969–971
overview, 960

packaging release version of, 967–969
uninstalling, 971
drag-and-drop in, 389
versus Flash Player, 18
HTML-based content, 973–977
HTTPService
component
method
property, 725
image types, 282
41_488959-bindex.indd 98441_488959-bindex.indd 984 3/5/10 2:50 PM3/5/10 2:50 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
985
Index
angleYFrom
property, 382
angleYTo
property, 382
angleZFrom
property, 382
angleZTo
property, 382
Animate
effect, 372, 377–379
AnimateColor
effect, 372
AnimateDemo.mxml
file, 378–379
AnimateFilter
effect, 372

AnimateProperty
effect, 377
AnimateShaderTransition
effect, 372
AnimateTransform
effect, 372
animation, 9, 10, 371. See also effects; transitions
anonymous class, 594
anti-aliasing, 297, 303
Apache Axis, 779, 780
Apache document root folder, 919
Apache Tomcat 6. See Tomcat 6, Apache
Apache Web server, 917, 918
API (application programming interface). See also Logging API
ArrayList
class, modifying data with, 576–577
classes, 208
controls, 250
encapsulation, 13–14
events, 221
app_creationCompleteHandler()
function, 224–225
Appearance view, Flash Builder, 54, 355
applets, 91–92
Application
component
calling Web services from, 785
containership, 111–112
contentGroup
property, 148

custom skin for
applying with style sheet declaration, 453
assigning skin, 451–452
associating with host component, 446–447
creating, 444–446
FXG graphics, adding to, 449–451
loading at runtime, 454–455
overview, 444
skin parts, adding required, 448–449
skin states, declaring required, 447–448
dimensions, controlling, 130–131
layout
property, setting, 131–134
MenuBar
control, 496
overview, 8, 128–129
passing parameters, 130
view states, 399
application descriptor file, 963–967, 973
application location, 282
application programming interface. See API; Logging API
AJAX (Asynchronous JavaScript and XML), 470
Alert
class
buttons, managing, 506–508
CSS selectors, using with, 512–514
custom graphical icon, 509–512
events, handling, 508–509
fault
event, 734–735, 790, 791, 792

modality, controlling, 504–506
overview, 503, 504
Panel
container, 327
RadioButton
controls, 270–271
show()
method, 504
AlertDemos.mxml
file, 512
Alert.NONMODAL
constant, 505, 506
AlertWithStyles.mxml
file, 514
alias
attribute, 894, 895, 896
aliases, constants as, 152
all
value,
creationPolicy
property, 483
<allow-access-from>
element, 747
allowDisjointSelection
property, 273
Allowed IP Addresses screen, ColdFusion Administrator, 906
Allowed Services list, User Manager screen, 906
allowMultipleSelection
property, 273, 635
allowMultipleSelections

property, 584, 585
allowScriptAccess
parameter, 86
allow-source-path
compiler argument, 952
<allow-subtopics>
element, 866
alpha styles, 133, 316
alphaFrom
property, 379
alphaTo
property, 379
alternatingItemColors
style, 614
altKey
property, 220, 222
AMF (Action Message Format). See also Zend AMF
documentation, 825
Message Service channels, 852–853
overview, 825
PHP, services for, 924–925
RemoteObject
class, 205, 578, 830
value object classes, 539
AMF0, 825
AMF3, 825
AMFChannel
component, 878, 979–980
AMFPHP, 825, 924, 929–931
amxmlc command-line tool, 28

anchors, Constraints interface, 331–332
angleBy
property, 381
angleFrom
property, 381
angleTo
property, 381
angleXFrom
property, 382
angleXTo
property, 382
41_488959-bindex.indd 98541_488959-bindex.indd 985 3/5/10 2:50 PM3/5/10 2:50 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
986
Index
managing data at runtime, 556–562
navigator bar container, 485
overview, 552–553
receiving complex messages, 862–863
source
property, 554
value objects, working with, 742
WebService

result
event, 788
ArrayList
class
charting controls, 649
DataGrid

control, 614
getItemAt()
method, 585
itemRenderer
property, 629
label
property, 579
list controls, 575, 577
modifying data with API, 576–577
navigator bar container, 485–486
overview, 552–553
RPC components, 578
source
property, 554
ArrayUtil.toArray()
method, 538–539
arrowKeysWrapFocus
property, 613
as
ActionScript operator, 788
.as
extension, 120–121
asdoc command-line tool, 28
ASP.NET, Microsoft, 470, 779, 781
assets, Flex Library Project, 156
assets
folder, 164–165, 437
Assets tab, New Flex Library Project wizard, 156
asynchronous (nonblocking) I/O channels, 853
asynchronous communications, 727

Asynchronous JavaScript and XML (AJAX), 470
AsyncMessage
class, 857, 859, 862
AsyncToken
class, 736–741, 794, 837
attribute()
function, 756
attributes. See also specific attributes by name
adding to objects, 765–766
deleting, 766–770
filtering XML data with predicate expressions, 761
modifying values of, 765
order of declaration in MXML, 345
value object properties, 549–550
values, in MXML, 104
XML, versus child elements, 109
XML
object, modifying, 765–770
auto
value,
creationPolicy
property, 482
autoCenter Transform
property, 381, 382
Auto-detect the return type from sample data option, 802
auto-detecting return type, 714
automatic garbage collection, 116
application
property, 129
Application server type drop-down menu, 75, 197, 815, 856

application servers. See also specific servers by name
configuring messaging on, 851–856
filtering messages on, 865–871
Flash Remoting, configuring on, 877–878
HTTPService
, 707, 709, 744–745
supported, 46–48
Application type drop-down menu, 46, 75, 815, 856
application
value,
<scope>
element, 829–830
application window, MAMP, 917–918, 919
<application>
element, 964
Application.cfc
file, 783
applications, Flex. See Flex applications
AppLoadStyleAtRunting.mxml
file, 455
AppWithButtonsComplete.mxml
file, 462
AppWithButtons.mxml
file, 455, 461, 466
AppWithCustomSkin.mxml
file, 452
AppWithSkinStyleSheet.mxml
file, 453
area charts, 649, 666–667, 670–672
AreaChart

component, 649
AreaSeries
series class, 649, 672
argumentCollection attribute, 893
arguments. See also specific arguments by name
event object, 213–214
instantiating value objects with default values, 552
passing to CFC functions, 891–900
passing to remote methods, 838–840
Array
class
adding new test expressions to helper class, 770
ArrayUtil.toArray()
method, 538–539
data collection object
source
property, 554
menu data providers, 492
navigator bar container, 485
receiving value objects from ColdFusion, 897–898
trace()
function, 172
array notation, extracting data from
XML
objects with, 759–760
array
value,
resultFormat
property, 726
ArrayCollection

class
accessing data at runtime, 555–556
bindable variable as, 731–732
charting controls, 649
data collection, declaring for, 553
data cursors, 562–569
as data provider for
PopUpMenuButton
, 515
DataGrid
control, 614
flat data, 644
HTTPService
responses, handling, 728
list controls, 578
41_488959-bindex.indd 98641_488959-bindex.indd 986 3/5/10 2:50 PM3/5/10 2:50 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
987
Index
overview, 135–136
RemoteObject
results, 831–832
shorthand MXML, 136–137
value object properties, 549, 550
view state, controlling with, 407
ViewStack
, setting as
dataProvider
, 487
WebService

results, 786–787
BindingUtils class, 136
bitmap graphics, 430, 432–433, 437, 440
BitMapAsset
object, 394
BitMapClass
object, 394
BitMapFill
class, 660
<BitmapGraphic>
element, 433
BitmapImage
control
changing images at runtime, 285–286
defined, 421
effects, 385
embedding images, 284–285
external resource bundles, 951
overview, 281–283
resizing images, 283–284
Blank State option, 402
BlazeDS. See also Message Service; Remoting Service
data connections, 845–847
downloading, 810–811
Flex projects, creating for use with, 814–816
included in ColdFusion 9, 874
messaging architecture, 849
overview, 807–808
Proxy Service, 817–824
RemoteObject

component
instantiating, 830
overview, 830
passing arguments to remote methods, 838–840
passing data between ActionScript and Java, 840–841
remote methods, calling, 830–831
results, handling, 831–838
value object classes, 841–845
sample applications, 813–814
sample database, starting, 813
starting, 811–813
supported platforms, 808–809
BlazeDS
context root folder, 816
BlazeDS WEB-INF/flex
folder, 816
blazedsfiles
folder, 816
blazeds.war
BlazeDS instance, 811
blocking I/O, 853
body
property, 857, 859, 862
bookItem
format, 393
bookmark
property, 567
automatic validation, 688–690
AVM (ActionScript Virtual Machine), 99, 727, 786
Axis, Apache, 779, 780

B
backgroundAlpha
setting, 316
backgroundColor
style, 128, 276, 343
backgroundFill
property, 324
backgrounds, pie chart, 660–662
backward navigation, 478–481
bar charts, 649, 666–670
BarAndColumnDemo.mxml
file, 670
BarChart
component, 647–648, 649, 668
BarSeries
series class, 649
Basic Latin character set, 301
basic layout, 78, 133–134, 311, 320, 331
BasicLayout
layout class, 131, 133
beans. See value objects
beforeFirst
property, 562
bgcolor
parameter, 86
bidirectional text, 292–294
binary distribution, BlazeDS, 810
binary files, 9
Bind to Data dialog box, 719–720, 803–804
bindable properties

complex data objects, 588–589
<fx:Binding/>
tag, 137–139
MXML component, 150–151
result
event, 731, 884
value objects, 544–545
XML structure, 752
[Bindable]
metadata tag
accessor method properties, 548
ArrayCollection
class, 553
complex data objects, 588, 589
making properties bindable, 138, 150
value objects, 544, 551
bin-debug
folder, 47, 76, 169
binding expressions
bound parameters, 745
ColdFusion Component results, 883–884
component methods, calling with, 154
external resource bundles, 952
formatter
classes in, 307–308
<fx:binding>
tag, 137
HTTPService
responses, 728–730
making expressions bindable, 137–139

Model
object, 535–536, 537
outputting current date, 944
41_488959-bindex.indd 98741_488959-bindex.indd 987 3/5/10 2:50 PM3/5/10 2:50 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
988
Index
BubbleChart
component, 649
bubbles
property, 228, 237, 240, 699
BubbleSeries
series class, 649
bubbling, event, 227–229
Build Automatically feature, 54, 81
build path, Flex Project, 159
bundleName
property, 947
Button
class, 208–209, 210
Button
control
addEventListener()
, 225
custom skin, 461–467
default button, 682
descendant selector in, 354
event bubbling, 227–228
event handler for, 214, 215–216, 223
exporting existing styles, 359–361

Form
component, adding to, 686
overview, 266–267
selectedIndex
property, 478–479
skin, creating new by copying default skin, 455–460
trigger events, controlling validation with, 689
button controls, 266–271. See also specific controls by name
Button
portion,
PopUpMenuButton
, 515–517
ButtonBar
control. See also list controls
defined, 484, 571, 572
generating using
dataProvider
, 485–486
Spark, use of, 611–613
Spark versus MX, 488
vertical, 490–491
ButtonBarDemo.mxml
file, 612
buttonDown
property, 220
buttonMode
property, 440
buttons. See also specific button controls by name
default, 507–508, 681–683
pop-up window, 506–508

buttonWidth
property, 507
C
C command, 424
caching, 708, 809
Cairngorm microarchitecture, 741
calculator.as
file, 123–124
Calculator.mxml
application, 122–123
CalculatorWithScript.mxml
file, 122
calendar, for date controls, 273–274
Call Trace option, 173
CallAction
class, 415
CallComponentMethodWithAS.mxml
file, 155
callout
value,
labelPosition
style, 652
bookmarking data, with cursors, 567–569
BookmarkingData.mxml
file, 569
Books.mxml
file, 473
BookStoreAccordion.mxml
file, 501
BookStoreIndexNavigation.mxml

file, 480
BookStoreMenuBar.mxml
file, 497
BookStore.mxml
file, 474
BookStoreNavBar.mxml
file, 488
BookStoreReferenceNavigation.mxml
file, 482
BookStoreTabNav.mxml
file, 499
BookStoreVerticalButtonBar.mxml
file, 491
BookStoreVerticalNav.mxml
file, 490
Boolean expressions, 114, 117, 557
border styles, 512
BorderContainer
component, 323–325
BorderContainerDemo.mxml
file, 324
borderStroke
property, 324
bottom
property, 332, 423
Bounce
class, 387–388
bound argument notation, 839, 840
bound arguments, passing to CFC functions, 891, 892
bound CSS declarations, 368–369

bound parameters, 745, 797–798
Box, Don, 778
box model, CSS, 319
Box
superclass, 312–313
BreakElement
class, 289
Breakpoint Properties dialog box, 182
breakpoints
Breakpoints view, 183–185
clearing, 180
conditional, 181–183
Debug view, controlling application execution with,
192–194
debugging event object, 220
debugging session, using in, 185–187
defined, 167
inspecting variables and expressions
adding expression, 191–192
Expressions view, 191
Variables view, 187–188
watchpoints, setting, 188–191
removing, 180–181
setting, 180–181
Breakpoints view, Flash Builder, 55, 183–185
“A Brief History of SOAP,” 778
bringToFront()
method, 524, 525
brittle applications, 12
browser, Web. See Web browser

bubble charts, 649
41_488959-bindex.indd 98841_488959-bindex.indd 988 3/5/10 2:50 PM3/5/10 2:50 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
989
Index
PopUpMenuButton
, 518
RadioButtonGroup
control, 271
ScrollBar
controls, 278–279
Slider
control, 280, 281
TileList
control, 635
Change Font Size button, 366–367
ChangeEventDemo.mxml
file, 586
ChangeLocaleAtRuntime.mxml
application, 945–947
changing
event, 584
ChangingSelectors.mxml
file, 369
<channel>
tag, 829, 878
channels, 851–854, 878, 978–980
<channels>
tag, 853–854, 855
ChannelSet

object, 980
channelSet
property, 979
characters, embedding ranges of, 300–302
Chart Service, ColdFusion, 905
chartable values, 666
charting controls
area charts, 666–667, 670–672
bar charts, 666–670
column charts, 666–670
declaring, 650–652
financial charts, 663–666
line charts, 666–667, 670–672
overview, 647–650
pie charts, 652–662
Chat Rooms application, 867–871
chatRooms.as
file, 870
ChatRooms.mxml
file, 868
CheckBox
control, 268–269, 629–632
child class, 15
child objects
Accordion
navigator container, 500
adding to container, 148
layout of, 78
TabNavigator
navigator container, 498

value object properties, 549–550
XML, 109
childList
argument, 525
childrenField
property, 642
chrome, operating system, 978
chromeColor
style, 355
class selectors, 346, 351
Class
variable, 284, 302, 509
Class view, Flash Builder, 124
classes. See also effects; specific classes by name; value objects
ActionScript, 48, 139–140, 440–441, 897
API documentation for, 208
CallResponder
class, 736–739, 794–795, 837–838
CallResponderDemo.mxml
file, 739
camel case, 345, 347
cancel
event, 523
cancelable
property, 240
cancelLabel
property, 506
candlestick charts, 650, 663–666
CandleStickChart
component, 650

CandleStickSeries
series class, 650
Canvas
container, 312, 315–317, 318, 328, 330
CanvasDemo.mxml
file, 316
Cascading Style Sheets. See CSS, selectors, CSS
case sensitivity, 104, 114, 260, 346
caseInsensitive
property, 560
casting, explicit, 859
catalog.xml
file, 158
CategoryAxis
component, 667, 668
CDATA
blocks, 109–110, 120
centerPopUp()
method, 525
centerRadius
property, 657
certificate, packaged AIR application, 968–969
certificate authority, 968
<cfchart>
command, 905
<cfcomponent>
tag, 894, 896
cfContextRoot
property, 908
CFCs. See ColdFusion Components

<cfdocument>
command, 905
CFEclipse, 34
<cffile>
command, 905
<cfhttp>
command, 727
CFIDE/scripts/AIR
folder, 907
<cfimage>
command, 905
<cfmail>
command, 905, 907, 908
CFML (ColdFusion Markup Language), 778, 880, 893
<cfpdf>
command, 905
<cfpop>
command, 905
cfPort
property, 908
<cfproperty>
tag, 894–895
CFScript, 880
<cfselect>
command, 607
cfServer
property, 908
cfservices.swc
file, 907
<cfthrow>

command, 901
change
event
ButtonBar
control, 611
ColorPicker
control, 276
HorizontalList
control, 635
list controls, 584, 585, 586
navigator bar container, 487
41_488959-bindex.indd 98941_488959-bindex.indd 989 3/5/10 2:50 PM3/5/10 2:50 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
990
Index
ColdFusion. See also ColdFusion Components
<cfhttp>
command, 727
<cfselect>
command, 607
data connections, 903–904
download page, 783
Flash Remoting, 874–878
Flex project, configuring for use with, 197–201
installing, 783
Network Monitor, 196–197
overview, 873–875
RemoteObject

fault

events, 900–902
services, calling, 905–910
SOAP-based Web services, 778, 779–780
support site for, 47
value objects, 894–900
WSDL page generated by, 781–782
ColdFusion Administrator, 905, 906
ColdFusion Builder, 34
ColdFusion Components (CFCs)
calling from Flex application, 875
creating, 878–880
passing arguments to, 891–894
RemoteObject
component, using with, 880–883
results, handling, 883–891
SOAP-based Web services, 780
ColdFusion
destination, 878, 881
ColdFusion Enterprise, 855
ColdFusion Event Gateway Adapter, 850
ColdFusion installation type option, 197, 875
ColdFusion Markup Language (CFML), 778, 880, 893
ColdFusion Web root, 876, 877
ColdFusionFiles
folder, 877
ColdFusionServiceResultEvent
class, 908
Collapse Functions option, 126
collapse
value,

whiteSpaceCollapse
style, 258
collectionChange
event, 862
color
style, 294, 353
color values, style, 362
ColorPicker
control, 275–277, 573
ColorPickerDemo.mxml
file, 276
Colors and Fonts section, Preferences dialog box, 43–44
column charts, 650, 666–670
ColumnChart
component, 650, 668
columnCount
property, 292
ColumnDemo.mxml
file, 292
columnGap
property, 292
columns
DataGrid
control, 614–619
presenting text in, 292, 293
columns
property, 614, 617–618, 642
classes (continued)
custom, to handle unique RPC requests, 741
custom event, 237–246

easing, 387–388
encapsulation, 13–14
formatter
, 305–310
names, 48, 67–68
nonvisual, in MXML, 112–113
XML, 750–756
ClassReference()
compiler directive, 453
Clean all projects option, 85
Clean dialog box, 199
Clean option, 953
click
event
addEventListener()
, 225
Button
control, 209, 210, 215–216, 266–267
documentation for, 221, 222
event bubbling, 228
event listener, setting up, 223
LinkButton
control, 268
transitions, 416
click
XML attribute, 210
clickHandler()
method, 212, 213, 225, 228, 700–701
client-side service components, ColdFusion, 907–910
clone()

method, 238, 240–242, 699
close button,
TitleWindow
container, 527–529
close
event, 508, 509, 527
close()
method, 518
closeField
property, 663
code
generating using Flash Builder 4, 64–66
managing with Flash Builder, 124–128
searching for, 58–64
code completion tool
camel case or hyphenated syntax in, 347
event name constants, 226–227
external style sheets, 357
overview, 79
selecting custom component, 145
triggering, 244
code folding, 125–127
code management, Flex versus Flash, 11
code model search tools, Flash Builder
moving existing source-code files, 63–64
refactoring source-code files, 63
refactoring variable names, 61–62
searching for declaration, 60–61
searching for references, 60
code points, Unicode, 301

code refactoring tool, 61–62
41_488959-bindex.indd 99041_488959-bindex.indd 990 3/5/10 2:50 PM3/5/10 2:50 PM
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

×