Chandan S R
Chandan S R

Reputation: 71

could not resolve <mx:String>

I'm very new to the Flex Programming. I was writing a sample program.

<?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" minWidth="955" minHeight="600">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <mx:String id="message">Hello, World</mx:String>
    <mx:Label text="{message}"/>
</s:Application>

But getting an error "could not resolve to a component implementation"

I have the following queries. What does , tags refers to. why i'm getting the above error.Please help

Upvotes: 0

Views: 107

Answers (1)

AmigaAbattoir
AmigaAbattoir

Reputation: 749

This code should work:

<?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" minWidth="955" minHeight="600">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
        <fx:String id="message">Hello, World</fx:String>
    </fx:Declarations>
    <mx:Label text="{message}"/>
</s:Application>

What I did was:

  1. Changed your string to <fx:String>

  2. Moved it into the <fx:Declarations> tag.

Reason:

It looks a little like you trying to compile with the Flex 4 SDK and are mixing a little of Flex 3 and Flex 4. Anything starting with the namespace "s" is a Flex 4 Spark components. Anything with the namespace "mx" is from Flex 3.

In Flex 3 you could declare variables in the code, right next to any visual component and they were all declared with the "mx" namespace. With Flex 4, they changed it so that declaring things that are not visual components (like variables) need to be placed in the <fx:Declarations> tag, which is why there is the comment "Place non-visual elements (e.g., services, value objects) here". They also changed the namespace of those non-visual elements to "fx".

There is some explaination in Flex 3 equivalent of ''?

Upvotes: 2

Related Questions