Hey Y'all, I'm a bit confused on this subject as well. I am working on a moderately complex app with FDS and a Java backend. I have resorted to Arrays and flags to update the view when data is changed but I'd love to switch back to ArrayCollections! :(
Adobe examples of using [ArrayElementType] metadata with ArrayCollections: http://www.adobe.com/devnet/flex/articles/remoteobject_sabreamf_05.htm l Specifically: "In Flex 2 you can continue the strong-type pattern by defining the ArrayCollection element types with the following code: [Bindable] [ArrayElementType("com.renaun.samples.vo.UserVO")] private var users:ArrayCollection;" And here: http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhel p.htm?context=LiveDocs_Parts&file=00001863.html "You can type the items in an Array using the [ArrayElementType] metadata tag. I have not tried it with ArrayCollection, but it should work. You can find more info here: http://livedocs.macromedia.com/flex/2/docs/00001652.html" Stephen may not had not tried it but still I think it could be clearer because later we see: Examples of [ArrayElementType] not working with ArrayCollections: http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhel p.htm?context=LiveDocs_Parts&file=00001652.html Specifically ":graphex said on Feb 27, 2007 at 12:59 PM : How about setting the type of elements in an ArrayCollection? smgilson said on Feb 28, 2007 at 4:44 AM : This tag only works for Arrays - there is no way to set the type of elements in ArrayCollection." And my personal experience with AMF (FDS and LSOs) and it working only with Arrays. Also, a search through Jira (the adobe bug database) shows that there are now bugs currently filed about this subject nor will this feature be added. My guess on this is that you are trying to compensate for an missing feature of ECMA script, strongly typed array elements, by using Metadata. If that is correct, is Adobe going to wait for the ECMA script standard to change or will it take the initiative and allow for strongly typed elements in ArrayCollections? What am I missing? --- In [email protected], "Peter Connolly" <[EMAIL PROTECTED]> wrote: > > I entered a bug for it: > > https://bugs.adobe.com/jira/browse/FLEXDOCS-105 > > > On 8/21/07, Stephen Gilson <[EMAIL PROTECTED]> wrote: > > > > OK I get it now. I can update the doc for this. > > > > Stephen > > > > ------------------------------ > > *From:* [email protected] [mailto:[EMAIL PROTECTED] *On > > Behalf Of *Peter Connolly > > *Sent:* Tuesday, August 21, 2007 6:01 PM > > *To:* [email protected] > > *Subject:* Re: [flexcoders] ArrayElementType is broken, worthless or > > poorly documented (or perhaps all 3) > > > > Sorry. I guess I'm too used to ActionScript and MXML being > > interchangeable. Re-reading this chapter leads me to the conclusion that > > metadata, although defined in ActionScript, really is just a tool to > > controlling the compilation of MXML. Shouldn't something that fundamental > > to Flex be discussed in more detail in the (otherwise encyclopedic) Flex > > Developer's Guide...? > > > > If I understand this correctly then, the metadata tag -- ArrayElementType > > -- is indicating to the MXML compiler to check the type of any elements > > being added/replaced in an Array via MXML only, and that specifying > > new/modified elements to that same Array using ActionScript will not be > > flagged as an error. > > > > Correct? > > > > On 8/21/07, Stephen Gilson <[EMAIL PROTECTED]> wrote: > > > > > > I'm not sure what the doc bug is. From the doc: > > > > > > "To allow the Flex MXML compiler to perform type checking on Array > > > elements, you can use the [ArrayElementType] metadata tag to specify the > > > allowed data type of the Array elements, as the following example shows: > > > " > > > > > > So, the doc says it is the MXML compiler that uses this information. > > > > > > Stephen > > > > > > ------------------------------ > > > *From:* Peter Connolly [mailto:psconnolly@ gmail.com] > > > *Sent:* Tuesday, August 21, 2007 3:52 PM > > > *To:* [email protected] > > > *Cc:* Stephen Gilson > > > *Subject:* Re: [flexcoders] ArrayElementType is broken, worthless or > > > poorly documented (or perhaps all 3) > > > > > > How does one go about submitting a bug to Adobe? > > > > > > On 8/21/07, Gordon Smith <[EMAIL PROTECTED]> wrote: > > > > > > > > That sounds like a doc bug. [ArrayElementType] only applies to MXML. > > > > > > > > - Gordon > > > > > > > > ------------------------------ > > > > *From:* [email protected] [mailto: [EMAIL PROTECTED] > > > > *On Behalf Of *Peter Connolly > > > > *Sent:* Tuesday, August 21, 2007 1:06 AM > > > > *To:* [email protected] > > > > *Subject:* Re: [flexcoders] ArrayElementType is broken, worthless or > > > > poorly documented (or perhaps all 3) > > > > > > > > The only example of ArrayElementType's usage in Creating and > > > > Extending Flex Components<http://www.adobe.com/go/flex2_components_pdf>(p. 50) is in the context of ActionScript, not MXML. > > > > > > > > On 8/21/07, Rákos Attila <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > The ArrayElementType metadata tag has effect only if you set the > > > > > array's > > > > > elements through MXML (and not AS). > > > > > > > > > > Attila > > > > > > > > > > > > > > > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- =-=-=-=-=-=-=-=-=-= > > > > > From: Peter Connolly <[EMAIL PROTECTED] <psconnolly% 40gmail.com>> > > > > > To: [email protected] <flexcoders% 40yahoogroups.com> <[email protected]<flexcoders% 40yahoogroups.com> > > > > > > > > > > > Date: Tuesday, August 21, 2007, 5:59:41 AM > > > > > Subject: [flexcoders] ArrayElementType is broken, worthless or > > > > > poorly documented (or perhaps all 3) > > > > > > > > > > --====----====----====----====----====----====----====---- ====----====----===-- > > > > > > > > > > > > > > > > > > > > Granted, there is only one page in the Flex Components book that > > > > > describes the use of this metadata tag... > > > > > > > > > > But, even so, you'd expect the following code to issue either a > > > > > compile-time or runtime error: > > > > > > > > > > <?xml version="1.0"?> > > > > > <!-- usingas/IntrospectionForIn.mxml --> > > > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml "> > > > > > <mx:Script> > > > > > <![CDATA[ > > > > > [ArrayElementType("Number")] > > > > > public var intArray:Array = ["A", "B", "C"]; > > > > > > > > > > public function formatTA(event:Event):void { > > > > > for (var i:uint=0; i<intArray.length; i++) { > > > > > ta1.text += "\n" + intArray[i].toString(); > > > > > } > > > > > nb! sp; } > > > > > ]]> > > > > > </mx:Script> > > > > > <mx:TextArea id="ta1" text="Press the button!" width="300" > > > > > height="200"/> > > > > > <mx:Button label="Press Me!" click="formatTA(event);"/> > > > > > </mx:Application> > > > > > > > > > > There is no compilation warning or error. There is no runtime > > > > > error. Substitute "int" for "Number"... same result. It prints out "A", > > > > > "B", "C",... > > > > > > > > > > > > > > > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- =-=-=-=-=-=-=-=-=-= > > > > > > > > > > > > > > > > > > > > > >

