354
ActionScript classes
In the following cases a button does not use a bitmap, even if the
cacheAsBitmap
property is
set to
true
and instead renders from vector data:
■
When the bitmap is too large, that is, greater than 2880 pixels in either direction
■
When the bitmap fails to allocate memory (due to an out of memory error)
The
cacheAsBitmap
property is best used with buttons that have mostly static content and
that do not scale and rotate frequently. With such buttons,
cacheAsBitmap
can lead to
performance increases when the button is translated (when its
x
and
y
position is changed).
Availability:
ActionScript 1.0; Flash Player 8
Example
The following example applies a drop shadow to an existing Button instance named
myButton
. It then traces out the value of
cacheAsBitmap
, which is set to
true
when a filter is
applied.
import flash.filters.DropShadowFilter;
trace(myButton.cacheAsBitmap); // false
var dropShadow:DropShadowFilter = new DropShadowFilter(6, 45, 0x000000, 50,
5, 5, 1, 2, false, false, false);
myButton.filters = new Array(dropShadow);
trace(myButton.cacheAsBitmap); // true
enabled (Button.enabled property)
public enabled : Boolean
A Boolean value that specifies whether a button is enabled. When a button is disabled (the
enabled property is set to
false
), the button is visible but cannot be clicked. The default
value is
true
. This property is useful if you want to disable part of your navigation; for
example, you may want to disable a button in the currently displayed page so that it can't be
clicked and the page cannot be reloaded.
Availability:
ActionScript 1.0; Flash Player 6
Example
The following example demonstrates how you can disable and enable buttons from being
clicked. Two buttons,
myBtn1_btn
and
myBtn2_btn,
are on the Stage and the following
ActionScript is added so that the
myBtn2_btn
button cannot be clicked. First, add two button
instances on the Stage. Second, give them instance names of
myBtn1_btn
and
myBtn2_btn
.
Lastly, place the following code on frame 1 to enable or disable buttons.
myBtn1_btn.enabled = true;
myBtn2_btn.enabled = false;
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...