Hi Nicolas,
Looks like you are using the Jewel component set, so you may need to add
ContainerDataBinding to the screens. Different MXML files can have different
binding implementation for performance reasons and there may not be one
specified by default for PAYG reasons.
You can do that by adding the ContainerDataBinding bead to the MXML files for
screens where you have binding expressions in the same way you added
ApplicationDataBinding to the main app, or if Ecran1Class is only used as the
top tag in an MXML file, then it should be safe to just add the
ContainerDataBinding bead in the Ecran1Class constructor.
public function Ecran1Class()
{
super();
addBead(new ContainerDataBinding());
}
}
HTH,
-Alex
From: Nicolas Aguttes <[email protected]>
Reply-To: "[email protected]" <[email protected]>
Date: Saturday, May 16, 2020 at 10:31 PM
To: "[email protected]" <[email protected]>
Subject: Binding question/issue
Good morning all.
I am new to Apache Royale and I don't know how to make binding work
I have my main program which call some screens (ecrans.*)
each screen has its applicationScript where I define some constant that I would
link to bind to the view, it compiles, but the binding doesn't work and shows
undefine value.
I tried with differetn combination of
<j:beads>
<js:nnnnDataBinding/>
</j:beads>
but without success.
Can someone tell we what I am doing wrong?
Thanks
Nicolas
Here is a non working extract of my code
----- Main ----
<?xml version="1.0" encoding="utf-8"?>
<j:Application
xmlns:fx="http://ns.adobe.com/mxml/2009<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Fmxml%2F2009&data=02%7C01%7Caharui%40adobe.com%7C795b58ddc11c4fc011a908d7fa239a78%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637252903135709487&sdata=TAvlz%2B5UpoRVz6m2rbXYGn2Ot7ViiLw3mivUEFSY6%2Bw%3D&reserved=0>"
xmlns:ecrans="ecrans.*"
xmlns:j="library://ns.apache.org/royale/jewel<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.apache.org%2Froyale%2Fjewel&data=02%7C01%7Caharui%40adobe.com%7C795b58ddc11c4fc011a908d7fa239a78%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637252903135719481&sdata=Iyyi8hzJn2LqT4%2BkKv8S7zq8He3oPlvPUxR8ea4EVl8%3D&reserved=0>"
xmlns:js="library://ns.apache.org/royale/basic<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.apache.org%2Froyale%2Fbasic&data=02%7C01%7Caharui%40adobe.com%7C795b58ddc11c4fc011a908d7fa239a78%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637252903135729485&sdata=7VkHK6SZcEHB1RfYzOJo4ilwtnxavElTbTKnwnr5kqI%3D&reserved=0>"
xmlns:html="library://ns.apache.org/royale/html<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.apache.org%2Froyale%2Fhtml&data=02%7C01%7Caharui%40adobe.com%7C795b58ddc11c4fc011a908d7fa239a78%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637252903135729485&sdata=koPs87mBTCNVh0O8JCSt4M4XdxkyCXJX7VoDsQAAPTY%3D&reserved=0>"
width="100%"
height="100%">
<j:beads>
<js:ApplicationDataBinding/>
</j:beads>
<j:initialView>
<j:View id="vuePrincipale" width="100%" height="100%">
<j:View id="EcranBox" width="100%" height="100%">
<ecrans:Ecran1 id="Ecran1" />
</j:View>
</j:View>
</j:initialView>
</j:Application>
----- Scren 1 .mxml ------
<?xml version="1.0" encoding="utf-8"?>
<ecrans:Ecran1Class
xmlns:fx="http://ns.adobe.com/mxml/2009<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Fmxml%2F2009&data=02%7C01%7Caharui%40adobe.com%7C795b58ddc11c4fc011a908d7fa239a78%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637252903135739478&sdata=gpcSKYpvjAgJ3QSd50eZw8oNmVdOi5B5g44vYMzKFxs%3D&reserved=0>"
xmlns:ecrans = "ecrans.*"
xmlns:j="library://ns.apache.org/royale/jewel<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.apache.org%2Froyale%2Fjewel&data=02%7C01%7Caharui%40adobe.com%7C795b58ddc11c4fc011a908d7fa239a78%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637252903135739478&sdata=V8xnJIhiW%2Fos0EAO8E3tvDwBHhRG3IUEjpB3VJMroeM%3D&reserved=0>"
xmlns:html="library://ns.apache.org/royale/html<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.apache.org%2Froyale%2Fhtml&data=02%7C01%7Caharui%40adobe.com%7C795b58ddc11c4fc011a908d7fa239a78%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637252903135749470&sdata=BbRImRMkckHlvS5Z1V5nhx0VFqF%2FnpoAw6LNRJzZm%2BQ%3D&reserved=0>"
xmlns:js="library://ns.apache.org/royale/basic<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.apache.org%2Froyale%2Fbasic&data=02%7C01%7Caharui%40adobe.com%7C795b58ddc11c4fc011a908d7fa239a78%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637252903135749470&sdata=aj%2BOjRT9lnJRikrF3zlwxE3VtTIaUu0nBXIufeqV2mY%3D&reserved=0>"
>
<j:Form width="100%" height="100%" id="searchForm" >
<j:FormItem id="labelNom" label="nom :" width="100%" >
<j:TextInput id="nom" >
<j:beads>
<j:MaxNumberCharacters maxlength="{MAX_CHARS_NOM}" />
</j:beads>
</j:TextInput>
</j:FormItem>
</j:Form>
</ecrans:Ecran1Class>
----- screen 1 .as --------
package ecrans
{
import org.apache.royale.jewel.View;
public class Ecran1Class extends View
{
// Proprietes
[Bindable] public static const MAX_CHARS_NOM:int = 50;
// Constructeur
public function Ecran1Class()
{
super();
}
}