Adobe® Flash® Builder™ is an integrated development environment (IDE) for building cross-platform, rich Internet
applications (RIAs) for the desktop and a wide variety of mobile devices. Flash Builder also includes testing, debugging,
and profiling tools that lead to increased levels of productivity and effectiveness.
Flash Builder is built on top of Eclipse, an open-source IDE, and provides all the tools required to develop applications
that use the open-source Flex framework and ActionScript 3.0.
Flash Builder provides full support for building applications using the Apache Flex SDK. When creating a Flex project
in Flash Builder, you can specify to use the Apache Flex SDK. For more information about downloading and using the
Apache Flex SDK, see
Flash Builder runs on Microsoft Windows and Apple Mac OS X, and is available in several versions. Installation
configuration options let you install Flash Builder as a set of plug-ins in an existing Eclipse workbench installation or
create a stand-alone installation that includes the Eclipse workbench.
www.adobe.com/go/apacheflex_download.
1
Applications you can build with Flash Builder
You can build applications that use the Flex framework, MXML, Adobe Flash Player, Adobe AIR, ActionScript 3.0,
and LiveCycle Data Services:
• Flex projects - Create Flex projects that can work with any backend server technology, including Adobe
ColdFusion, LiveCycle Data Services, and PHP.
See “Flex projects” on page 57 and “Develop Web and Desktop Applications in Flash Builder” on page 155.
• ActionScript projects - Create ActionScript projects that use the Flash API (not the Flex framework).
See “ActionScript projects” on page 59.
• Mobile projects - Create Flex mobile applications for the Google Android platform and ActionScript mobile
applications for the Apple iOS platform.
See “Flex mobile projects” on page 58 and “Create ActionScript mobile projects” on page 60.
For more information on developing mobile applications with Flex and Flash Builder, see Developing mobile
applications in Flash Builder.
• Library projects - Create custom code libraries that you can deploy as component library (SWC) files to share
among your applications or distribute to other developers.
See “Use Flex library projects” on page 181 and “Create ActionScript library projects” on page 185.
• Flash Professional projects - Create Flash Professional projects to edit and debug Flash FLA or XFL files created
with Flash Professional CS5.
See “Using Flash Builder with Flash Professional” on page 230.
• Custom MXML components - Create custom components and then easily access them using the Flash Builder
Components view.
See “Create custom MXML components” on page 186.
You can also create custom ActionScript components. See “Create an ActionScript class” on page 65.
Last updated 12/3/2012
USING FLASH BUILDER
About Flash Builder
Features that accelerate application development
Flash Builder has the tools you need to develop applications that use the Flex framework and ActionScript 3.0. You can:
• Edit code - Write and edit your application source code using the code development tools in Flash Builder. The
code development tools include code refactoring, code hinting, streamlined code navigation, automatic syntax
error checking, and other features.
See “Code Development Tools in Flash Builder” on page 14.
• Publish source code - Publish your application source code so that users and other developers can view it.
See “Publish source code” on page 94.
• Manage projects, folders, files, and other resources - Create, modify, and delete projects and resources, link to
resources outside your project, and so on.
See “Using Projects in Flash Builder” on page 55.
• Customize the Flash Builder workbench - Customize the workbench to suit your individual development needs.
For example, you can arrange the interface to include your favorite tools in a specific layout.
See “Customize the workbench” on page 232.
2
Features for running and debugging projects
Flash Builder includes building, testing, debugging, and profiling tools that help increase your productivity:
• Build projects - Flash Builder automatically compiles and builds your applications for debugging or production
release. You can also create custom build scripts using Apache Ant.
See “Build projects” on page 79.
• Run applications and manage launch configurations - Run your applications in a web browser, Adobe AIR, or
the stand-alone Flash Player. Create custom launch configurations to control how your applications run.
See “Run and debug applications” on page 95 and “Manage launch configurations” on page 96.
• Debug applications - Debug your applications using the integrated debugging tools.
See “Debugging Tools in Flash Builder” on page 110.
• Test and debug mobile applications - Run and debug your applications on the desktop or on a device.
See “Testing and debugging” on page 217.
• Profile applications - Identify performance bottlenecks and memory leaks by using the profiling tools in Flash
Builder.
See “Profiling Tools in Flash Builder” on page 120.
• Monitor applications that access data services - Use the Network Monitor to generate a detailed audit trail of all
data passed between your application and the back end .
See “Monitor applications that access data services” on page 178.
Last updated 12/3/2012
USING FLASH BUILDER
About Flash Builder
Flash Builder versions
Flash Builder is available in two versions: Standard and Premium.
Flash Builder Standard Flash Builder Standard provides a full-featured IDE that allows you to create applications
using the Flex framework and Flash API. Flash Builder Standard also includes MXML, ActionScript, and CSS editors,
as well as debugging tools. Flash Builder Standard provides a library of interactive charts and graphs that enable you
to create rich data dashboards, interactive data analysis, and data visualization components.
Flash Builder Premium In addition to the Standard version features, Flash Builder Premium includes memory and
performance profiling and automated testing tools. Use the Network Monitor to view the data that flows between a
client application and a data service. The FlexUnit test environment allows you to generate and edit repeatable tests.
The repeatable tests can be run from scripts or directly within Flash Builder or outside the Flash Builder environment.
The Command Line Build feature allows you to synchronize a developer’s individual build settings with a nightly
build.
Flash Builder for PHP Standard Flash Builder for PHP Standard provides a full-featured PHP IDE that includes Flash
Builder Standard integrated with Zend Studio 8. You can build mobile, web, and desktop applications using PHP, Flex,
and ActionScript.
Flash Builder for PHP Premium In addition to Standard version capabilities, Flash® Builder™ for PHP Premium
includes professional testing tools, including profilers, network monitoring, an automated testing framework,
integration with FlexUnit testing, and Command Line Build support.
3
For more information on Flash Builder for PHP, see Introducing Flash Builder for PHP.
Flash Builder configurations
Flash Builder provides a single downloadable installer with the following two configuration options:
Stand-alone configuration Installs Flash Builder as a stand-alone integrated development environment (IDE). The
stand-alone configuration is created specifically for developing applications that use the Flex framework and
ActionScript 3.0. This configuration is ideal for new users and users who intend to develop applications using only the
Flex framework and ActionScript 3.0.
Plug-in configuration Configures Flash Builder to run as a plug-in within an existing Eclipse™ installation.
To run the plug-in configuration, you must have Eclipse 3.7 or Eclipse 4.2 installed as follows:
• On Windows, to run Flash Builder 32-bit plug-in configuration, install Eclipse 3.7/4.2 32-bit
• On Windows, to run Flash Builder 64-bit plug-in configuration, install Eclipse 3.7/4.2 64-bit
• On Mac, to run Flash Builder 64-bit configuration, install Eclipse 3.7/4.2 Cocoa 64-bit
The Flash Builder plug-in and stand-alone configurations provide the same functionality. If you aren't sure which
configuration to use, follow these guidelines:
• If you already have Eclipse 3.7 or 4.2 installed, use the plug-in configuration to add Flash Builder features to your
existing copy of Eclipse.
• If you don't have Eclipse installed and your primary focus is on developing Flex and ActionScript applications, use
the Flash Builder stand-alone configuration. This configuration also allows you to install other Eclipse plug-ins to
expand the scope of your development work in the future.
For detailed information about installing Flash Builder, see the Flash Builder 4.7 release notes.
Last updated 12/3/2012
Chapter 2: Getting Started With Flash
Builder
Flash Builder is an integrated development environment (IDE) for developing applications using the Flex framework
and ActionScript 3.0. You can develop applications for deployment on Adobe Flash Player, desktop applications for
deployment on Adobe AIR, and mobile applications for deployment on various mobile devices.
Note: The information required to use Flash Builder is contained in the Flash Builder documentation. If you are using
other Eclipse plug-ins (such as CVS or Java) with Flash Builder, or you want to extend the Flash Builder plug-ins, see
Adobe Flash Builder Extensibility Reference.
The Flash Builder development environments consists of the following components:
Workbench The term workbench refers to the Flash Builder development environment that contains all the tools to
develop applications. The workbench contains three primary elements: perspectives, editors, and views. You use all
three in various combinations at various points in the application development process.
See “Customize the workbench” on page 232.
4
Note: For more information about some of the Eclipse workbench features, see the Eclipse Workbench User’s Guide at
http://help.eclipse.org/help31/index.jsp.
Perspective A perspective is a group of views and editors in the workbench. Flash Builder contains two perspectives:
The Flash Development perspective for developing applications, and the Flash Debug perspective for debugging
applications. Flash Builder Premium also contains the Flash Profiling perspective.
If you use the Flash Builder plug-in configuration (see “Flash Builder configurations” on page 3), your workbench can
contain additional perspectives such as a Java perspective that contains editors and views used to develop Java
applications.
See “Flash Builder perspectives and views” on page 5.
Editor An editor lets you edit various file types. The editors available to you depend on the number and type of Eclipse
plug-ins installed. Flash Builder contains editors for writing MXML, ActionScript 3.0, and Cascading Style Sheets
(CSS) code.
See “Flash Builder editors” on page 11 and “Code Development Tools in Flash Builder” on page 14.
Views A view typically supports an editor. For example, when editing an ActionScript or MXML file, the supported
views are displayed.
See “Work with views” on page 10.
Note: The term “view” is synonymous with the term “panel” as it is used in earlier versions of Flash Builder, Adobe
Dreamweaver®, and other Adobe development tools.
Workspace Not to be confused with workbench, a workspace is a defined area of the file system that contains the
resources (files and folders) that make up your application projects. You can work with only one workspace at a time;
however, you can select a different workspace each time you start Flash Builder.
See “Move a project from one workspace to another” on page 73 and “Switch the workspace” on page 74.
Resource The term resource is used generically to refer to the files and folders within the projects in a workspace.
See “Project resources” on page 63.
Last updated 12/3/2012
USING FLASH BUILDER
Getting Started With Flash Builder
Project All of the resources that make up your applications are contained within projects. You cannot build an
application in Flash Builder without first creating a project. Flash Builder supports various types of projects, depending
on the type of application you are building.
See “Types of projects” on page 55 and “Using Projects in Flash Builder” on page 55.
Launch configuration A launch configuration is created for each of your projects, and it defines project settings that
are used when running and debugging your applications. For example, the names and locations of the compiled
application SWF files are contained in the launch configuration, and you can modify these settings.
See “Manage launch configurations” on page 96.
Flash Builder perspectives and views
To support a particular task or group of tasks, editors and supporting views are combined into a perspective. When you
open a file that is associated with a particular perspective, Flash Builder automatically opens that perspective.
The stand-alone configuration of Flash Builder contains three perspectives:
• Flash Development
See “The Flash Development perspective” on page 5.
5
• Flash Debugging
See “The Flash Debug perspective” on page 110.
• Flash Profiling
See “The Flash Profiling perspective and profiler views” on page 122.
Note: The Flash Profiling perspective is available with Flash Builder Premium.
The Flash Development perspective
The Flash Development perspective includes the editors and views you require to create applications for the Flex
framework. When you create a project, Flash Builder switches into the Development perspective so you can begin
developing your application.
The focal point of the perspective (and the workbench generally) is the editor area. The editor area contains all of the
currently open documents in a multitab interface.
When you create a Flex project, the main MXML application file is opened in the editor area. You can then open and
switch between any of the MXML, ActionScript, and CSS documents you are working in. For more information, see
“Flash Builder editors” on page 11.
The Development perspective contains the editors and the following supporting views:
Package Explorer view
The Package Explorer view contains all of the projects and resources in the workspace and is therefore an essential
element of the Flash Builder workbench. It is always displayed in the Development and Debug perspectives.
When you work in the Package Explorer, you can select a resource and view its properties.
1 In the Package Explorer, select a resource.
Last updated 12/3/2012
USING FLASH BUILDER
Getting Started With Flash Builder
2 Select File > Properties.
6
For more information about the Package Explorer and working with projects, see “Manage projects” on page 71.
Outline view
The Outline view presents a hierarchical view of the code structure of the selected MXML or ActionScript document
so that you can inspect and navigate the sections or lines of code in the document. The Outline view also displays
syntax error alerts that the compiler generates. This view is also available when you use the ActionScript editor.
For more information about using the Outline view in Source mode, see “Use the Outline view” on page 27.
Last updated 12/3/2012
USING FLASH BUILDER
Getting Started With Flash Builder
Problems view
As you enter code, the Flash Builder compiler detects syntax and other compilation errors, and these errors are
displayed in the Problems view. The Package Explorer marks nodes that contain errors.
When you debug your applications, errors, warnings, and other information are displayed in the Problems view. Each
error or warning contains a message, the file and folder in which it is located, and its line number in the file. Problems
remain in the Problems view until you correct them or they are otherwise resolved.
Note: You can also optionally add the Tasks and Bookmarks views. These views provide additional shortcuts for
managing and navigating your code. For more information about these views, see
“Use markers” on page 32. For an
introduction to the optional views that are available in Flash Builder, see “Display other workbench views” on page 232.
ASDoc view
As you enter code, or hover over code elements, Flash Builder displays ASDoc content relevant to the code. Flash
Builder also displays the ASDoc content for the selected code in the ASDoc view.
7
For more information, see “Display ActionScript reference summary” on page 17.
Last updated 12/3/2012
USING FLASH BUILDER
Getting Started With Flash Builder
Network Monitor view
The Network Monitor allows you to examine the data that flows between an application and the data service or
services. the Network Monitor is available with Flash Builder Premium.
For more information, see “Monitor applications that access data services” on page 178.
Work with perspectives
Open and switch perspectives
Perspectives change automatically to support the task at hand. For example, when you create a Flex project, the
workbench switches to the Development perspective. When you start a debugging session, the Flash Debug
perspective is displayed when the first breakpoint is encountered.
8
You can also manually switch perspectives yourself by selecting Window > Open Perspective. Or, you can use the
perspective bar, which is located in the main workbench toolbar.
When the perspective opens, its title changes to display the name of the perspective you selected. An icon appears next
to the title, allowing you to quickly switch back and forth between perspectives in the same window. By default,
perspectives open in the same window.
If you use the plug-in configuration of Flash Builder and have other Eclipse plug-ins installed, you can have additional
perspectives. While predefined perspectives are delivered with each Eclipse plug-in, you can customize them or create
your own. To see a complete list of perspectives, select Window
> Open Perspective > Other.
Set a default perspective
The word default in parentheses following the perspective name indicates the default perspective.
1 Open the Preferences dialog and select General > Perspectives.
2 Under Available Perspectives, select the perspective to define as the default, and click Make Default.
3 Click OK.
Open a perspective in a new window
You can specify to open perspectives in a new window.
1 Open the Preferences dialog and select General > Perspectives.
Last updated 12/3/2012
USING FLASH BUILDER
Getting Started With Flash Builder
2 Under Open a New Perspective, select In A New Window.
To switch back to the default, select In The Same Window.
3 Click OK.
Customize a perspective
To modify a perspective’s layout, you change the editors and views that are visible in a given perspective. For example,
you could have the Bookmarks view visible in one perspective, and hidden in another perspective.
To create a perspective, do the following:
1 Open an existing perspective.
2 Show views and editors as desired.
3 Select Window > Perspective > Save Perspective As (Window > Save Perspective As in the plug-in configuration of
Flash Builder).
4 In the Save Perspective As dialog box, enter a new name for the perspective, then click OK.
To configure a perspective, do the following:
1 Open the perspective to configure.
2 Select Window > Customize Perspective.
3 Click the Shortcuts tab or the Commands tab, depending on the items you want to add to your customized
perspective.
4 Use the check boxes to select which elements to see on menus and toolbars in the selected perspective.
5 Click OK.
6 Select Window > Save Perspective As.
7 In the Save Perspective As dialog box, enter a new name for the perspective and click OK.
When you save a perspective, Flash Builder adds the name of the new perspective to the Window > Open
Perspective menu.
9
Delete a customized perspective
You can delete perspectives that were previously defined. You cannot delete a perspective you did not create.
1 Open the Preferences dialog and select General > Perspectives.
2 Under Available Perspectives, select the perspective you want to delete.
3 Click Delete, then click OK.
Reset a perspective
You can restore a perspective to its original layout after changing it.
1 Open the Preferences dialog and select General > Perspectives.
2 Under Available perspectives, select the perspective to reset.
3 Click Reset, then click OK.
Last updated 12/3/2012
USING FLASH BUILDER
Getting Started With Flash Builder
Work with views
Move and dock views
You can move views to different locations in the workbench, docking or undocking them, as needed.
1 Drag the view by its title bar to the desired location.
As you move the view around the workbench, the pointer changes to a drop cursor. The drop cursor indicates
where you’ll dock the view when you release the mouse button.
You can drag a group of stacked views by dragging from the empty space to the right of the view tabs.
You can also move a view by using the view’s context menu. Open the context menu from the view’s tab, select
> View, move the view to the desired location, and click the mouse button again.
Move
2 (Optional) Save your changes by selecting Window > Save Perspective As.
Rearrange tabbed views
In addition to docking views at different locations in the workbench, you can rearrange the views in a tabbed group of
views.
❖ Click the tab of the view to move, drag the view to the desired location, and release the mouse button. A stack
symbol appears as you drag the view across other view tabs.
10
Switch between views
There are several ways to switch to a different view:
• Click the tab of a different view.
• Select a view from the Flash builder Window menu.
• Use a keyboard shortcut
Use Control+F7 on Windows, Command+F7 on Macintosh. Press F7 to select a view.
For a list of all keyboard shortcuts, go to Help > Key Assist
Create and work with fast views
Fast views are hidden views that you can quickly open and close. They work like other views, but do not take up space
in the workbench while you work.
Whenever you click the fast view icon in the shortcut bar, the view opens. Whenever you click anywhere outside the
fast view (or click Minimize in the fast view toolbar), the view becomes hidden again.
Note: If you convert the Package Explorer view to a fast view, and then open a file from the Package Explorer fast view,
the fast view automatically is hidden to allow you to work with that file.
To create a fast view, do the following:
❖ Drag the view you want to turn into a fast view to the shortcut bar located in the lower-left corner of the workbench
window.
The icon for the view that you dragged appears on the shortcut bar. You can open the view by clicking its icon on
the shortcut bar. As soon as you click outside the view, the view is hidden again.
Last updated 12/3/2012
USING FLASH BUILDER
Getting Started With Flash Builder
To remove a fast view to normal view, do the following:
❖ From the view’s context menu, deselect Fast View.
Filter the Tasks and Problems views
You can filter the tasks or problems that are displayed in the Tasks or Problems views. For example, to see only
problems that the workbench has logged, or tasks that you logged as reminders to yourself, filter items according to
which resource or group of resources they are associated with. You can filter by text string in the Description field, by
problem severity, by task priority, or by task status.
1 In Tasks or Problems view taskbar, click Filter.
2 Complete the Filters dialog box and click OK.
For more information about views, see “Work with views” on page 10.
Flash Builder editors
When you develop applications in Flash Builder, you use the MXML, ActionScript 3.0, and CSS editors.
Editors are associated with resource types, and as you open resources in the workbench, the appropriate editor is
opened. Each editor provides the functionality required to author the given resource type.
11
MXML editor You use the MXML editor to edit MXML code and to embed ActionScript and CSS code in
<fx:Script> and <fx:Style> tags.
ActionScript editor You use the ActionScript editor to edit ActionScript class and interface files. You can embed
ActionScript functions into an MXML file by using the
<fx:Script> tag. However, it is a common practice to define
classes in separate ActionScript files and then import the classes into MXML files. Using this method, you can define
most of your applications in ActionScript.
CSS editor You use the CSS editor to display and edit Cascading Style Sheets. You can then apply styles to the visual
elements of your applications. For more information, see Styles and themes.
More Help topics
“Code Development Tools in Flash Builder” on page 14
Flash Builder Tips and Tricks
Using the MXML editor
When using the MXML editor, Content Assist helps you add standard Flex containers and controls to your user
interface.
The following example shows how to use Content Assist to insert an <s:VGroup> container into an <s:HGroup>
container. Because HGroup is a Spark component, Content Assist recommends a VGroup container, and not
<mx:VBox>.
1 Open an MXML file in the MXML editor.
The MXML file can be the main application file (a file with an Application container) or a custom MXML
component file.
2 Place the insertion point in the parent container tag.
Last updated 12/3/2012
USING FLASH BUILDER
Getting Started With Flash Builder
For example, to insert a VGroup container inside an HGroup parent container, place the insertion point after the
opening
<s:HGroup>
insertion point here
</s:HGroup>
3 Type the component tag.
<s:HGroup> tag:
As you type the tag, Content Assist appears suggesting possible entries. Recommended components are listed in
the normal black type color. Components that are not recommended appear gray.
In this example, VGroup is recommended and VBox is not recommended.
4 If necessary, use the arrow keys to select your tag from the menu, then press Enter.
12
In addition to the standard components, Content Assist lists custom components you defined in separate MXML
and ActionScript files and saved in the current project or in the source path of the current project.
Content Assist can also suggest properties, events, effects, and styles. Press Control+Space to cycle through the
recommendations in Content Assist.
You can change the type and order of recommendations for Content Assist. From the Preferences dialog, select
Flash Builder
> Editors > MXML Code > Advanced.
More Help topics
“Content Assist, Quick Assist, and Quick Fix” on page 14
“Create custom MXML components” on page 186
Associate editors with file types
You can associate editors with various file types in the workbench.
1 Select Window > Preferences.
2 Click the plus button to expand the General category.
3 Click the plus button to expand the Editors category, and then select File Associations.
4 Select a file type from the File Types list.
To add a file type to the list, click Add, enter the new file type in the New File Type dialog box, and then click OK.
Last updated 12/3/2012
USING FLASH BUILDER
Getting Started With Flash Builder
5 In the Associated Editors list, select the editor to associate with that file type.
To add an internal or external editor to the list, click Add and complete the dialog box.
6 Click OK.
You can override the default editor preferences from the context menu for any resource in one of the navigation
views. Select Open With from the context menu.
Edit files outside the workbench
You can edit an MXML or ActionScript file in an external editor and then use it in Flash Builder. The workbench
performs any necessary build or update operations to process the changes that you made to the file outside the
workbench.
Refresh an MXML or ActionScript file edited outside the workbench
1 Edit the MXML or ActionScript file in the external editor of your choice.
2 Save and close the file.
3 Start Flash Builder.
4 From one of the navigation views in the workbench, select Refresh from the context menu.
If you work with external editors regularly, you can enable auto-refresh. To do so, select Window > Preferences,
expand the General category, select Workspace, and check Refresh Automatically. When you enable this option,
the workbench records any external changes to the file. The speed with which the auto-refresh happens depends on
your platform.
13
Tiling editors
The workbench lets you open multiple files in multiple editors. But unlike views, editors cannot be dragged outside the
workbench to create new windows. You can, however, tile editors in the editor area, so that you can view source files
side by side.
1 Open two or more files in the editor area.
2 Select one of the editor tabs.
3 Drag the editor over the left, right, upper, or lower border of the editor area.
The pointer changes to a drop cursor, indicating where the editor appears when you release the mouse button.
4 (Optional) Drag the borders of the editor area of each editor to resize the editors as desired.
Maximize a view or editor
There are several ways you can maximize (restore) a view or editor so that it fills the workbench window.
• From the context menu on the view or editor’s title bar, select Maximize (Restore).
• Double-click the tab of a view.
• From the Flash Builder menu, select Window > Maximize/Restore.
• Click the Maximize/Restore icons in the upper-right corner of the view or editor.
Last updated 12/3/2012
Chapter 3: Code Development Tools in
Flash Builder
You edit MXML, ActionScript, and CSS code in Adobe® Flash® Builder™ with separate editors. The Flash Builder
workbench is both project- and document-centric. The appropriate editor opens automatically because the editors are
associated with resource types. The Flash Builder editors share capabilities, including code hinting, navigation,
formatting, refactoring, and other productivity-enhancing features.
Content Assist, Quick Assist, and Quick Fix
Content Assist
As you enter MXML, ActionScript, and CSS code, hints and ASDoc reference documentation displays to help you
complete your code. This feature is called Content Assist.
14
In the MXML editor, if you type within an MXML component, you are prompted with a list of all properties of that
component. The following example shows code hints for properties of an MXML component:
Last updated 12/3/2012
USING FLASH BUILDER
Code Development Tools in Flash Builder
Selecting and entering properties displays possible property values (if predefined values exist). The following example
shows code hints for property values:
Content Assist works similarly for the ActionScript editor and CSS editor.
Content Assist in the MXML editor
In the MXML editor, code hints appear automatically as you enter your code. The following example shows the code
hints that are displayed when you add a tag to a Panel tag. It also shows the ASDoc reference documentation. Click
inside the ASDoc content, or press F2 to display the content in a separate, scrollable window. Click outside the ASDoc
window to close it.
15
Content Assist categorizes code hints by type, showing you both visual and nonvisual MXML components, properties,
events, and styles.
By default, Content Assist only displays code hints for recommended types. Recommended types are those components
available in the declared namespace or are otherwise available, depending on the enclosing tags. The components that
are available to you in an application depend on the namespace declaration of the application and also the tags
enclosing the insertion point in the editor.
For example, in some contexts only Spark components are allowed. In other contexts, both Spark and Halo
components are allowed. Content Assist filters the code hints, depending on the context.
Press Control+Space multiple times to cycle through filters for displayed code hints, as listed below:
• Initial display: Recommended types
• All components
• Properties
• Events
Last updated 12/3/2012
USING FLASH BUILDER
Code Development Tools in Flash Builder
• Effects
• Styles
• Return to recommended types
Which code hints to display, and the order for cycling through code hints, is a user preference. To change the default
setting from the Preferences dialog, see
“MXML code” on page 238.
Content Assist in the ActionScript editor
Code hints appear automatically as you enter your ActionScript code in the ActionScript editor.
Content Assist filters the code hints, depending on the context. Press Control+Space multiple times to cycle through
filters for displayed code hints, as listed below:
• Templates
• Variables
• Functions
• Classes and Interfaces
• Packages
• Namespaces
Which code hints to display, and the order for cycling through code hints, is a user preference. To change the default
setting from the Preferences dialog, see
“ActionScript code” on page 237.
16
Content Assist in the CSS editor
Content Assist provides hints for CSS styles within embedded <fx:Style> tags or in stand-alone CSS documents, as
the following example shows:
Note: Code hints in CSS documents do not appear until you press Control+Spacebar.
Last updated 12/3/2012
USING FLASH BUILDER
Code Development Tools in Flash Builder
Content Assist also provides hints for component classes within the ClassReference in a CSS document, as the
following example shows:
You can also choose to type the full-qualified class name, then the available classes and packages are displayed as
follows:
17
The ClassReference tag provides hyperlink navigation to let you navigate to the referenced component or skin class.
To do so, press the Control key (Command key for Mac) and move the cursor over the ClassReference tag, the class
name becomes a hyperlink. For more information on hyperlink navigation, see
“Open code definitions” on page 27.
Display ActionScript reference summary
1 Begin entering a line of code that contains either an MXML or ActionScript class. You can also hover over the class.
As you type, ActionScript reference summary for the class displays next to the code hints. If you hover over a class,
just the ActionScript reference summary appears.
2 Click inside the ActionScript reference summary, or press F2 to display the ActionScript reference content in a
separate, scrollable window. When you finish reading the documentation, click outside the window. The ASDoc
window closes.
3 To display the ASDoc view, press Ctrl+3, and type asdoc, and select Views:
Quick Assist
The Quick Assist feature in Adobe Flash Builder provides context-based assistance to help you quickly perform a task.
Quick Assist lets you select an action from a list of actions that are applicable to your current code fragment.
To invoke Quick Assist, do one of the following:
• Select Quick Assist from the context menu in the editor, and select the required option.
• Use the keyboard shortcut Control+1(Windows) or Command+1 (Mac OS), and select the required option.
Last updated 12/3/2012
USING FLASH BUILDER
Code Development Tools in Flash Builder
Currently, the following Quick Assist options are available:
Rename in File
Use Quick Assist to rename code elements that have the Rename/Refactor action enabled. That is, variables, methods,
class names, parameters, imports, and states and ActionScript code inside MXML tags.
To rename all instances of a variable or method in your file, place your cursor in the selected variable or method name,
and invoke Quick Assist. Then, select the Rename In File option to rename the variable or method name. Similarly,
you can change the ID property of an MXML component.
Rename in Workspace
Use Quick Assist to rename code elements that have the Rename/Refactor action enabled across files in your
workspace.
To rename all instances of a variable or method in your workspace, place your cursor in the selected variable or method
name, and invoke Quick Assist. Then, select the Rename In Workspace option to rename the variable or method name.
You can update all references to the variable or method in your workspace.
Organize Imports
Place the cursor on any import statement, and invoke Quick Assist. Then, select the option to organize imports. For
more information on organizing import statements, see
“Organize import statements” on page 34.
18
Generate Import Statement
If you have an undefined variable, you can place your cursor anywhere within the line of code and invoke Quick Assist.
You get an option to import the component. If the component has MX and Spark equivalents, both the options appear.
For example, if you have an undefined variable btn in your code:
var btn:Button;
Place your cursor anywhere in the line of code, and press Control +1. You get options to import the Button
component. If you select the Spark Button component, the import statement is created as follows:
import spark.components.Button;
Split Variable Declaration
Use Quick Assist to split a variable into two parts: variable declaration and variable initialization.
Quick Assist appears in the following contexts.
Last updated 12/3/2012
USING FLASH BUILDER
Code Development Tools in Flash Builder
ContextExample
Local variables inside a function If you have a function, as follows:
public function TestAS()
{
var i:int=10;
}
To split the variable using Quick Assist, place your cursor anywhere within the variable
declaration
variable declaration.
The variable is split as follows:
public function TestAS()
{
var i:int;
i=10;
}
Multiple variables inside a functionIf you have a function as follows:
public function TestAS()
{
var i:int=10, j:int=20;
}
To split the variables using Quick Assist, place your cursor anywhere within the variable
declaration
to split the variable declaration.
You can split the variable as follows:
public function TestAS()
{
var i:int, j:int=20;
i=10;
}
You can further split the variable j:int=20; by placing your cursor anywhere within the
variable declaration, and press Control+1. Then, select the option to split the variable
declaration.
The variable is split as follows:
public function TestAS()
{
var i:int, j:int;
j=20;
i=10;
}
var i:int=10; and press Control+1. Then, select the option to split the
var i:int=10, j:int=20; and press Control+1. Then, select the option
19
Assign to Variable
When you evaluate an ActionScript expression, if the expression returns a value, you can use Quick Assist to create a
variable for that expression. Quick Assist is not available for methods that do not have a return type or if the return
void.
type is
The name of the variable that is created is derived from the name of the function or identifier in the expression. If the
derived name exists, then the name is incremented.
For example, if you have the following code:
var i:int;
i;
Place your cursor after "i", and invoke Quick Assist. Then, select Assign Statement To A New Local Variable. A
variable
"i2" is created. Because the variable i is already present, the new variable name is incremented to "i2" as
follows:
Last updated 12/3/2012
USING FLASH BUILDER
Code Development Tools in Flash Builder
var i:int;
var i2:int = i;
For example, Assign to Variable appears in the following contexts:
ContextExample
Literal Expression Quick Assist supports a wide range of simple and complex expressions.
For example, if you have an expression as follows:
100+150
Place your cursor anywhere within the expression, and press Control+1, then you get code
like the following:
var number2:Number = 110 + 500;
Method CallIf you have the following code within a method:
var ac:ArrayCollection = new ArrayCollection();
ac.createCursor();
Place your cursor within ac.createCursor(); and press Control+1. Then, select the
option to assign the statement to a new local variable. The local variable is created as follows:
var createCursor:IViewCursor = ac.createCursor();
Property AccessIf you have the following code within a property:
var ac:ArrayCollection = new ArrayCollection();
ac.source;
Place your cursor anywhere within ac.source, and press Control +1. Then, select the
option to assign the statement to a new local variable. The local variable is created as follows:
var source:Array = ac.source;
20
Convert Local Variable to Field
When you have local variables inside a function, Quick Assist lets you create a field in the class.
For example, if you have a variable inside a function, as follows:
var i:int = 10;
Place your cursor anywhere within the variable definition, and invoke Quick Assist. Then, select Convert Local
Variable To Field. The class field is created as follows:
private var i:int;
The name of the new field is the same name as the local variable, provided there are no conflicts in the class scope. If
the name exists, then the field name is incremented, and you can rename the variable or method in your file.
Convert Local Variable to Parameter
When you have a local variable inside a function, Quick Assist lets you convert the local variable into a parameter.
For example, if you have a variable inside a function, as follows:
public function method():void {
var i:int = 10;
}
Place your cursor anywhere within the variable definition, and invoke Quick Assist. Select Convert Local Variable To
Parameter. The parameter is created as follows:
Last updated 12/3/2012
USING FLASH BUILDER
Code Development Tools in Flash Builder
public function method(i:int):void {
i = 10;
}
After the parameter is generated, you can rename all references of the parameter using linked mode.
Convert Anonymous Function to Named Function
When you have an anonymous function, you can quickly convert it to a named function using Quick Assist.
For example, if you have an anonymous function, as follows:
public function method1():void;
{
var foo:Function = function(x:int, y:int, z:int):void;
{
trace(x, y, z);
}
}
Place your cursor within function(), and press Control+1. Then, select Convert Anonymous To Named Function.
The named function is created as follows:
public function method1():void;
{
var foo:Function = fooFunction;
}
protected function fooFunction(x:int, y:int, z:int):void;
{
trace(x, y, z);
}
21
After the function is generated, you can rename all references of the function using linked mode.
Assign Parameter to New or Existing Variable
When you have a function containing a parameter, Quick Assist lets you assign the parameter to a new instance
variable.
For example, if you have a function containing a parameter, arg, as follows:
class A{
function method(arg:String):void {
}
}
Place your cursor within arg, and invoke Quick Assist. Then, select Assign Parameter To New Instance Variable. The
statement is changed to:
class A {
private var arg:String;
function method(arg:String):void {
this.arg = arg;
}
}
If you have instance variables already defined, you can assign the parameter to one of them.
For example, if you have a variable, myArg, defined as:
Last updated 12/3/2012
USING FLASH BUILDER
Code Development Tools in Flash Builder
class A {
private var myArg:String;
function method(arg:String):void {
}
}
Place your cursor within arg, and invoke Quick Assist. Quick Assist detects the myArg variable, and shows the option
Assign Parameter To Instance Variable 'myArg'. Selecting this option, changes the statement to:
class A {
private var myArg:String;
function method(arg:String):void {
myArg = arg;
}
}
After the variable is generated, you can rename all references of the variable using linked mode.
Create New Local Variable With Cast Type
Quick Assist lets you quickly create a cast type local variable within a conditional expression.
For example, if you have an if statement:
if(myObject is Button) {
}
22
Or a while statement:
while(myObject is Button) {
}
Place your cursor within the if or why statement, and invoke Quick Assist. Quick Assist shows you the option Create
New Local Variable With Cast Type. Selecting this option generates the following conditional expression:
if(myObject is Button) {
var button:Button = myObject as Button;
}
After the local variable is generated, you can rename all references of the variable using linked mode.
Replace Conditional Statement With If-Else Statement
Quick Assist lets you replace a conditional statement with an if-else statement.
For example, if you have a conditional statement, as follows:
var foo:String = bool?"Yes":"No";
Place your cursor anywhere within the condition statement, bool?"Yes":"No", and invoke Quick Assist. Then, select
Replace Conditional With 'If-Else'. The if-else statement is generated, as follows:
var foo:String;
if (bool)
{
foo = "Yes";
}
else
{
foo = "No";
}
Last updated 12/3/2012
USING FLASH BUILDER
Code Development Tools in Flash Builder
Add Else, Else-If, Finally, and Catch statements
If you have an If statement, you can use Quick Assist to add Else and Else-If statements.
For example, when you have an if statement:
var foo:Boolean = false;
if(foo) {
}
Place your cursor within if, and invoke Quick Assist. Quick Assist shows you options to add else and else-if
statements. If you’ve defined an else statement already, then Quick Assist shows you an option to add an else-if
statement.
Similarly, if you’ve defined a try statement, you can add finally and catch statements.
Generate Getter/Setter
Quick Assist lets you generate getters and setters (get and set accessor functions) for class variables.
For example, if you have code like the following:
private var result:ResultEvent;
Place your cursor in the variable, result, and invoke Quick Assist. Then, select the option to create the getter and
setter for result. The Generate Getter/Setter dialog box appears. Using this dialog box, you can specify a new getter and
setter function. For more information on generating getter and setters, see
“Generate get and set accessor functions”
on page 53.
23
Generate functions
Quick Assist lets you generate special functions such as labelFunction, iconFunction, and such.
For example, to create a labelFunction for the following code:
Place your cursor within "lblfunc", and invoke Quick Assist. Then, select the option to create the labelFunction. Stub
code for the function is generated as follows:
protected function lblfunc(item:Object, column:DataGridColumn):String
{
// TODO Auto-generated method stub
}
Generate event handlers from MXML code
Quick Assist lets you generate event handlers with custom handler names within MXML code.
For example, to generate an event handler on clicking an <mx:Button> tag, enter the following code:
<mx:Button click="clickHandler" />
Then, place your cursor within "clickHandler", invoke Quick Assist, and select generate event handler. The event
handler and stub code are generated as follows:
<mx:Button click="clickHandler(event)" />
protected function clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
}
Last updated 12/3/2012
USING FLASH BUILDER
Code Development Tools in Flash Builder
You can also generate an event handler for the following code, by pressing Control+1 anywhere within
"clickHandler(event)".
<mx:Button click="clickHandler(event)" />
To customize the predefined stub code that Flash Builder generates, see “Code templates” on page 38.
Quick Fix
The Quick Fix feature in Flash Builder identifies unresolved issues in code and prompts you with a list of options to
fix your code. The Quick Fix feature is supported only for ActionScript files or ActionScript code in an MXML file.
For example, when you have code as follows:
import flash.display.Sprite;
public class QuickFix extends Sprite
{
public function QuickFix()
{
var t:TestUnitClass
}
}
Flash Builder identifies the undefined variable by an error indicator with a bulb next to the error icon . When you
hover your pointer over the undefined variable, you see the following Quick Fix options:
24
To use the Quick Fix feature, do any of the following:
• Select Quick Fix/Assist from the context menu in the editor, and select the required option.
• Use the keyboard shortcut Control+1(Windows) or Command+1 (Mac OS), and select the required option.
Format, navigate, and organize code
The Flash Builder editors provide many shortcuts for navigating your code, including folding and unfolding code
blocks, opening the source of code definitions, and browsing and opening types. Code navigation includes the ability
to select a code element (a reference to a custom component in an MXML application file, for example) and go to the
source of the code definition, wherever it is located in the project, workspace, or path.
Multiple line code blocks can be collapsed and expanded to help you navigate, view, and manage complex code
documents. In Flash Builder, expanding and collapsing multiple-line code statements is referred to as code folding and
unfolding.
Last updated 12/3/2012
USING FLASH BUILDER
Code Development Tools in Flash Builder
Code formatting, indenting, and commenting
As you write code, Flash Builder automatically indents lines of code to improve readability, adds distinguishing color
to code elements, and provides many commands for quickly formatting your code as you enter it (adding a block
comment, for example).
To change the default formatting, in the Preferences dialog box, select Flash Builder > MXML Code > Formatting. You
can change the order and grouping of the attributes.
When you paste MXML or ActionScript code into the code editor, Flash Builder automatically indents the code
according to your preferences. You can also specify indenting for a selected block of code.
To specify the indentation preferences, in the Preferences dialog, select Flash Builder > Editors. You can specify the
indent type and size.
Set, fold, and unfold code blocks
1 In the editor, click the fold symbol (-) or the unfold symbol (+) in the editor’s left margin.
25
Folding a code block hides all but the first line of code.
Unfolding the code block to make it visible again. Hold the mouse over the unfold (+) symbol to show the entire
code block in a tool tip.
2 By default, code folding is turned on in Flash Builder. To turn off code folding, open the Preferences dialog and
select Flash Builder
> Editors, and then deselect the Enable Code Folding option.
Apply syntax coloring preferences
You can easily adjust syntax coloring preferences.
❖ Open the Preferences dialog and select Flash Builder > Editors > Syntax Coloring.
For more information, see “Syntax coloring” on page 239.
Default font colors can also be configured on the Text Editors and Colors and Fonts Preferences pages (see Preferences
> General > Appearance > Colors and Fonts. See also Preferences > General > Editors > Text Editors).
Indent code blocks
The editor automatically formats the lines of your code as you enter it, improving readability and streamlining code
writing. You can also use the Tab key to manually indent individual lines of code.
Last updated 12/3/2012
USING FLASH BUILDER
Code Development Tools in Flash Builder
When you copy and paste code blocks into Flash Builder, Flash Builder automatically indents the code according to
your indentation preferences.
If you want to indent a block of code in a single action, you can use the Shift Right and Shift Left editor commands.
Shift a code block to the left or right
1 In the editor, select a block of code.
2 Select Source > Shift Right or Source > Shift Left.
3 Press Tab or Shift Tab to indent or unindent blocks of code.
Set indent preferences
1 Open the Preferences dialog and select Flash Builder > Indentation.
2 Select the indent type (Tabs or Spaces) and specify the IndentSize and Tab Size.
Add comments and comment blocks
You can add or remove comments using options in the Source menu or by using keyboard shortcuts. You can add the
following types of comments:
• Source comment for ActionScript (//)
• Block comment for ActionScript (/* */)
• ASDoc comments for ActionScript (/** */)
• Block comment for MXML (<!---->)
• CDATA block for MXML (<![CDATA[ ]]>)
Comments in ActionScript code can be toggled on or off.
26
Adobe Community Professional, Paul Robertson, blogged about using block selection mode.
Toggle comments in ActionScript code
1 In the editor, select one or more lines of ActionScript code.
2 Press Control+Shift+C (Windows) or Command+Shift+C (Mac OS) to add, or remove, C-style comments.
3 Press Control+/ (Windows) or Command+/ (Mac OS) to add, or remove, C++ style comments.
Add XML comments in MXML code
1 In the editor, select one or more lines of MXML code.
2 Press Control+Shift+C (Windows) or Command+Shift+C (Mac OS) to add a comment.
Add CDATA blocks in MXML code
1 In the editor, select one or more lines of MXML code.
2 Press Control+Shift+D (Windows) or Command+Shift+D (Mac OS) to add a comment.
Navigate and inspect code
With applications of any complexity, your projects typically contain many resources and many lines of code. Flash
Builder provides several features that help you navigate and inspect the various elements of your code.
Last updated 12/3/2012
Loading...
+ 217 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.