I would expect you to only get that warning if you're using binding with the
MXML property... if you're not using binding, then it shouldn't care (it'll
just initialize the value at the time of instantiation). Does your MXML look
like this:
<mx:Label text="{arrayObj[0]}" />
I'm guessing you're doing that because you want "arrayObj[0]" to be
evaluated, as opposed to this:
<mx:Label text="arrayObj[0]" />
Where you'd actually get just the literal text.
The problem is that the curly braces *mean* use data-binding. What you're
doing (if you're doing something similar to the above) is taking advantage
of the fact that data-binding *also* means evaluate the expression to set
the value (as a step in the data-binding process).
I guess the "correct" way to get the results you're looking for is to
initialize the values in an event handler (like creationComplete).
Of course, you shouldn't be afraid of ArrayCollection... I've not tested it
to be sure, but I can't imagine you'd have enough UI elements bound to
enough ArrayCollection elements to make any kind of performance difference
that would out-pace the performance cost of the UI elements by themselves.
Event dispatch is all done natively in the Player... it seems to be
reasonably chipper.
Troy.
On 6/1/07, James <[EMAIL PROTECTED]> wrote:
I'm sick of seeing
"Data binding will not be able to detect changes when using square
bracket operator. For Array, please use ArrayCollection.getItemAt()"
when using an arrayObj[arrayPropertyOrIndex] inside of an MXML property.
I know that it won't be propagated down if the array changes, but in a
lot of cases, I don't need it to propagate down, and I don't want to
take the performance hit of using a more expensive object
(ArrayCollection) and in
addition to that, having extra event subscriptions to something that
will never change.
So why does the compiler have warnings for it?
It makes me feel like I'm doing something wrong when I see a bunch of
warnings. :(
I wish I could have a [Not-bindable] tag or something just to shut
that particular warning up.
(rant over)
Suggestions?
Thanks guys, love the group.
James Wilson
Atlanta-area Flex Programmer
[EMAIL PROTECTED] <James%40Flexpert.net>