# Simplify XML AS3 Code

**URL:** <https://forum.kirupa.com/t/simplify-xml-as3-code/291740>\
**Category:** flash\
**Created:** [July 4, 2009, 10:46am UTC](https://forum.kirupa.com/t/simplify-xml-as3-code/291740 "2009-07-04T10:46:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![johanndm](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@johanndm](https://forum.kirupa.com/u/johanndm)\
**Post date:** [July 4, 2009, 10:46am UTC](https://forum.kirupa.com/t/simplify-xml-as3-code/291740/1 "2009-07-04T10:46:55Z")

</div>

Hi,

I have to repeat the follow code 4x5 times currently…

t\_factor = rc\_xml.p.rc.(@id == t\_type).pduration.pfactor;  
t\_base = rc\_xml.p.rc.(@id == t\_type).pduration.pbase;  
t\_min = rc\_xml.p.rc.(@id == t\_type).pduration.pmin;  
t\_start = rc\_xml.p.rc.(@id == t\_type).pduration.pstart;  
t\_end = rc\_xml.p.rc.(@id == t\_type).pduration.pend;

I’m trying to do the following:

var **myArray\_1** :Array = new Array(“pduration”, “poutfit”, “pbackground”, “ppax”);  
var i:int = 0;

for (i=0; i\<4; i++)  
{  
t\_factor = rc\_xml.p.rc.(@id == t\_type). **myArray\_1** \*.pfactor;  
t\_base = rc\_xml.p.rc.(@id == t\_type). **myArray\_1** \*.pbase;  
t\_min = rc\_xml.p.rc.(@id == t\_type). **myArray\_1** \*.pmin;  
t\_start = rc\_xml.p.rc.(@id == t\_type). **myArray\_1** \*.pstart;  
t\_end = rc\_xml.p.rc.(@id == t\_type). **myArray\_1** \*.pend;  
}

PROBLEM is that Flash won’t accept the VARIABLE myArray\* in place of the element name?

Can someone please advise 😉

Thanks,  
Johann
