Flex Builder includes advanced search features that are more powerful than find and replace. To help you understand how functions, variables, or other identifiers are used, Flex Builder lets you find and mark references or declarations to identifiers in ActionScript and MXML files, projects, or workspaces. You use refactor to make changes to your code by renaming the following identifiers and then updating all references to them:
- Variables
- Functions
- Types (interface, class)
- Accessors (getter/setter)
- Attributes
- Metadata in MXML (effects, events, styles)
Mark references
- In Source mode, click the Mark Occurrences button on the toolbar
.
- Click an identifier in the editor. All instances are marked, depending on settings in Preferences.
To change the appearance of marked references, in the Preferences dialog, select General > Editors > Text Editors > Annotations. For more information on Markers, see About markers.
Find all references or declarations
- In Source mode, click on an identifier in the editor.
- Select Search > References or Search > Declarations from the main menu. Then select File, Project, or Workspace. Matches appear in the Search view.
Refactor your code
- In Source mode, click on an identifier in the editor.
- Select Source > Refactor > Rename from the main menu.
- Enter a new name.
Flex Builder checks rename preconditions and prompts you to confirm problems before the rename operation occurs. Preconditions include the following:
- References cannot be renamed in read-only files.
- All files must be saved.
- If a project has build errors, a warning appears.
- The new name must be within scope, which is determined by the type of element and its location. Name-shadowing errors are also noted.
- The new name must be a valid identifier.
- The reference defined in a SWC file must include a source attachment.
- To review the change, click Preview to see the original and refactored source, or click OK to proceed with the change to your code.
.