I have: (1)
this["btn_a"].onRelease = function (){
this._parent[up_mc]._visible = true;
this._parent[add_mc].num = random(10)+190;
trace(this._parent);
}
and I change it to (2)
function click1(){
this._parent[up_mc]._visible = true;
this._parent[add_mc].num = random(10)+190;
trace(this._parent);
}
this["btn_a"].onRelease = function (){
click1();
}
When I click the button in (1), it shows ‘_level9’, but when I click the button in (2), it shows ‘undefined’. I know nothing about AS2, so please help me and explain in details. Thanks you very much.
scoping….
in the first one, you are calling a function that belongs to the button.
in the second, you are declaring a function at a level (your case:level9) and then calling it where it sits.
I think.