Macromedia flex 2 Manual

Page of 254
180
Creating Advanced Visual Components in ActionScript
        private function handleChangeEvent(eventObj:Event):void {
                dispatchEvent(new Event("change"));
        }
        // Handle events that are dispatched by the children.
        private function handleClickEvent(eventObj:Event):void {
                text_mc.editable = !text_mc.editable;
        }
    }
}
Troubleshooting
This section describes some common problems and their solutions when you create 
components for Flex in Flash.
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 Chapter 9, “Using the Flex Compilers,” iBuilding and Deploying 
Flex 2 Applications
.
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)
.