hitek
hitek

Reputation: 382

Flex error: type was not found or was not a compile-time constant

I get the following error in my flex code. Any ideas how to solve this?

<mx:Script>
    <![CDATA[
        private function send_data():void {
            userRequest.send();
        }
    ]]>
</mx:Script>
<mx:Form x="22" y="10" width="493">
    <mx:HBox>
        <mx:Label text="UserId"/>
        <mx:TextInput id="userid"/>
    </mx:HBox>
    <mx:HBox>
        <mx:Label text="Ip Address"/>
        <mx:TextInput id="ip"/>
    </mx:HBox>
    <mx:Button label="Submit" click="send_data()"/>
</mx:Form>
<mx:DataGrid id="dgUserRequest" x="22" y="128" dataProvider="{userRequest.lastResult.users.user}">
    <mx:columns>
        <mx:DataGridColumn headerText="User ID" dataField="userid"/>
        <mx:DataGridColumn headerText="User Name" dataField="ip"/>
    </mx:columns>
</mx:DataGrid>
<mx:TextInput x="22" y="292" id="selectedemailaddress"
    text="{dgUserRequest.selectedItem.emailaddress}"/>
<mx:HTTPService id="userRequest" url="http://localhost/post.php" useProxy="false" method="POST" resultFormat="e4x">
    <mx:request xmlns="">
        <userid>{userid.text}</userid>
        <ipaddress>{ip.text}</ipaddress>
    </mx:request>
</mx:HTTPService>

Type was not found or was not a compile-time constant: data.
[Generated code (use -keep to save): Path: data-generated.as, Line: 245, Column: 14]

Upvotes: 1

Views: 13500

Answers (4)

aston
aston

Reputation: 1

Or you might have a library that is not compatible with your SDK version

Upvotes: 0

Richard Szalay
Richard Szalay

Reputation: 84824

Open the properties dialog for your project and go to the "Compilation" section. In the "compiler arguments" text box, add:

-keep-generated-actionscript

After compilation, a folder called "generated" will be in your application directory (or possibly bin directory). Open data-generated.as and update your original question with the code around line 245.

Once you've done that, we can help you further.

Edit: Is there a data.mxml file? I find it odd that the error is coming from data-generated.as if your file is called test.mxml

Upvotes: 4

dirkgently
dirkgently

Reputation: 111306

Are you using Flex Builder? In that case, it'd show you little red dots by the lines in error on your right. This is error typically happens if you:

  • use a standard component without import-ing the package/class (this can be easily fixed by using the IDE's automatic type fill-in which would add the necessary import statements)
  • forget to declare a variable/import your own classes

Upvotes: 0

Simon
Simon

Reputation: 80889

My guess is that your xml being returned from post.php is not quite what you expect.

Try posting this question on flexcoders

Upvotes: 0

Related Questions