Hi All,
I am currently putting together a complex mask for a test site and cannot seem to get a “simple” function to work. I am all out of ideas, and could do with some input and help.
I basically have an object that is repelled by the mouse using the following actionscript that I sourced from toxiclab.com
object AS Frame 1:
x00 = _x;
y00 = _y;
MAAI = _root.spread(4);
_root.spread(4); being a function in my _root directory:
spread = function(multiplier) {
total = 1000 * multiplier;
trace(total);
}
object AS Frame 2:
x0=_x
y0=_y
x=_root._xmouse
y=_root._ymouse
a=x-x0
b=y-y0
r=Math.sqrt(aa+bb)
quer_fugir_x=this._x-(a/r)*MAAI/r
quer_fugir_y=this._y-(b/r)*MAAI/r
quer_voltar_x=(x00-x0)/2
quer_voltar_y=(y00-y0)/2
this._x=quer_fugir_x+quer_voltar_x
this._y=quer_fugir_y+quer_voltar_y
object AS Frame 3:
gotoAndPlay(“2”);
The “object” repels correctly when a manual input of a number is inserted into
MAAI =
but when I replace the number with my function
_root.spread(4);
the object no longer repels as it should despite the figure 4000 continually refresshing in the output dialog box.
I hope I have explained this clearly enough!? Any help would be greatly appreciated.
Cheers,
Tree73