loki421
02-22-2009, 04:49 PM
Hi guys!
I have a funtion that changes the background colour of a canvas to a shade of blue on rollover and displays a button to allow the user to see more details, here's the code:
private function canvasRollover(event:MouseEvent):void
{
canvas1.setStyle ("backgroundColor", 0x74FEF3);
button1.visible = true;
}
private function canvasRollout(event:MouseEvent):void
{
canvas1.setStyle ("backgroundColor", 0xFFFFFF);
button1.visible = false;
}
This works fine until i put the canvas inside a repeater, then i get a runtim error of "setStyle is not a function"
Any ideas of a workaround for this or a possible reason as to why this is happening? Maybe someone else has had this same problem? Is there a bug in Flex Builder 3?
Just for reference here's the repeater code:
<mx:Repeater id="vehicleRepeater" dataProvider="{myService.getData.lastResult}">
<mx:Canvas width="200" height="200" x="49" y="22" id="canvas1"
backgroundColor="#ffffff" backgroundAlpha="0.35" alpha="1.0"
rollOver="canvasRollover(event)" rollOut="canvasRollout(event)">
<mx:Button id="button1" x="67" y="168" label="Button" visible="false"/>
<mx:Image id="image1" x="10" y="10" source="assets/myImage.jpg" width="180" height="150" />
</mx:Canvas>
</mx:Repeater>
Any suggestions would be gratefully recieved :D
Many thanks in advance all!
I have a funtion that changes the background colour of a canvas to a shade of blue on rollover and displays a button to allow the user to see more details, here's the code:
private function canvasRollover(event:MouseEvent):void
{
canvas1.setStyle ("backgroundColor", 0x74FEF3);
button1.visible = true;
}
private function canvasRollout(event:MouseEvent):void
{
canvas1.setStyle ("backgroundColor", 0xFFFFFF);
button1.visible = false;
}
This works fine until i put the canvas inside a repeater, then i get a runtim error of "setStyle is not a function"
Any ideas of a workaround for this or a possible reason as to why this is happening? Maybe someone else has had this same problem? Is there a bug in Flex Builder 3?
Just for reference here's the repeater code:
<mx:Repeater id="vehicleRepeater" dataProvider="{myService.getData.lastResult}">
<mx:Canvas width="200" height="200" x="49" y="22" id="canvas1"
backgroundColor="#ffffff" backgroundAlpha="0.35" alpha="1.0"
rollOver="canvasRollover(event)" rollOut="canvasRollout(event)">
<mx:Button id="button1" x="67" y="168" label="Button" visible="false"/>
<mx:Image id="image1" x="10" y="10" source="assets/myImage.jpg" width="180" height="150" />
</mx:Canvas>
</mx:Repeater>
Any suggestions would be gratefully recieved :D
Many thanks in advance all!