PDA

View Full Version : Listing elements DOM position on the stage


jaylaw81
05-09-2007, 06:11 PM
I've been having alot of issues with changing elements values on the stage using the following code.


fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[1].setTextString( vObj.cfbonus );


The issue is that i'm running this code against different swf templates that get loaded in and need to make sure that the element position on the same is always 1. Is there a way to find out what the elements position is?

jaylaw81
05-10-2007, 12:31 PM
I've tried this, but it doesnt give you the true element position.

for( i=0; i < fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements.length; i++){
alert( fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[i].getTextString() + i )
}

Does anyone have any other ideas? I know if you create swfs within fireworks that you can set the element position by what layer it is on, but in flash it seems that there is no way to know.

jaylaw81
05-29-2007, 04:11 PM
still no solution??

abeall
06-23-2007, 05:20 AM
Try for...in instead:

var elems = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements;
for(var i in elems){
alert(i + ': '+elems[i]);
}