Passing a variable to set a movieclip location
in frame 1 of the movie have defined following:
var cl_y=502.0;
elsewhere, running following script:
-- seaty original position of movie clip defined in frame 1
var seaty = this+"_y";
-- resets position of movie clip original position
this._y = seaty;
(note - setting _y position in code in order simplify forum post)
i expected this._y = seaty; reset position of movie clip original position defined in frame 1. however, nothing happens.
i have used trace () discover value of seaty:
running trace(seaty) produces _level0.cl_y
please note trace(seaty) not equal value of _level0.cl_y (which wanting achieve)
i tried replacing:
this._y = seaty;
with following:
this._y = level0.cl_y;
and produces desired result (moving movieclip original position)
even though seaty = level0.cl_y
why work:
this._y = level0.cl_y;
and yet doesn't work:
this._y = seaty;
(i need work because need use same function reset position of numerous movieclips, different original positions)
many in expectation
var cl_y=502.0;
elsewhere, running following script:
-- seaty original position of movie clip defined in frame 1
var seaty = this+"_y";
-- resets position of movie clip original position
this._y = seaty;
(note - setting _y position in code in order simplify forum post)
i expected this._y = seaty; reset position of movie clip original position defined in frame 1. however, nothing happens.
i have used trace () discover value of seaty:
running trace(seaty) produces _level0.cl_y
please note trace(seaty) not equal value of _level0.cl_y (which wanting achieve)
i tried replacing:
this._y = seaty;
with following:
this._y = level0.cl_y;
and produces desired result (moving movieclip original position)
even though seaty = level0.cl_y
why work:
this._y = level0.cl_y;
and yet doesn't work:
this._y = seaty;
(i need work because need use same function reset position of numerous movieclips, different original positions)
many in expectation
i may missing something, believe seaty declaration should like:
var seaty = this._y //stores orinial _y value
this+"_y" return string reference movie clip. should use above, or if whatever reason doesn't work, think trying this:
var seaty = this["_y"]
i hope helps, let me know...
var seaty = this._y //stores orinial _y value
this+"_y" return string reference movie clip. should use above, or if whatever reason doesn't work, think trying this:
var seaty = this["_y"]
i hope helps, let me know...
More discussions in ActionScript 1 and 2
adobe
Comments
Post a Comment