Thanks for taking a look at this. I'm guessing the problem has to do with some difference in how the repeater instantiates the TestViews between initialization and subsequent refreshes. I took a look at the generated-as, but I haven't had time to get my head around it.
I think the corruption of the list might be a separate problem caused by the slice() function. I haven't gotten to the bottom of it, but replacing it with my own slice method fixed the list corruption issue without fixing the data binding issue. I took your advice and made the change event handling explicit. This fixed the problem. I'll probably go ahead and use explicit event handling whenever I'm using a repeater. I've attached the working sources for anyone who's interested. Thanks Again, Alex On Mon, 14 Feb 2005 22:10:12 -0800, Matt Chotin <[EMAIL PROTECTED]> wrote: > > > > I spent too much time playing around with this and can't figure out what's > going wrong. If you debug further you'll see that the original contents of > the project.pages array are getting corrupted (the elements are getting > deleted or something). I tried removing certain bindings and didn't really > see much in the way of improvement. You can see everything go haywire > without even selecting a page, just select First, then Second, then First > again and you'll see the TestViews disappear (if you put a backgroundcolor > on the views you'll see it's really the label being set to empty string, not > the thing disappearing). The selection then has even more problems for > reasons that I couldn't decipher. > > > > See if you can eliminate data binding from the equation entirely. Just have > everything set using event handlers and getter/setters, eliminate the curly > braces. There may be something about all the bindings and relationships > that is getting it confused at runtime, but I couldn't figure it out at all. > > > > The binding mechanism itself is a little much for me to try to explain right > now J But we use a different mechanism in Flex than was written for Flash. > You can see a little more of how it all gets set up if you look at the > generated-as files (see keep-generated-as in flex-config) but I warn you > that you may be seeing a little too much sausage being made J > > > > Matt > > > > ________________________________ > > > From: Alex Cruikshank [mailto:[EMAIL PROTECTED] > Sent: Monday, February 14, 2005 5:13 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Losing data bindings after seemingly unrelated event. > > > > > Hi All, > We're developing an application that permits selection of page objects > for editing from multiple views. We're trying to data-bind each of > the views to a shared selection object to reduce the connections > between components. This is working fine so long as you don't > interact with other parts of the application. We also have a section > list that filters the list of pages visible to the user. It appears > that changing the section causes the views to lose their bindings to > the selection object. This is confusing because, section selection > only operates on another 'pages' array. I don't understand why it > would affect the data bindings at all, especially since the bindings > are to an unrelated object. > > I've attached a stripped down version of the application that exhibits > the same behavior. To see what I'm talking about: > 1. Click on the page labels on the right side of the app. The word > 'selected' should appear next to the page you clicked last. > 2. Click on 'First' or 'Second' on the combo box to the left. > 3. Click on the page labels again to the right. They no longer change. > > The text for a page label is "{ page.label }{ selected(selection.list) > ? ' (selected)' : '' }". Changes to selection.list automatically > update this data binding expression (at least until you change the > selection). > > I would greatly appreciate any insight that anyone can provide. Also, > I would love to find an in-depth reference describing how data binding > works in Flex/Flash. > > Thanks, > Alex Cruikshank > Engineer > Carbon Five > > > > > 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.
testBindingProblem.mxml
Description: Binary data
TestSelection.as
Description: Binary data
TestView.mxml
Description: Binary data