<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc = "http://purl.org/dc/elements/1.1/" xmlns="http://purl.org/rss/1.0/">
	<channel rdf:about="http://livedocs.adobe.com/">
	<title>LiveDocs Comments - flash - 9.0 - main - 00002498.html</title>	
		<link>http://livedocs.adobe.com/</link>
		<description>Macromedia LiveDocs - online documentation with user feedback.</description>
		<copyright>Copyright 2009, Macromedia, Inc.</copyright>
		<dc:date>2009-11-26T04:48:10</dc:date>
		<dc:language>en-us</dc:language>
		<items>
			<rdf:Seq>
				<rdf:li rdf:resource="http://livedocs.adobe.com/flash/9.0/main/00002498.html#72650" />
			</rdf:Seq>
		</items>
	</channel>
	
	<item rdf:about="http://livedocs.adobe.com/flash/9.0/main/00002498.html#72650">
		<title>flash/9.0/main/00002498.html</title>
		<link>http://livedocs.adobe.com/flash/9.0/main/00002498.html#72650</link>
		<description>When Flash initializes Array inspectable properties, Flash does this:&lt;br /&gt;&lt;br /&gt;arrProp = new Array();&lt;br /&gt;arrProp[0] = zeroValue;&lt;br /&gt;arrProp[1] = oneValue;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;So when the getter setter gets called the first time, the Array is empty, then every call to each index will not call the setter method, only the getter.&lt;br /&gt;&lt;br /&gt;I consider this a bad practice, and initialization should be like this: &lt;br /&gt;&lt;br /&gt;arrProp = new Array(zeroValue, oneValue, ...);&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;arrProp = [zeroValue, oneValue, ...];&lt;br /&gt;&lt;br /&gt;This will give a real assigned value when the component initializes.&lt;br /&gt;&lt;br /&gt;Besides the current approach can cause some other problems like not initializing Arrays when the getter/setter uses a copy instead of the original Array.&lt;br /&gt;&lt;br /&gt;Just consider this example:&lt;br /&gt;&lt;br /&gt;Your getter setter methods need to make a copy of the Array and not use the original reference. &lt;br /&gt;The setter method receives an Array and makes a copy with the slice or concat method and finally stores it in a property. &lt;br /&gt;The getter method creates and returns a copy (created with slice or concat) of this Array property.&lt;br /&gt;&lt;br /&gt;Using the procedure above:&lt;br /&gt;&lt;br /&gt;1) The first line stores a copy of the empty Array.&lt;br /&gt;2) In the second line and further, you get another copy (not the original Array stored in the component) and store values in it. So what you are changing is a copy instead of the original Array, letting the original Array without any elements.&lt;br /&gt;&lt;br /&gt;This approach is used a lot by programmers to avoid users messing with the contents of critical Arrays. This is the same behavior found in Arrays properties like the filter property and like many others programmed by Macromedia/Adobe.&lt;br /&gt;&lt;br /&gt;The question is: If they use this approach for their own objects, then why they didn't expected their users to use it.&lt;br /&gt;&lt;br /&gt;To solve this problem probably the best way to do it is creating an initializing Boolean property initialized with to true. Detect this variable in the getter method: if it is true return the real reference to the Array, if false return just a copy. You will have to set this variable to false on the constructor or any other initializing method.</description>
		<dc:creator>juankpro</dc:creator>
		<dc:type>0 0</dc:type>
		<dc:date>2007-08-25T06:26:11</dc:date>
	</item>
	</rdf:RDF>

