how can i get the value from a function
how can i get the value from a function? this code makes my hero(commander) move to the last place the mouse clicked. I want to see the value of "secondclick" after it is assigned to my movie clip (hero ,commander, ect.).
Code:
function select(obj) {
secondclick = 0;
tab = false;
obj.onPress = function() {
createEmptyMovieClip("square_mc", 0);
square_mc.lineStyle(1, 0x00FF00);
square_mc.moveTo(0, 0);
square_mc.lineTo(0, 100);
square_mc.lineTo(100, 100);
square_mc.lineTo(100, 0);
square_mc.lineTo(0, 0);
secondclick++;
};
onEnterFrame = function () {
stoper = Math.round(obj._x-_root.ldx);
if (tab == true) {
obj._rotation = Math.atan2(_root.ldy-obj._y, _root.ldx-obj._x)/Math.PI*180+90;
xw = Math.sin(obj._rotation*(Math.PI/180))*8;
yw = Math.cos(obj._rotation*(Math.PI/180))*8*-1;
obj._x += xw;
obj._y += yw;
}
if (stoper>=-3 && stoper<=3) {
tab = false;
}
hie = obj._height;
wie = obj._width;
square_mc._x -= (square_mc._x-(obj._x-(wie/2)-.5));
square_mc._y -= (square_mc._y-(obj._y-(hie/2)-.5));
square_mc._width = 2+(obj._width);
square_mc._height = 2+(obj._height);
};
}
onMouseDown = function () {
_root.ldx = _root._xmouse;
_root.ldy = _root._ymouse;
_root.tab = true;
};
select(_root.commander);
select(_root.commander2);
i just want to know a way to see the value of "secondclick" from a dynamic text feild, if possible.