Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 181

Creating and extending flex 2 components
Hide thumbs Also See for FLEX 2 - CREATING AND EXTENDING COMPONENTS:
Table of Contents

Advertisement

In some cases, helper classes are not ready by the time your component requires them. Flex
adds classes to the application in the order that they must be initialized (base classes, and then
child classes). However, if you have a static method that gets called as part of the initialization
of a class, and that static method has class dependencies, Flex does not know to place that
dependent class before the other class, because it does not know when that method is going to
be called.
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:
public class A {
static function foo():Number {
return 5;
}
}
public class 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 appear (2)
Verify that the
measuredWidth
or NaN, ensure that you implemented the
You can also verify that the
your component called the
The component is instantiated properly but does not appear (3)
It is possible that there is another class or SWC file that overrides your custom class or the
symbols used in your component. Ensure that there are no naming conflicts.
and
measuredHeight
measure()
property is set to
visible
invalidateDisplayList()
.
properties are nonzero. If they are zero
method correctly.
. If
true
visible=false
method.
.
Troubleshooting
, ensure that
181

Advertisement

Table of Contents
loading

Table of Contents