tgelston
April 29th, 2003, 01:18 PM
On the first frame (and currently the only frame) of my main timeline I have the following code
_root.plane.onEnterFrame = function() {
_y += gravity;
if (Key.isDown(Key.LEFT)) {
_x -= 1;
_rotation = -5;
} else {
_rotation = 0;
}
if (Key.isDown(Key.RIGHT)) {
_x += 5;
_rotation = 3;
} else {
_x += 2;
}
};
This works fine until I place more stuff on the stage and everything starts to follow the function. I have tried it with and without the _root. Now if I put a this before each property it works fine. why is that? if this code is being place on the plane?
I am still new to writting my code this way - any help in undesrstanding would be appreciated.
THANKS,
Tobias
_root.plane.onEnterFrame = function() {
_y += gravity;
if (Key.isDown(Key.LEFT)) {
_x -= 1;
_rotation = -5;
} else {
_rotation = 0;
}
if (Key.isDown(Key.RIGHT)) {
_x += 5;
_rotation = 3;
} else {
_x += 2;
}
};
This works fine until I place more stuff on the stage and everything starts to follow the function. I have tried it with and without the _root. Now if I put a this before each property it works fine. why is that? if this code is being place on the plane?
I am still new to writting my code this way - any help in undesrstanding would be appreciated.
THANKS,
Tobias