You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@royale.apache.org by Mark <m_...@comcast.net> on 2022/03/07 18:31:25 UTC

Binding to xml

I having trouble binding to elements in xml.
Flex 4.6 setup. Just a simple singleton with user credential info.

[Bindable]
public class BaseModel    { 
     public var userCred:XML= new XML();

    public static function getInstance() : BaseModel {
        if ( baseModel == null )
            baseModel = new BaseModel();
        return baseModel;
    }
}

Code from welcome window.
[Bindable] private var model:BaseModel=BaseModel.getInstance();
<j:Label id="fullName" percentWidth="100" text="{model.userCred.lastName + ', ' + model.userCred.firstName}"/>

I get this error:
Warning: Data binding will not be able to detect assignments to 'lastName'. 
                  text="{model.userCred.lastName.toString() + ', ' + model.userCred.firstName.toString()}"/>

I’m using bead
<j:beads>
        <js:ContainerDataBinding/>
</j:beads>    

I also tried this but got the same error. 
    <fx:Binding
        source="model.userCred.lastName"
        destination="fullName.text"/>

Thanks

Re: Binding to xml

Posted by Mark <m_...@comcast.net>.
I figured this out. I did as you suggested and looked at the Flex 4.6 app, Those messages were being produced.
The Bindable works for the XML, but not it’s elements. 
If the XML element changes, it only means the XML object changed, so the Binding works.

Thanks for your help.

From: Yishay Weiss 
Sent: Tuesday, March 08, 2022 8:11 PM
To: users@royale.apache.org 
Subject: RE: Binding to xml

Is lastName bindable? Are you getting a similar warning in Flex?

 

From: Mark
Sent: Monday, March 7, 2022 8:31 PM
To: users@royale.apache.org
Subject: Binding to xml

 

I having trouble binding to elements in xml.

Flex 4.6 setup. Just a simple singleton with user credential info.

 

[Bindable]

public class BaseModel    { 

     public var userCred:XML= new XML();

 

    public static function getInstance() : BaseModel {

        if ( baseModel == null )

            baseModel = new BaseModel();

        return baseModel;

    }

}

 

Code from welcome window.

[Bindable] private var model:BaseModel=BaseModel.getInstance();

<j:Label id="fullName" percentWidth="100" text="{model.userCred.lastName + ', ' + model.userCred.firstName}"/>

 

I get this error:

Warning: Data binding will not be able to detect assignments to 'lastName'. 

                  text="{model.userCred.lastName.toString() + ', ' + model.userCred.firstName.toString()}"/>

 

I’m using bead

<j:beads>

        <js:ContainerDataBinding/>

</j:beads>    

 

I also tried this but got the same error. 

    <fx:Binding

        source="model.userCred.lastName"

        destination="fullName.text"/>

 

Thanks

 

RE: Binding to xml

Posted by Yishay Weiss <yi...@hotmail.com>.
Is lastName bindable? Are you getting a similar warning in Flex?

From: Mark<ma...@comcast.net>
Sent: Monday, March 7, 2022 8:31 PM
To: users@royale.apache.org<ma...@royale.apache.org>
Subject: Binding to xml

I having trouble binding to elements in xml.
Flex 4.6 setup. Just a simple singleton with user credential info.

[Bindable]
public class BaseModel    {
     public var userCred:XML= new XML();

    public static function getInstance() : BaseModel {
        if ( baseModel == null )
            baseModel = new BaseModel();
        return baseModel;
    }
}

Code from welcome window.
[Bindable] private var model:BaseModel=BaseModel.getInstance();
<j:Label id="fullName" percentWidth="100" text="{model.userCred.lastName + ', ' + model.userCred.firstName}"/>

I get this error:
Warning: Data binding will not be able to detect assignments to 'lastName'.
                  text="{model.userCred.lastName.toString() + ', ' + model.userCred.firstName.toString()}"/>

I’m using bead
<j:beads>
        <js:ContainerDataBinding/>
</j:beads>

I also tried this but got the same error.
    <fx:Binding
        source="model.userCred.lastName"
        destination="fullName.text"/>

Thanks