Paul Andrews wrote:
> criptopus wrote:
>> If i have an event Listener of the following type on an array element 
>> how do I determine the element from within the event so as to set one 
>> of the elements properties.
>>
>> e.g.
>>
>> imgArray[imgIdx].addEventListener(Event.COMPLETE, adjustImage);
>>
>> private function adjustImage(e:Event):void
>> {
>>
>> var picWidth:int=(e.currentTarget as Image).width;
>> imgArray[???].height=picWidth * 2;
>>
>> }
>>
>> - Stephen
>>
>>   
> currentTarget refers to the image object, not the array.
>
> imgArray is an Array reference
>
> imgArray[imgIdx] is an Object reference.
>
> Effectively you are trying to write "picWidth.height=picWidth * 2;"
Oops, I should say:  (e.currentTarget as Image).height = picWidth * 2;

Probably better written as

var pic:Image=(e.currentTarget as Image);
pic.height=pic.width * 2;

Paul


>
>
> Paul
>
>
>
>
>

Reply via email to