I get an error "don't know how to parse�?�" when I try to use the component from MXML.
This means that the compiler could not find the SWC file, or the contents of the SWC file did not list the component. Ensure that the SWC file is in a directory that Flex searches, and ensure that your xmlns property is pointing to the right place. Try moving the SWC file to the same directory as the MXML file and setting the namespace to "*" as the following example shows:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*">
For more information, see Using the Flex Compilers.
I get an error "xxx is not a valid attribute�?�" when I try to use the component from MXML.
Ensure that the attribute is spelled correctly. Also ensure that it is not private.
I don't get any errors, but nothing appears.
Verify that the component was instantiated. One way to do this is to put a Button control and a TextArea control in the MXML application and set the text property to the ID for the component when the button is clicked. For example:
<!-- This verifies whether a component was instantiated. --> <zz:mycomponent id="foo"/> <mx:TextArea id="output"/> <mx:Button label="Print Output" click="output.text = foo.id;"/>
The component is instantiated properly but does not appear (1).
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 and measuredHeight properties are nonzero. If they are zero or NaN, ensure that you implemented the measure() method correctly.
You can also verify that the visible property is set to true. If visible is false, ensure that your component called the invalidateDisplayList() method.
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.