Ok, maybe try an associative array?  I haven't tried binding to
properties of one of those though. 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Bjorn Schultheiss
Sent: Wednesday, March 07, 2007 6:48 PM
To: [email protected]
Subject: Re: [flexcoders] Setting Multiple Bindable Properties

 

and then in my view bind to:

 

[code]

<mx:ComboBox editable="{ model.myAC.getItemAt(2) }" />

// instead of

<mx:ComboBox editable="{ model.comboBoxEditable }" />

[/code]

 

Isn't this approach ugly?

 

 

Bjorn

 

On 08/03/2007, at 10:37 AM, Tracy Spratt wrote:





 

I'll go out on a limb and theorize that it is not possible to get a
reference to a variable with a primitive datatype, that any "reference"
always gets a copy of the data.

 

Could you skip the variables entirely and just use an ArrayCollection?

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Bjorn Schultheiss
Sent: Wednesday, March 07, 2007 6:07 PM
To: [email protected]
Subject: Re: [flexcoders] Setting Multiple Bindable Properties

 

Yeah spot on,

I'm after the reference, not the primitive value.

 

 

The this[ 'myVal'+i ] idea was already proposed to me.

I guess what i'm looking for is a way to store the reference to the
bindable value in an array so that i can access via an array integer
index rather than using array access notation.

 

Its is the same if i go,

 

[code]

 

[Bindable] var myVal:Boolean

 

update( myVal );

 

function update( val:Boolean ) {

 val = true;

}

 

[/code]

 

Again i get the evaluated value and not the maintained reference.

 

 

Bjorn

 

On 08/03/2007, at 9:49 AM, Tracy Spratt wrote:






 

I am a bit out of my league here, but isn't it the case that to do what
you want, you need an array or *references* to the variables?  And
aren't "primitive" data typed variables really literal values and not
references?

 

Hmm, if you can enforce a naming convention, you could do:

function {

for ( var i = 0; i<nSomeNumber; i++ ) {
this["myVal " +  i ] = true;
}
}

(maybe a do while, instead of for?)

Tracy

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Bjorn Schultheiss
Sent: Wednesday, March 07, 2007 5:29 PM
To: [email protected]
Subject: [flexcoders] Setting Multiple Bindable Properties

 

Hey Ya'll

let me eloborate, say i have:

[code]

[Bindable] var myVal1:Boolean;
[Bindable] var myVal2:Boolean;

[/code]

and i want to update the values (which in turn would update the 
'view' ) via an array loop, intuitively i would code

[code]

function {
var myArray = [ myVal1, myVal2 ]
for ( var i = 0; i<myArray.length; i++ ) {
myArray[ i ] = true;
}
}

[/code]

Of course this does not update the bindable values but rather the 
arrays' indexed items.

How can i achieve this result?

Regards,

Bjorn

 

 

 

 

 

 

 

Reply via email to