Declaring variable in dynamically created movieclip

Ok I know AS3 i the biggest craaa*p ever but this is really insane !!:m:
I’ve tried to declare variable named ‘var_1’ inside of dynamically created movie clip ‘movie_clip_1’ and since ‘i’ is loop variable (‘i’ value is 1) I was trying to do it this way:

getChildByName(‘movie_clip_’+i).var_1=5

stupid program gives me an error saying :

*1119: Access of possibly undefined property bar through a reference with static type flash.display:DisplayObject.
*
WTF!!?? I was totally pissed off and I was trying to do it this way: movie_clip_1.var_1=5 and it worked. Then after few hours seeking for solution (was also trying as2 command ‘set’ but it seems to be no longer available) I’ve randomly tried:

getChildByName(‘movie_clip_’+i)[‘var_1’]=5

and it worked!! Unfuc*ing believable stupid and doesn’t make any sense. Is it only me thinking that way or this AS3 is totally weird??!!