How can I create variable variables in ActionScript

Posted by Daniel Angel on Stack Overflow See other posts from Stack Overflow or by Daniel Angel
Published on 2012-08-31T18:38:57Z Indexed on 2012/09/01 15:38 UTC
Read the original article Hit count: 246

I'm doing this

mcomp7d101.onRelease = function() {
    getURL("javascript:Compartir("+id7d101+");");
}

mcomp7d102.onRelease = function() {
    getURL("javascript:Compartir("+id7d101+");");
}

mcomp7d103.onRelease = function() {
    getURL("javascript:Compartir("+id7d101+");");
}

mcomp7d150.onRelease = function() {
    getURL("javascript:Compartir("+id7d101+");");
}

you get the idea :)

How can I use a for loop to do something like:

for(ii = 101; ii < 150; ii++)
{
    mcomp7d+ii.onRelease = function() {
    getURL("javascript:Compartir("+id7d+ii);");
    }
}

I'm getting a syntax error. It seems that I can't create variable variables in compiled languages.

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript