Sphere
08-25-2003, 03:45 AM
1. start with a new document
2. draw a ball without a stroke
3. make it a symbol and choose button
4. select the ball and hit right mousebutton and choose actions
5. select the ball and give it an instancename in the properties panel
6. past the folowing:
on (keyPress "<Left>") {
currentX = this._x;
this._x = currentX - 2;
_root.instancename._rotation = 270;
}
on (keyPress "<Right>") {
currentX = this._x;
this._x = currentX + 2;
_root.instancename._rotation = 90;
}
on (keyPress "<Up>") {
currentY = this._y;
this._y = currentY - 2;
_root.instancename._rotation = 360;
}
on (keyPress "<Down>") {
currentY = this._y;
this._y = currentY + 2;
_root.instancename._rotation = 180;
}
7. ur finished and export ur movie.
************************************
** EXPLINATION OF THE ACTIONSCRIPT ****
************************************
i take this as example:
on (keyPress "<Left>") {
currentX = this._x;
this._x = currentX - 2;
_root.instancename._rotation = 270;
}
on keypress of the left arrowkey the current x-value is even big as this._x value.
but on press this._x changes into the currentX - 2
this._X is even big as currentX so currentX will change and u will move
_root.instancename.rotation = 270 means that on moving it will turn 270 degrees
2. draw a ball without a stroke
3. make it a symbol and choose button
4. select the ball and hit right mousebutton and choose actions
5. select the ball and give it an instancename in the properties panel
6. past the folowing:
on (keyPress "<Left>") {
currentX = this._x;
this._x = currentX - 2;
_root.instancename._rotation = 270;
}
on (keyPress "<Right>") {
currentX = this._x;
this._x = currentX + 2;
_root.instancename._rotation = 90;
}
on (keyPress "<Up>") {
currentY = this._y;
this._y = currentY - 2;
_root.instancename._rotation = 360;
}
on (keyPress "<Down>") {
currentY = this._y;
this._y = currentY + 2;
_root.instancename._rotation = 180;
}
7. ur finished and export ur movie.
************************************
** EXPLINATION OF THE ACTIONSCRIPT ****
************************************
i take this as example:
on (keyPress "<Left>") {
currentX = this._x;
this._x = currentX - 2;
_root.instancename._rotation = 270;
}
on keypress of the left arrowkey the current x-value is even big as this._x value.
but on press this._x changes into the currentX - 2
this._X is even big as currentX so currentX will change and u will move
_root.instancename.rotation = 270 means that on moving it will turn 270 degrees