Flash-if文
|
|
|
Gadgets powered by Google |
function文
onClipEvent (load) {
var speed = 10;
var leftEdge = -20;
var rightEdge = 520;
}
onClipEvent (enterFrame) {
this._x += speed;
if (this._x >= rightEdge){
this._x = leftEdge;
}
}
var speed:Number;
var rightEdge:Number;
var leftEdge:Number;
this.onLoad = function() {
speed = 10;
leftEdge = -20;
rightEdge = 520;
}
ball_mc.onEnterFrame = function() {
ball_mc._x += speed;
if(ball_mc._x >= rightEdge) {
ball_mc._x = leftEdge;
}
}
|
|
|
Gadgets powered by Google |
onClipEvent (load) {
var speedx : Number = 8;
var speedy : Number = 10;
var rightEdge : Number = 450;
var leftEdge : Number = 50;
var topEdge : Number = 50;
var bottomEdge : Number = 350;
}
onClipEvent (enterFrame) {
if(_x > rightEdge) {
speedx *= -1;
}
if(_x < leftEdge) {
speedx *= -1;
}
if(_y > topEdge) {
speedy *= -1;
}
if(_y < bottomEdge) {
speedy *= -1;
}
_x += speedx;
_y += speedy;
}
onClipEvent (load) {
var speedX : Number = 9;
var speedY : Number = 10;
var rightEdge : Number = 500;
var leftEdge : Number = 0;
var topEdge : Number = 0;
var bottomEdge : Number = 400;
}
onClipEvent (enterFrame) {
if(_x > rightEdge - _width/2 || _x < leftEdge + _width/2) {
speedX *= -1;
}
_x += speedX;
if(_y < topEdge + _height/2 || _y > bottomEdge - _height/2) {
speedY *= -1;
}
_y += speedY;
}
var speedX : Number = 9;
var speedY : Number = 10;
var rightEdge : Number = 500;
var leftEdge : Number = 0;
var topEdge : Number = 0;
var bottomEdge : Number = 400;
this.onEnterFrame = function() {
if(beer_mc._x > rightEdge - beer_mc._width/2 || beer_mc._x < leftEdge + beer_mc._width/2) {
speedX *= -1;
}
beer_mc._x += speedX;
if(beer_mc._y < topEdge + beer_mc._height/2 || beer_mc._y > bottomEdge - beer_mc._height/2) {
speedY *= -1;
}
beer_mc._y += speedY;
}