-
Board Idiot
[F8] Why is it that when I trace(this._x);...
I don't have a bad sex life and I have the pictures to prove it.
-
In other words, you question is:
Why is it that when I trace(this._x), i get Not A Number?
There could be a lot of reasons depending on your other codes and set up.
gparis
-
Board Idiot
If a clip is on the stage, shouldn't it always have an _x and _y?
I don't have a bad sex life and I have the pictures to prove it.
-
and that code is, i guess, on a frame inside that clip? then you should get a number.
gparis
-
Board Idiot
The trace resides within a function that is in a frame within the movie clip. I call the function using setInterval() like you suggested I do in another thread. The function is being called at the appropriate time, but anything that relies on the specific clip's properties (_x, _y, _xscale, etc.) come up as NaN.
Is it the way I am referencing the clip?
I don't have a bad sex life and I have the pictures to prove it.
-
Board Idiot
On the first and only frame of the main timeline I have:
On the first and only frame of the movieclip, I have:
Code:
function Reproduction(){
max = 10;
min = 1;
maxa = 360;
mina = 0;
hypot = Math.floor(Math.random()*(max-min+1)+min);
angul = Math.floor(Math.random()*(maxa-mina+1)+mina);
oppo = Math.sin(angul*Math.PI/180)*hypot
adja = Math.cos(angul*Math.PI/180)*hypot
if (angul <= 90){
_root.attachMovie("base_1","treetree" + _global.i + 1, _global.i + 1,{_x:adja + this._x, _y:oppo + this._y});
} else if ((angul >90) && (angul<=180)){
_root.attachMovie("base_1","treetree" + _global.i + 1, _global.i + 1,{_x:adja + this._x, _y:oppo - this._y});
} else if ((angul >180) && (angul<=270)){
_root.attachMovie("base_1","treetree" + _global.i + 1, _global.i + 1,{_x:adja - this._x, _y:oppo - this._y});
} else if ((angul >270) && (angul<=360)){
_root.attachMovie("base_1","treetree" + _global.i + 1, _global.i + 1,{_x:adja - this._x, _y:oppo + this._y});
}
_global.i = _global.i + 1;
trace("hypot is " + hypot);
trace(this._y);
}
function Death(){
maxa = 2;
mina = 0;
Yup = Math.random() * (maxa - mina + 1) + mina;
if (Yup > 1){
this.removeMovieClip();
trace("a death occurred");
}
}
function Growth(){
maxc = 1;
minc = 0;
scaleit = Math.random()*(maxc - minc + 1) + minc;
this._xscale = this._xscale + scaleit
this._yscale = this._yscale + scaleit
trace("The xscale is " + this._xscale);
}
setInterval(Reproduction, 10000);
setInterval(Growth, 10000);
setInterval(Death, 10000);
I added the traces to see if the functions were being called and they are. Any reference to "this" is undefined.
Does anybody have any ideas why this is happening?
I don't have a bad sex life and I have the pictures to prove it.
-
you need to make a reference to the mc.
function Reproduction(mc){
this=mc;
//rest of you function blah blah
}
setInterval(Reproduction, 10000,this);
and the same for the other functions you have
or something like that.....
-
Board Idiot
I don't have a bad sex life and I have the pictures to prove it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|