[flexcoders] Re: Repeaters and Referencing Component IDs
--- In flexcoders@yahoogroups.com, Jason jason.merr...@... wrote: I'd have to test it to know for sure, but I was just theorizing on why you were not able to access the id array for the image. I could further theorize that the image tag, being a child of the repeated container, is treated differently by Repeater than the container, but that is theorizing to support a theory that I do not even know is correct. Uh, OK. :) thanks anyway. Anyone else? This doesn't directly address your issue, but you might be able to look at your file vs. my file and see why my labels array gets gets populated and your _images array doesn't. I put a breakpoint on the trace line, and both the boxes and lables arrays were populated as expected: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute mx:Script ![CDATA[ private function onRepeatEnd():void{ trace(boxes.toString()); } ]] /mx:Script mx:ArrayCollection id=arrayData mx:Array mx:Object prop=foo / mx:Object prop=bar / mx:Object prop=baz / /mx:Array /mx:ArrayCollection mx:Repeater id=testRep dataProvider={arrayData} repeatEnd=onRepeatEnd() mx:HBox id=boxes mx:Label id=labels text={testRep.currentItem.prop} / /mx:HBox /mx:Repeater /mx:Application
[flexcoders] Re: Repeaters and Referencing Component IDs
I'd have to test it to know for sure, but I was just theorizing on why you were not able to access the id array for the image. I could further theorize that the image tag, being a child of the repeated container, is treated differently by Repeater than the container, but that is theorizing to support a theory that I do not even know is correct. Uh, OK. :) thanks anyway. Anyone else?
[flexcoders] Re: Repeaters and Referencing Component IDs
--- In flexcoders@yahoogroups.com, Tracy Spratt tspr...@... wrote: The first thing I would do is crate a custom component that encapsulates the repeated UI(tree and image), and repeat that. Then I would create a setter for the image source (set imageSource()) in the repeated component. I would give my component and id, say myTree. Repeater would make an array of the 5 instances. Then I could do: myTree[0].imageSource = myImageUrl; OK thanks! I will do that, however, custom component discussion aside, this seems to be do-able without a custom component (even though yeah, I should wrap it up into one). The main point of my question is that it seems that, applying your example, myTree is not an array of several objects (demonstrated with my example) as I would have thought - that is the problem with my code I'm trying to figure out. In your example, I would think myTree be an array with a length of 5 (since the DP is 5 in length) - each object in the array being an Image (or in your example, an instance of your custom component). But as my example shows, it's length is 1. Best practices aside, from a pure coding perspective (bad as it may be), why does my _images array have a length of 1 instead of 5 like the DP?
RE: [flexcoders] Re: Repeaters and Referencing Component IDs
I don't know that repeater makes a reference array for child components of the repeated parent. It may, but I never do it that way. Try the component. The refactor will take you maybe 3 minutes, and you will never go back. Tracy Spratt Lariat Services Flex development bandwidth available From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Jason Sent: Thursday, February 19, 2009 4:13 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Repeaters and Referencing Component IDs --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tracy Spratt tspr...@... wrote: The first thing I would do is crate a custom component that encapsulates the repeated UI(tree and image), and repeat that. Then I would create a setter for the image source (set imageSource()) in the repeated component. I would give my component and id, say myTree. Repeater would make an array of the 5 instances. Then I could do: myTree[0].imageSource = myImageUrl; OK thanks! I will do that, however, custom component discussion aside, this seems to be do-able without a custom component (even though yeah, I should wrap it up into one). The main point of my question is that it seems that, applying your example, myTree is not an array of several objects (demonstrated with my example) as I would have thought - that is the problem with my code I'm trying to figure out. In your example, I would think myTree be an array with a length of 5 (since the DP is 5 in length) - each object in the array being an Image (or in your example, an instance of your custom component). But as my example shows, it's length is 1. Best practices aside, from a pure coding perspective (bad as it may be), why does my _images array have a length of 1 instead of 5 like the DP?
[flexcoders] Re: Repeaters and Referencing Component IDs
--- In flexcoders@yahoogroups.com, Tracy Spratt tspr...@... wrote: I don't know that repeater makes a reference array for child components of the repeated parent. It may, but I never do it that way. OK, because you just said, Repeater would make an array of the 5 instances. How is that fundamentally different? The custom component you're suggesting is just a class just like mx:Image is, so I don't see how your example is any different really? NOT trying to argue, just trying to understand. If you say, myTree[0].imageSource = myImageUrl; - isn't myTree an array created from doing c:MyTree id=myTree / inside the repeater - just like mx:Image id=_images / as in my example? Again, NOT trying to argue, just trying to understand the difference! Thanks so much for your help!
RE: [flexcoders] Re: Repeaters and Referencing Component IDs
I'd have to test it to know for sure, but I was just theorizing on why you were not able to access the id array for the image. I could further theorize that the image tag, being a child of the repeated container, is treated differently by Repeater than the container, but that is theorizing to support a theory that I do not even know is correct. Tracy Spratt Lariat Services Flex development bandwidth available From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Jason Sent: Thursday, February 19, 2009 4:34 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Repeaters and Referencing Component IDs --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tracy Spratt tspr...@... wrote: I don't know that repeater makes a reference array for child components of the repeated parent. It may, but I never do it that way. OK, because you just said, Repeater would make an array of the 5 instances. How is that fundamentally different? The custom component you're suggesting is just a class just like mx:Image is, so I don't see how your example is any different really? NOT trying to argue, just trying to understand. If you say, myTree[0].imageSource = myImageUrl; - isn't myTree an array created from doing c:MyTree id=myTree / inside the repeater - just like mx:Image id=_images / as in my example? Again, NOT trying to argue, just trying to understand the difference! Thanks so much for your help!