<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style>.hmmessage P {
        PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
BODY.hmmessage {
        FONT-SIZE: 10pt; FONT-FAMILY: Tahoma
}
</style>
<meta content="MSHTML 6.00.6000.17080" name="GENERATOR">
<style id="owaTempEditStyle"></style><style title="owaParaStyle"><!--P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
--></style>
</head>
<body class="hmmessage" ocsi="x">
<div style="FONT-SIZE: 13px; COLOR: #000000; DIRECTION: ltr; FONT-FAMILY: Tahoma">
<div>take the 'var' out. We don't have 'var'.</div>
<div dir="ltr"><font face="Tahoma" color="#000000" size="2"></font>&nbsp;</div>
<div id="divRpF584862" style="DIRECTION: ltr">
<hr tabindex="-1">
<font face="Tahoma" color="#000000" size="2"><b>From:</b> xerte-bounces@lists.nottingham.ac.uk [xerte-bounces@lists.nottingham.ac.uk] On Behalf Of Dave Burnett [d_b_burnett@hotmail.com]<br>
<b>Sent:</b> 14 October 2010 00:15<br>
<b>To:</b> Xerte list<br>
<b>Subject:</b> RE: [Xerte] Loop through an object?<br>
</font><br>
</div>
<div></div>
<div><br>
Paul, tried it before I posted:<br>
<br>
tempGroup = new Object();<br>
tempGroup.a = &quot;1&quot;;<br>
tempGroup.b = &quot;2&quot;;<br>
tempGroup.c = &quot;3&quot;;<br>
<br>
for (var prop in tempGroup) {<br>
&nbsp;&nbsp;&nbsp; debug(&quot;myObject.&quot; &#43; prop &#43; &quot; = &quot; &#43; tempGroup[prop]);<br>
} <br>
<br>
<br>
<br>
Nothing.<br>
<br>
<br>
<br>
<br>
<br>
<br>
<hr id="stopSpelling">
Subject: RE: [Xerte] Loop through an object?<br>
Date: Wed, 13 Oct 2010 15:46:17 -0700<br>
From: Paul.Swanson@harlandfs.com<br>
To: xerte@lists.nottingham.ac.uk<br>
<br>
<style>@page WordSection1 {}
.ExternalClass P.ecxMsoNormal {
        FONT-SIZE: 12pt; MARGIN-BOTTOM: 0pt; FONT-FAMILY: 'Times New Roman','serif'
}
.ExternalClass LI.ecxMsoNormal {
        FONT-SIZE: 12pt; MARGIN-BOTTOM: 0pt; FONT-FAMILY: 'Times New Roman','serif'
}
.ExternalClass DIV.ecxMsoNormal {
        FONT-SIZE: 12pt; MARGIN-BOTTOM: 0pt; FONT-FAMILY: 'Times New Roman','serif'
}
.ExternalClass A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
.ExternalClass SPAN.ecxMsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
.ExternalClass A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
.ExternalClass SPAN.ecxMsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
.ExternalClass P {
        FONT-SIZE: 12pt; MARGIN-LEFT: 0in; MARGIN-RIGHT: 0in; FONT-FAMILY: 'Times New Roman','serif'
}
.ExternalClass SPAN.ecxEmailStyle18 {
        FONT-WEIGHT: normal; COLOR: #1f497d; FONT-STYLE: normal; FONT-FAMILY: 'Calibri','sans-serif'; TEXT-DECORATION: none
}
.ExternalClass .ecxMsoChpDefault {
        FONT-SIZE: 10pt
}
.ExternalClass DIV.ecxWordSection1 {
        
}
</style>
<div class="ecxWordSection1">
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125); FONT-FAMILY: 'Calibri','sans-serif'">Use the for..in statement:</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125); FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">for..in Statement</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">Usage</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">for (variableIterant in object) {</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp;&nbsp;&nbsp; statement(s);
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">}
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">Player version: Flash Player 5</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">Iterates over the properties of an object or elements in an array and executes the statement for each property or element. Methods of an object are not
 enumerated by the for..in action.</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">Some properties cannot be enumerated by the for..in action. For example, movie clip properties, such as _x and _y, are not enumerated. In external class
 files, static members are not enumerable, unlike instance members.</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">The for..in statement iterates over properties of objects in the iterated object's prototype chain. Properties of the object are enumerated first, then
 properties of its immediate prototype, then properties of the prototype's prototype, and so on. The for..in statement does not enumerate the same property name twice. If the object child has prototype parent and both contain the property prop, the for..in
 statement called on child enumerates prop from child but ignores the one in parent.</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">The curly braces ({}) that are used to enclose the block of statements to be executed by the for..in statement are not necessary if only one statement is
 executed.</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">If you write a for..in loop in a class file (an external AS file), then instance members are not available for the loop, but static members are. However,
 if you write a for..in loop in a FLA file for an instance of the class, then instance members are available but static ones are not.</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">Parameters</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; variableIterant:String — The name of a variable to act as the iterant, referencing each property of an object or element in an array.</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">Example</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">The following example uses for..in to iterate over the properties of an object:</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">var myObject:Object = {firstName:&quot;Tara&quot;, age:27, city:&quot;San Francisco&quot;};
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">for (var prop in myObject) {
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp;&nbsp;&nbsp; trace(&quot;myObject.&quot;&#43;prop&#43;&quot; = &quot;&#43;myObject[prop]);
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">}
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">//output
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">myObject.firstName = Tara
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">myObject.age = 27
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">myObject.city = San Francisco</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">The following example uses for..in to iterate over the elements of an array:</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">var myArray:Array = new Array(&quot;one&quot;, &quot;two&quot;, &quot;three&quot;);
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">for (var index in myArray)
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp;&nbsp;&nbsp; trace(&quot;myArray[&quot;&#43;index&#43;&quot;] = &quot; &#43; myArray[index]);
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">// output:
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">myArray[2] = three
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">myArray[1] = two
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">myArray[0] = one</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">The following example uses the typeof operator with for..in to iterate over a particular type of child:</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">for (var name in this) {
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp;&nbsp;&nbsp; if (typeof (this[name]) == &quot;movieclip&quot;) {
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; trace(&quot;I have a movie clip child named &quot;&#43;name);
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">&nbsp;&nbsp;&nbsp; }
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">}</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">Note: If you have several movie clips, the output consists of the instance names of those clips.</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">The following example enumerates the children of a movie clip and sends each to Frame 2 in its respective Timeline. The RadioButtonGroup movie clip is a
 parent with three children: _RedRadioButton_, _GreenRadioButton_,, and _BlueRadioButton_.</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Calibri','sans-serif'">for (var name in RadioButtonGroup) { RadioButtonGroup[name].gotoAndStop(2); }</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 11pt; COLOR: rgb(31,73,125); FONT-FAMILY: 'Calibri','sans-serif'"></span>&nbsp;</p>
<div style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: 1.5pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: medium none">
<div>
<div style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<p class="ecxMsoNormal"><b><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</span></b><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> xerte-bounces@lists.nottingham.ac.uk [mailto:xerte-bounces@lists.nottingham.ac.uk]
<b>On Behalf Of </b>Dave Burnett<br>
<b>Sent:</b> Wednesday, October 13, 2010 3:35 PM<br>
<b>To:</b> Xerte list<br>
<b>Subject:</b> [Xerte] Loop through an object?</span></p>
</div>
</div>
<p class="ecxMsoNormal">&nbsp;</p>
<p class="ecxMsoNormal" style="MARGIN-BOTTOM: 12pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"><br>
myobject = new Object();<br>
<br>
<br>
myobject[130] = &quot;alpha&quot;;<br>
myobject[230] = &quot;bravo&quot;;<br>
myobject[330] = &quot;charlie&quot;;<br>
<br>
Not knowing the numerics that will wind up in there, how do I loop through it?<br>
<br>
e.g. I want to match the alpha values to something else and get the property.<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send
 it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University
 of Nottingham. </span></p>
<p class="ecxMsoNormal"><span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised
 to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
</span></p>
</div>
</div>
<br>
_______________________________________________ Xerte mailing list Xerte@lists.nottingham.ac.uk http://lists.nottingham.ac.uk/mailman/listinfo/xerte This message and any attachment are intended solely for the addressee and may contain confidential information.
 If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email
 do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own
 checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
</div>
</div>
</body>
</html>