I have the following question:
In my application I have a canvas. I would like to change the background image of that canvas through 2 buttons.
- Button 1: The background changes to grass.
- Button 2: The background changes to a wooden floor.
So if you click on the buttons, the background image will change.
I've already tried to change the background color of the canvas. I've did that with the code of Flex Examples:
public function colorize(value:Number):void
var colorTrans:ColorTransform = new ColorTransform();
colorTrans.color = value;
starImage.transform.colorTransform = colorTrans;
But I don't have any idea how to change the background image. Does anybody has an idea?
canvas.setStyle( "backgroundImage", urlToImage );
Let me know if that does the trick...
Yes, that code works great.
Thanks a lot!