For example we create 3 buttons in a loop with an "OnRelease" function.
Within the buttons onRelease function, MyFunction + i will be called...but it isnt because the variable is never passed within the function.
How would you do that then
for (i=1; i<=3; i++) {
this["my_bnt"+i].onRelease = function() {
this["My_function"+i](); //<<<<Dynamically create function name
//Or to populate any variables inside a function while in a loop :(
};
}
//Call on these after the buttons have been created
this.My_function1 = function() {
trace("Function 1 hit");
};
this.My_function2 = function() {
trace("Function 2 hit");
};
this.My_function3 = function() {
trace("Function 3 hit");
};
This post has been edited by Maxx: 25 April 2009 - 10:25 AM

New Topic/Question
Reply



MultiQuote



|