![MACROMEDIA FLEX - DEVELOPING COMPONENTS AND THEMES Скачать руководство пользователя страница 72](http://html1.mh-extra.com/html/macromedia/flex-developing-components-and-themes/flex-developing-components-and-themes_manual_3388115072.webp)
72
Chapter 3: Creating Advanced Components in Flash MX 2004
Adding ToolTips
ToolTips appear when a user rolls the mouse over your component name or icon in the
Components panel of the Flash authoring environment.
To add a ToolTip to your component, use the
tiptext
keyword outside the class definition in the
component’s ActionScript class file. You must comment out this keyword using an asterisk (*),
and precede it with an at sign (@) for the compiler to properly recognize it.
The following example shows the tooltip for the CheckBox component:
* @tiptext Basic CheckBox component. Extends Button.
Adding versioning
When releasing components, you should define a version number. This lets developers know
whether they should upgrade, and helps with technical support issues. When you set a
component’s version number, use the static variable
version
, as the following example shows:
static var version:String = "1.0.0.42";
If you create many components as part of a component package, you can include the version
number in an external file. Thus, you update the version number in only one place. For example,
the following code imports the contents of an external file that stores the version number in
one place:
#include "../myPackage/ComponentVersion.as"
The contents of the ComponentVersion.as file are identical to the previous variable declaration, as
the following example shows:
static var version:String = "1.0.0.42";
Best practices when designing a component
Use the following practices when designing a component:
•
Keep the file size as small as possible.
•
Make your component as reusable as possible by generalizing functionality.
•
Use the Border class rather than graphical elements to draw borders around objects.
•
Use tag-based skinning.
•
Assume an initial state. Because style properties are on the object, you can set initial settings for
styles and properties so your initialization code does not have to set them when the object is
constructed, unless the user overrides the default state.
•
When defining the symbol, do not select the Export in First Frame option unless it is
absolutely necessary. Flash loads the component just before it is used in your Flash application,
so if you select this option, Flash preloads the component in the first frame of its parent. The
reason you typically do not preload the component in the first frame is for considerations on
the web: the component loads before your preloader begins, defeating the purpose of the
preloader.
•
Avoid multiple frame MovieClips (except for the two-frame trick for assets).
Содержание FLEX - DEVELOPING COMPONENTS AND THEMES
Страница 1: ...Developing Flex Components and Themes in Flash Authoring ...
Страница 4: ...4 Contents ...
Страница 44: ...44 Chapter 2 Creating Basic Components in Flash MX 2004 ...
Страница 82: ...82 Index ...