Search code examples
actionscript-3apache-flexactionscriptflex4mxml

Why does this non-descriptive error happen when I try to build this mxml file?


I get the following error when trying to build a simple MXML file:

Build halted with errors (fcsh).

Here is the MXML:

<?xml version="1.0" encoding="utf-8"?>
<s:Application 
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx">

    <s:Label id="titleLabel" x="50" y="50" fontFamily="Arial" fontWeight="bold" text="My first Flex 4 application"/>

    <fx:Script>
        <![CDATA[

            public function example() {
                speakTextInput.text = "This is an example of horrible code!";
            }

        ]]>
    </fx:Script>

    <s:HGroup x="50" y="70" width="80%">
        <s:Button id="speakButton" label="Say Something!" />
        <s:TextInput id="speakTextInput" width="100%" text="" />
    </s:HGroup>

</s:Application>

Solution

  • Maybe your compiler doesn't like functions without type declaration for return value. Try change to:

    public function example():void