MACROMEDIA FLEX - DEVELOPING COMPONENTS AND THEMES Manual page 58

Developing flex components and themes in flash authoring
Table of Contents

Advertisement

{
mode_mc.move(layoutWidth - mode_mc.width, 0);
text_mc.move(0, 0);
}
else {
mode_mc.move(0, 0);
text_mc.move(mode_mc.width, 0);
}
}
Implementing the draw() method
The
method displays objects on the screen. Whenever the component needs to draw an
draw()
interface element, it calls a
elements that are subject-to-change.
Everything is made visible in the
until its
draw()
measuring are invisible until the
You should not call the
and that method calls the
method. However, Flex calls the
actually call an invalidation method if you want Flex to invoke the
If you do not call an invalidation method, the component remains invisible unless you set its
visibility property to
on page
68.
Flex also calls the
Inside the
draw()
other graphical elements. You can also call the
objects. In general, to set lengths in the
this.layoutHeight
The following example clears the component and then draws a border around the component:
function draw():Void {
clear();
if (bTextChanged) {
bTextChanged = false;
text_mc.text = text;
}
// Draw a border around everything.
drawRect(0, 0, this.layoutWidth, this.layoutHeight);
}
Defining getters and setters
Getters and setters provide visibility to component properties and control access to those
properties by other objects.
58
Chapter 3: Creating Advanced Components in Flash MX 2004
method. You use the
draw()
draw()
method is called. Any graphical assets that you bring in for the purposes of
draw()
method directly. Instead, call one of the invalidation methods,
draw()
method. Flex also calls the
draw()
redraw()
in MXML. For more information, see
true
method after the
draw()
method, you can use calls to the Flash drawing API to draw borders, rules, and
instead of
width
draw()
method. A border does not actually call the drawing API
method is called.
draw()
method only if the object is invalidated, so you should
layoutChildren()
method, which removes the visible
clear()
method, you should use
draw()
and
.
height
method to create or modify
method from the
or
draw()
redraw()
"About invalidation"
method.
this.layoutWidth
redraw()
method.
and

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX - DEVELOPING COMPONENTS AND THEMES and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents