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,” in
Building 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)
.
Содержание FLEX 2 - CREATING AND EXTENDING COMPONENTS
Страница 1: ...Creating and Extending Flex 2 Components Adobe Flex 2...
Страница 6: ...6 Contents...
Страница 10: ...10 About Flex Documentation...
Страница 12: ......
Страница 24: ...24 Creating Flex Components...
Страница 74: ...74 Compiling Components...
Страница 76: ......
Страница 118: ...118 Creating Advanced MXML Components...
Страница 120: ......
Страница 182: ...182 Creating Advanced Visual Components in ActionScript...
Страница 194: ...194 Creating Custom Style Properties...
Страница 204: ...204 Creating Template Components...
Страница 206: ......
Страница 216: ...216 Creating Custom Formatters...
Страница 254: ...254 Index...