Hallo zusammen,
habe (natürlich) schon einiges probiert, kam aber auf keinen grünen Zweig.
Deshalb meine Frage:
Ich möchte
dynamisch Kreise erstellen, die verschiebbar sind.
Verschiebbar ist kein problem, aber dynamisch
Hiermit
PHP-Code:
import Formen;
var kreis:Array = new Array(10);
for(var i=0; i<10; i++){
kreis[i] = "kreis_mc" + i;
}
var k_initobj:Object = {breite:25, farbe:0xFF0000, alpha:100};
attachMovie(Formen.symbol_name, kreis[0], 0, k_initobj,);
this.kreis_mc0.setzeKreis();
this.kreis_mc0._x = 50;
this.kreis_mc0._y = 20;
this.kreis_mc0.onMouseMove = function(){
this.drag(false);
};
attachMovie(Formen.symbol_name, kreis[1], 1, k_initobj);
this.kreis_mc1.setzeKreis();
this.kreis_mc1._x = 50;
this.kreis_mc1._y = 50 ;
this.kreis_mc1.onMouseMove = function(){
this.drag(false);
};
attachMovie(Formen.symbol_name, kreis[2], 2, k_initobj);
this.kreis_mc2.setzeKreis();
this.kreis_mc2._x = 50;
this.kreis_mc2._y = 80;
this.kreis_mc2.onMouseMove = function(){
this.drag(false);
};
funktioniert's ja schon ganz gut, aber eben nicht so dynamisch.
Die die Formen.as-Datei sieht wie folgt aus:
PHP-Code:
class Formen extends MovieClip{
static var symbol_name:String = "__Packages.Formen";
static var symbol_klasse:Function = Formen;
static var symbol_id = Object.registerClass(symbol_name, symbol_klasse);
public var breite:Number = 10;
public var hoehe:Number = 10;
public var farbe:Number = 0x000000;
public var alpha:Number = 100;
public var tiefe:Number = 0;
public function Formen(){
tiefe += getDepth();
}
public function setzeKreis():Void{
lineStyle(breite, farbe, alpha);
lineTo(0, 0.15);
}
public function drag(zustand:Boolean){
useHandCursor = zustand;
onPress = function(){
this.startDrag();
_alpha = 50;
this.swapDepths(tiefe++);
};
onRelease = onReleaseOutside = function(){
this.stopDrag();
_alpha = 100;
};
updateAfterEvent();
}
}
So
PHP-Code:
import Formen;
var kreis:Array = new Array(10);
for(var i=0; i<10; i++){
kreis[i] = "kreis_mc" + i;
var k_initobj:Object = {breite:25, farbe:0xFF0000, alpha:100};
attachMovie(Formen.symbol_name, kreis[i], 0, k_initobj);
this.?????.setzeKreis();
this.?????._x = 50;
this.?????._y = 20 + 30*i;
this.?????.onMouseMove = function(){
this.drag(false);
};
}
hätte ich's gerne, aber was muss ich denn anstatt
????? eingeben, damit es nicht so undynamisch bleibt? Oder geht's so gar nicht?
Hat jemand 'ne Ahnung?