MACROMEDIA FLEX-CREATING ADVANCED COMPONENTS Manual page 23

Creating advanced components
Table of Contents

Advertisement

One possible remedy is to add a static variable dependency to the class definition. Flex knows that
all static variable dependencies must be ready before the class is initialized, so it orders the class
loading correctly.
The following example adds a static variable to tell the linker that class A must be initialized
before class B:
class mx.example.A {
static function foo():Number {
return 5;
}
}
class mx.example.B {
static function bar():Number {
return mx.example.A.foo();
}
static var z = B.bar();
// Dependency
static var ADependency:mx.example.A = mx.example.A;
}
The component is instantiated properly but does not show up (#2)
Verify that the
_measuredPreferredWidth
nonzero. If they are zero, ensure that you implemented the
Sometimes you have to ensure that subobjects are created in order to get the correct
measurements.
You can also check the values of the
code might have set those values to zero. If so, set a breakpoint in the setters for the
,
height
preferredWidth
You can also verify that the
property is an internal property used by Flash Player. If
_visible
, ensure that your component called the
_visible=false
or
measure()
layoutChildren()
The system does not call the
must call the
invalidate()
their correct size during the layout process.
The component is instantiated properly but does not show up (#3)
It is possible that there is another class or SWC file that overrides your custom class or the
symbols used in your component. Check the ActionScript classes and SWC files in the
flex_app_root/WEB-INF/flex/user_classes directory to ensure that there are no naming conflicts.
and
preferredWidth
, and
preferredHeight
property and the
visible
methods.
method unless you explicitly do so. All components
invalidate()
method at least once, because their layout changes as they are given
.
_measuredPreferredHeight
measure()
and
preferredHeight
properties to see what is setting them.
property are set to
_visible
visible=true
invalidate()
.
properties are
method correctly.
properties. Other
,
width
. The
true
and
method in its
Troubleshooting
23

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents