I am being a bit puzzled on figure out how to release temporary identifiers to recycle them.
For instances, suppose that I have 2 loops to instantiate dynamic mcs from library like this:
If I run this snippet of code, the compiler will complain and tell that I have a "Duplicate variable definition".Code:var zz:Number; for (zz=0;zz<=4;zz++) { var _mc:MovieClip = new clsSquare(); _mc.name = "mcSquare"+zz; addChild(_mc); } for (zz=0;zz<=4;zz++) { var _mc:MovieClip = new clsBall(); _mc.name = "mcBall"+zz; addChild(_mc); }
I cannot understand why it doesnt complain when it is redefined five times within the first loop, and just complain because the second lop.
Anyway, there is a way to release the _mc identifier then I can reuse it? I am an addicted to standartize names and recycle code...
Thanks!




Reply With Quote