Bir arkadaşımdan aldığım bu küçük kod parçam var ama onu AS3.0'a çevirmeyi başaramıyorum. Ne değiştiğim önemli değil, derleyici hataları almaya devam ediyorum.
Bu, orijinal kod parçası ve gerçekten ona bir göz atmayı takdir ediyorum.
laser_nodes = 2;
for (var 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() {
startDrag(this);
};
node.onRelease = function() {
stopDrag();
};
}
_root.createEmptyMovieClip("ray", _root.getNextHighestDepth());
ray.onEnterFrame = function() {
this.clear();
this.lineStyle(3, 0xff0000);
this.moveTo(_root.laser_1._x, _root.laser_1._y);
for (x=2; x<=laser_nodes; x++) {
this.lineTo(_root["laser_"+x]._x, _root["laser_"+x]._y);
}
this.lineTo(_root.laser_1._x, _root.laser_1._y);
};