If you have a custom component, you are likely to have it in a namespace other than mx. You are on the right track by deleting the namespace, but you do not need to do this. Consider the following example.
<example:MyComponent xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:example="com.example.*"> </example:MyComponent>
In this code, we have a custom component MyComponent in the com.example package. Now, how to add custom states? It is easy!
<example:MyComponent xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:example="com.example.*"> <example:states> <mx:State name="CustomState"> </mx:State> </example:states> </example:MyComponent>
Component properties, such as states, transitions, or even a label on a Button, can be created as children. These properties must use the same namespaces as the component instance. It doesn't matter where the property comes from the inheritance chain. Even if com.example.MyComponent extends mx.containers.Canvas, the states property will use the XML namespace in which MyComponent is defined.
In short, don't think of state properties like mx: states, because the prefix mx: property is simply inherited from the component. However, we need to use mx: when we define the actual state, because the class (not the property) and this class are defined in the mx namespace.
To continue step by step in the explanation, you can change the namespace http://www.adobe.com/2006/mxml as something other than mx.
<zzz:VBox xmlns:zzz="http://www.adobe.com/2006/mxml"> <zzz:states> </zzz:states> </zzz:VBox>
In this example, we will change mx to zzz. The state property should now have the zzz: prefix instead of mx :.
source share