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"?> <!-- <a href="http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/" target="_blank">http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/</a> -->
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="0x000000"
horizontalScrollPolicy="off" verticalScrollPolicy="off" creationComplete="init()"> <mx:Script> <![CDATA[
import mx.controls.Image;
private var rectangle:Shape;
private var cliqueEtat:Boolean;
private var imgP:Image;
private function init():void{
rectangle = new Shape();
rectangle.graphics.beginFill(0x000000);
rectangle.alpha=0.5;
rectangle.graphics.drawRect(0,0, 230, 230);
}
private function survolIn(evt:Event):void{
var img:Image=evt.target as Image;
img.removeChild(rectangle);
}
private function survolOut(evt:Event):void{
if(!cliqueEtat)
{
var img:Image=evt.target as Image;
img.addChild(rectangle);
}
}
private function clique(evt:Event):void{
//cliqueEtat=true;
var img:Image=evt.target as Image;
img.addChild(rectangle);
}
]]> </mx:Script> <mx:Image source="{data.@src}" init="survolOut(event)" click="clique(event)"
rollOver="survolIn(event)" rollOut="survolOut(event)" horizontalCenter="0" verticalCenter="0"
width="300" height="300"/> </mx:Canvas> |
Partager