- import flash.geom.Transform;
- import flash.geom.Matrix;
-
-
- plasrou_mc.onPress = function() {
- this.startDrag(false);
- };
- plasrou_mc.onRelease = function() {
- this.stopDrag();
- };
- var num:Number = new Number();
- var numleft = -5;
- var numright = 5;
- var nume = 1;
- var compta:Number = 0;
- var comptb:Number = 0;
- var comptc:Number = 0;
- var comptd:Number = 0;
-
- var mouseListener:Object = new Object();
- mouseListener.onMouseUp = function():Void {
- if (plasrou_mc.hitTest(_xmouse, _ymouse)) {
-
- var posxrect = plasrou_mc._x;
- var posyrect = plasrou_mc._y;
-
- var keyListener:Object = new Object();
- keyListener.onKeyDown = function() {
- var tourneMatrix:Matrix = new Matrix();
- var translateMatrix:Matrix = new Matrix();
- var neo:Transform = new Transform(plasrou_mc);
- var echelleMatrix:Matrix = new Matrix();
-
- if (Key.isDown(Key.LEFT)) {
- compta = 1;
- if ((compta != comptc) && (compta != comptd)) {
- numleft = numleft-5;
- num = numleft+numright;
- tourneMatrix.rotate(num*Math.PI/180);
- translateMatrix.translate(posxrect,posyrect);
- tourneMatrix.concat(translateMatrix);
- dadaMatrix = tourneMatrix.clone();
- } else {
- numleft = numleft-5;
- num = numleft+numright;
- tourneMatrix.rotate(num*Math.PI/180);
- translateMatrix.translate(posxrect,posyrect);
- tourneMatrix.concat(translateMatrix);
- dadaMatrix = tourneMatrix.clone();
- tourneMatrix.concat(dodoMatrix);
- tourneMatrix.tx = posxrect;
- tourneMatrix.ty = posyrect;
- }
- neo.matrix = tourneMatrix;
-
- } else if (Key.isDown(Key.RIGHT)) {
- comptb = 1;
- if ((comptb != comptc) && (comptb != comptd)) {
- numright = numright+5;
- num = numright+numleft;
- tourneMatrix.rotate(num*Math.PI/180);
- translateMatrix.translate(posxrect,posyrect);
- tourneMatrix.concat(translateMatrix);
- dadaMatrix = tourneMatrix.clone();
- } else {
- numright = numright+5;
- num = numright+numleft;
- tourneMatrix.rotate(num*Math.PI/180);
- translateMatrix.translate(posxrect,posyrect);
- tourneMatrix.concat(translateMatrix);
- dadaMatrix = tourneMatrix.clone();
- tourneMatrix.concat(dodoMatrix);
- tourneMatrix.tx = posxrect;
- tourneMatrix.ty = posyrect;
- }
- neo.matrix = tourneMatrix;
-
- } else if (Key.isDown(Key.UP)) {
- comptc = 1;
- if ((comptc != compta) && (comptc != comptb)) {
- nume = nume+0.1;
- echelleMatrix.scale(nume,nume);
- translateMatrix.translate(posxrect,posyrect);
- echelleMatrix.concat(translateMatrix);
- dodoMatrix = echelleMatrix.clone();
- } else {
- nume = nume+0.1;
- echelleMatrix.scale(nume,nume);
- translateMatrix.translate(posxrect,posyrect);
- echelleMatrix.concat(translateMatrix);
- dodoMatrix = echelleMatrix.clone();
- echelleMatrix.concat(dadaMatrix);
- echelleMatrix.tx = posxrect;
- echelleMatrix.ty = posyrect;
- }
- neo.matrix = echelleMatrix;
-
- } else if (Key.isDown(Key.DOWN)) {
- comptd = 1;
- if ((comptd != compta) && (comptd != comptb)) {
- nume = nume-0.1;
- echelleMatrix.scale(nume,nume);
- translateMatrix.translate(posxrect,posyrect);
- echelleMatrix.concat(translateMatrix);
- dodoMatrix = echelleMatrix.clone();
- } else {
- nume = nume-0.1;
- echelleMatrix.scale(nume,nume);
- translateMatrix.translate(posxrect,posyrect);
- echelleMatrix.concat(translateMatrix);
- dodoMatrix = echelleMatrix.clone();
- echelleMatrix.concat(dadaMatrix);
- echelleMatrix.tx = posxrect;
- echelleMatrix.ty = posyrect;
- }
- neo.matrix = echelleMatrix;
- }
- };
- Key.addListener(keyListener);
- }
- }
- Mouse.addListener(mouseListener);
import flash.geom.Transform;
import flash.geom.Matrix;
plasrou_mc.onPress = function() {
this.startDrag(false);
};
plasrou_mc.onRelease = function() {
this.stopDrag();
};
var num:Number = new Number();
var numleft = -5;
var numright = 5;
var nume = 1;
var compta:Number = 0;
var comptb:Number = 0;
var comptc:Number = 0;
var comptd:Number = 0;
var mouseListener:Object = new Object();
mouseListener.onMouseUp = function():Void {
if (plasrou_mc.hitTest(_xmouse, _ymouse)) {
var posxrect = plasrou_mc._x;
var posyrect = plasrou_mc._y;
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
var tourneMatrix:Matrix = new Matrix();
var translateMatrix:Matrix = new Matrix();
var neo:Transform = new Transform(plasrou_mc);
var echelleMatrix:Matrix = new Matrix();
if (Key.isDown(Key.LEFT)) {
compta = 1;
if ((compta != comptc) && (compta != comptd)) {
numleft = numleft-5;
num = numleft+numright;
tourneMatrix.rotate(num*Math.PI/180);
translateMatrix.translate(posxrect,posyrect);
tourneMatrix.concat(translateMatrix);
dadaMatrix = tourneMatrix.clone();
} else {
numleft = numleft-5;
num = numleft+numright;
tourneMatrix.rotate(num*Math.PI/180);
translateMatrix.translate(posxrect,posyrect);
tourneMatrix.concat(translateMatrix);
dadaMatrix = tourneMatrix.clone();
tourneMatrix.concat(dodoMatrix);
tourneMatrix.tx = posxrect;
tourneMatrix.ty = posyrect;
}
neo.matrix = tourneMatrix;
} else if (Key.isDown(Key.RIGHT)) {
comptb = 1;
if ((comptb != comptc) && (comptb != comptd)) {
numright = numright+5;
num = numright+numleft;
tourneMatrix.rotate(num*Math.PI/180);
translateMatrix.translate(posxrect,posyrect);
tourneMatrix.concat(translateMatrix);
dadaMatrix = tourneMatrix.clone();
} else {
numright = numright+5;
num = numright+numleft;
tourneMatrix.rotate(num*Math.PI/180);
translateMatrix.translate(posxrect,posyrect);
tourneMatrix.concat(translateMatrix);
dadaMatrix = tourneMatrix.clone();
tourneMatrix.concat(dodoMatrix);
tourneMatrix.tx = posxrect;
tourneMatrix.ty = posyrect;
}
neo.matrix = tourneMatrix;
} else if (Key.isDown(Key.UP)) {
comptc = 1;
if ((comptc != compta) && (comptc != comptb)) {
nume = nume+0.1;
echelleMatrix.scale(nume,nume);
translateMatrix.translate(posxrect,posyrect);
echelleMatrix.concat(translateMatrix);
dodoMatrix = echelleMatrix.clone();
} else {
nume = nume+0.1;
echelleMatrix.scale(nume,nume);
translateMatrix.translate(posxrect,posyrect);
echelleMatrix.concat(translateMatrix);
dodoMatrix = echelleMatrix.clone();
echelleMatrix.concat(dadaMatrix);
echelleMatrix.tx = posxrect;
echelleMatrix.ty = posyrect;
}
neo.matrix = echelleMatrix;
} else if (Key.isDown(Key.DOWN)) {
comptd = 1;
if ((comptd != compta) && (comptd != comptb)) {
nume = nume-0.1;
echelleMatrix.scale(nume,nume);
translateMatrix.translate(posxrect,posyrect);
echelleMatrix.concat(translateMatrix);
dodoMatrix = echelleMatrix.clone();
} else {
nume = nume-0.1;
echelleMatrix.scale(nume,nume);
translateMatrix.translate(posxrect,posyrect);
echelleMatrix.concat(translateMatrix);
dodoMatrix = echelleMatrix.clone();
echelleMatrix.concat(dadaMatrix);
echelleMatrix.tx = posxrect;
echelleMatrix.ty = posyrect;
}
neo.matrix = echelleMatrix;
}
};
Key.addListener(keyListener);
}
}
Mouse.addListener(mouseListener);