topical media & game development
mashup-rmx-05-CustomItemRendererExample-myItemRenderer.mx
mashup-rmx-05-CustomItemRendererExample-myItemRenderer.mx
[swf]
flex
<?xml version="1.0" encoding="utf-8"?>
component
<mx:Canvas
creationComplete="init()"
buttonMode="true"
backgroundImage="{upskin}"
backgroundSize="100%"
xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%">
script(s)
<mx:Script>
<![CDATA[
[Embed("mashup-rmx-05-CustomItemRendererExample-images-overskin.jpg")]
[Bindable]
private var overskin:Class;
[Embed("mashup-rmx-05-CustomItemRendererExample-images-upskin.jpg")]
[Bindable]
private var upskin:Class;
init(s)
private function init():void
{
this.addEventListener(MouseEvent.ROLL_OVER, rollover);
this.addEventListener(MouseEvent.ROLL_OUT, rollout);
}
roll over/out
private function rollover(event:MouseEvent):void
{
this.setStyle("backgroundImage", overskin);
}
private function rollout(event:MouseEvent):void
{
this.setStyle("backgroundImage", upskin);
}
]]>
</mx:Script>
content(s)
<!-- On this component I added selectable and enabled set to false, so that the buttonMode hand cursor shows through.
The disabled color then has to be set to the desired color -->
<mx:Text text="{data}" selectable="false" enabled="false" disabledColor="#000000"/>
</mx:Canvas>
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.