Solved

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

Posted on 2009-05-14
1
401 Views
Last Modified: 2012-08-14
The new component will be placed inside of an itemrenderer
0
Comment
Question by:mhendrix
1 Comment
 
LVL 10

Accepted Solution

by:
mplord earned 500 total points
Comment Utility
Hi - hope this helps.


<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:my="*">

	<my:CustomCanvas horizontalCenter="0" verticalCenter="0" width="156" height="122">

	</my:CustomCanvas>

</mx:Application>
 
 

####### CustomCanvas.as
 

<?xml version="1.0" encoding="utf-8"?>

<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" click="onClick(event);" borderStyle="solid" borderThickness="3" borderColor="#000000" backgroundColor="#FFFFFF">

	

	<mx:Script>

		<![CDATA[

			private static var flag:Boolean = false;
 

			private function onClick(event:Event):void

			{

				if (flag)

				{

					this.setStyle("borderColor", "#000000");

					this.setStyle("backgroundColor", "#FFFFFF"); 

				}

				else

				{

					this.setStyle("borderColor", "#FFFFFF");

					this.setStyle("backgroundColor", "#000000"); 

				}

				

				flag = !flag;

			}

		]]>

	</mx:Script>

</mx:Canvas>

Open in new window

0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now