Bonjour,
J'ai un p@#n de pb avec un itemRenderer et une liste d'images.

Bon la liste d'images, no soucy, je lui applique un itemRenderer, tel que celui qui est dessous.

la rotation est aléatoire et est comprise dans l'objet data.

Ce qui est fort c'est que le background se change bien, mais la rotation se fait toujours par rapport au 0,0, malgré la translation et tout et tout.

Quelqu'un aurait une idée ?

Mille mercis.


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
 
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="68" verticalScrollPolicy="off" horizontalScrollPolicy="off"
	horizontalCenter="0" horizontalAlign="center"
	verticalCenter="0" verticalAlign="middle"
	>
	<mx:Script> 
		<![CDATA[
 
			override public function set data(value:Object):void {
				super.data = value;
 
				if ( data != null && data.hasOwnProperty("rotation") ){
					if ( data.rotation > 0){
						setStyle("backgroundColor",0xff99ff);
					}else {
						setStyle("backgroundColor",0xFFFFFF);
					}
					img.source = data.thumburl;
 
					var m:Matrix = img.transform.matrix;
					var ox:int= img.width / 2;
					var oy:int = img.height /2;
					m.translate( -ox, -oy);
					m.rotate( data.rotation * (Math.PI /180) );
					m.translate( ox, oy);
					img.transform.matrix = m;
 
				}
			}
		]]>
	</mx:Script>
 
	<components:Image id="img" width="40%" height="40%"/>
</mx:HBox>