用Flash AS简单制作可以任意拖动的四边形
用Flash Actionscript简单制作可以任意拖动的四边形,是制作游戏的一个基础程序。f%^t{+WqY(F#f打开Flash,首先将属性改为30fps然后新建立一个组建laser,设置效果如下。$H}8y,n/zF.PbTC
[align=center][img]http://www.webjx.com/upfiles/20070712/20070712221221_01.gif[/img][/align]然后回到主场景,在第一帧内输入Action。o]_Ga
laser_nodes = 4;
for (x=1; x<=laser_nodes; x++) {
node = _root.attachMovie("laser", "laser_"+x, x, {_x:Math.random()*460+20, _y:Math.random()*310+20});
node.onPress = function() {$w1a9^7]]N
startDrag(this);
};!w%dxf$w-B%^x8Zs
node.onRelease = function() {
stopDrag();
};6d ?v0R8?P"Y)d&}s2t
}I brb-h(QFE
_root.createEmptyMovieClip("ray", _root.getNextHighestDepth());
ray.onEnterFrame = function() {
this.clear();*gs rj4I
this.lineStyle(3, 0xff0000);l E l(y0F,yB
this.moveTo(_root.laser_1._x, _root.laser_1._y);0hT4~9TS:|e
for (x=2; x<=laser_nodes; x++) {
this.lineTo(_root["laser_"+x]._x, _root["laser_"+x]._y);
