Hello,
Je fait une application flex qui genere une image "design" : http://kedare.free.fr/Dist/sdz_codar...exDrawing.html
Seulement, je voudrais faire bouger les "bulles" aleatoirement, j'ai donc éssayé de faire comme ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package
{
	import flash.events.Event;
 
	import mx.core.UIComponent;
	import mx.effects.Move;
 
	public class Bubble extends UIComponent
	{
		public function Bubble()
		{
			super();
			graphics.lineStyle(
				Math.random()*5, // Thickness
				ColorTools.rgbToHex(Math.random()*255,Math.random()*255,Math.random()*255) // Color
			);
			graphics.beginFill(
				ColorTools.rgbToHex(Math.random()*255,Math.random()*2550,Math.random()*255), // Color
				Math.random() // Alpha
			);
			graphics.drawCircle(
				Math.random()*1000, // X
				Math.random()*1000, // Y
				Math.random()*30 // Radius
			);
 
			graphics.endFill();
 
			this.addEventListener(Event.ADDED, animate);
 
		}
 
		private function animate(event:Event):void {
			while(true) {
				var move:Move = new Move(this);
				move.xTo = Math.random()*1000;
				move.yTo = Math.random()*1000;
				move.play();
 
			}
		}
 
	}
}
Mais ca ne fonctionne pas, je me retrouve avec une application qui fait planter le navigateur, j'aimerais aussi utiliser du 'easing' sur les effets de déplacements pour avoir quelque chose de plus joli, le tout sans toucher au code en dehors de cette classe si possible (mais si non c'est pas grave), voila, je débute en Flex/AS et je n'ai pour le moment jamais touché a l'animation... J'espère que vous pourrez m'aider, voila le reste du code source :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
package
{
	public class ColorTools
	{
		public static function rgbToHex(r:Number, g:Number, b:Number):Number {
 	  		var hex:Number = r << 16 ^ g << 8 ^ b;
  			return hex;
		}
 
	}
}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="srcview/index.html">
	<mx:Script>
		<![CDATA[
 
		// Author: Kedare (POUSSIN Mathieu)
 
		import mx.core.UIComponent;
 
		private function drawNow(event:Event):void {
			drawingCanvas.removeAllChildren();
			var amount:Number = 0;
			var max:Number = Number(amountInput.text);
			for(amount; amount < max; amount++){
				var drawing:Bubble = new Bubble();
				drawingCanvas.addChild(drawing);
			}
		}
		]]>
	</mx:Script>
	<mx:Style>
		Application {
			background-gradient-colors: #000000, #111133;	
		}
	</mx:Style>
 
	<mx:BlurFilter id="blurFilter" blurX="{Number(blurInput.text)}" blurY="{Number(blurInput.text)}" quality="{BitmapFilterQuality.HIGH}" />
 
	<mx:VBox height="100%" width="100%">
		<mx:HBox>
			<mx:Text text="Amount of circles:"/><mx:TextInput id="amountInput" text="1000"/>
			<mx:Text text="    Blur strength:" /><mx:TextInput id="blurInput" text="30" change="drawingCanvas.filters = [blurFilter];"/>
			<mx:Text text="Click on background to generate new image" />
		</mx:HBox>
		<mx:Canvas id="drawingCanvas" height="100%" width="90%" click="drawNow(event)" filters="{[blurFilter]}" />
	</mx:VBox>
</mx:Application>
Merci