How can I extend the Canvas component to change the border type and background colors when clicked

The new component will be placed inside of an itemrenderer
Who is Participating?
mplordConnect With a Mentor Commented:
Hi - hope this helps.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="" layout="absolute" xmlns:my="*">
	<my:CustomCanvas horizontalCenter="0" verticalCenter="0" width="156" height="122">
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="" click="onClick(event);" borderStyle="solid" borderThickness="3" borderColor="#000000" backgroundColor="#FFFFFF">
			private static var flag:Boolean = false;
			private function onClick(event:Event):void
				if (flag)
					this.setStyle("borderColor", "#000000");
					this.setStyle("backgroundColor", "#FFFFFF"); 
					this.setStyle("borderColor", "#FFFFFF");
					this.setStyle("backgroundColor", "#000000"); 
				flag = !flag;

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.