> Hi can you help to correct this problem
>> I don't know much about Binding, but can we watch a[0] kind of thing? Don't
>> know :(


The problem is that you're trying to use a databinding expression on
an array element (vopf[0]). Flex can only bind to variables or get
functions with defined changed events. The binding expression is
triggered when you set vopf to a new Array (since vopf is a variable
in the binding expression), which sets Istag.text to 'NK'. The
expression is not triggered when you push pf into vopf, so Istag.text
is never updated with the correct value. The solution provided by
Abdul will will work fine if you can set a array element to a
variable. If this is the case, however, you probably don't need an
array. Another solution is to trigger the databinding manually. You
can do this by calling "executeBindings()'" on your view elements
(which may also be impractical), or you can do something like this:

function initPF()
{
var a =new Array();
pf = new PfVO();
pf.stagione.cdc_stag="2005";
a.push(pf);
vopf = a;
}

The 'vopf = a' at the end will trigger the bindings after the array
has been set, so you should get the updated value.

Alex
Carbon Five

On Thu, 17 Mar 2005 08:23:31 -0800, Abdul Qabiz <[EMAIL PROTECTED]> wrote:
> Try this:
> 
> var val:PfVO;
> 
> function initPF()
> {
> vopf=new Array();
> pf = new PfVO();
> pf.stagione.cdc_stag="2005";
> vopf.push(pf);
> val = vopf[0];
> 
> 
> }
> 
> 
> <mx:Binding source="{PfVO(val ).stagione.cdc_stag==undefined 
> ?'NK':PfVO(val).stagione.cdc_stag}" destination="lstag.text" /> 
> 
> 
> I don't know much about Binding, but can we watch a[0] kind of thing? Don't
> know :(
> 
> I have created a sample file to test this approach, it works..You can find
> a
> way by doing something like that...
> 
> 
> 
> ###BindingTest.mxml###
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <mx:Application width="800" height="600"
> xmlns:mx="http://www.macromedia.com/2003/mxml"; xmlns="*"
> initialize="appInit()">
> 
> <mx:Script>
> <![CDATA[
> 
> var arr:Array;
> var val:TestVO;
> 
> 
> function appInit() {
> arr = [];
> var tvo = new TestVO();
> tvo.name = "Abdul";
> arr.push(tvo);
> val = arr[0];
> 
> }
> 
> ]]>
> </mx:Script>
> 
> 
> 
> <mx:Binding source="{TestVO(val).name== undefined ? 'No
> Name':TestVO(val).name}" destination="_ti.text" /> 
> <mx:TextInput id="_ti"/>
> 
> 
> </mx:Application>
> 
> 
> ##TestVO.as##
> 
> class TestVO
> {
> 
> public var name:String;
> }
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, March 15, 2005 10:17 PM
> To: Flex Coders
> Subject: [flexcoders] Help Array
> 
> 
> Hi can you help to correct this problem
> 
> function initPF()
> {
> vopf=new Array();
> pf = new PfVO();
> pf.stagione.cdc_stag="2005";
> vopf.push(pf);
> }
> 
> 
> 
> <mx:Binding source="{PfVO(vopf[0]).stagione.cdc_stag==undefined 
> ?'NK':PfVO(vopf[0]).stagione.cdc_stag}" destination="lstag.text" /> 
> 
> But display always NK???
> 
> but if i use
> <mx:Binding source="{pf.stagione.cdc_stag==undefined 
> ?'NK':PfVO(pf.stagione.cdc_stag}" destination="lstag.text" /> work fine
> 
> Can you help me please.
> Devis
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Sponsor 
> 
> ADVERTISEMENT
> 
> 
> ________________________________
> Yahoo! Groups Links
> 
> 
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/flexcoders/
> 
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


Reply via email to