I have an array that makes multiple textfields based off a user variable. The code below is connected to a function that fires when text is added. From there it’s supposed to find the widest text field, and then apply the width to rest of the textfields so they all are the same size.
Here is the code that is giving me problems. I could use a second look to see perhaps if my syntax is improper or if there’s a better way at going at this.
for (var ied: int=1; ied>=electoff.electinput.textArray.length; ied++)
{
trace("one");
widest=(electoff.electinput.textArray["b"+ied].width>widest)?electoff.electinput.textArray["b"+ied].width:widest;
}
for (i =ied; i<electoff.electinput.textArray.length; ied++)
{
electoff.electinput.textArray["b"+ied].width = widest;
trace("two");
}
Here’s the error I’m getting:
TypeError: Error #1010: A term is undefined and has no properties. at
NewPlv2_fla::MainTimeline/ajWidth()[NewPlv2_fla.MainTimeline::frame1:650] at NewPlv2_fla::MainTimeline/_keys()[NewPlv2_fla.MainTimeline::frame1:774]
AS3.0 Array is indices are zero-based, which means that the first element in the array is [0], the second element is [1], and so on.
so FYI you trying to access
textArray["b"+ided]. but this syntax is a Associative arraysI tested following code. check please.