Simple FXG Path Viewer

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
					   xmlns:s="library://ns.adobe.com/flex/spark"
					   xmlns:mx="library://ns.adobe.com/flex/mx">
	<fx:Script>
		<![CDATA[
			import mx.graphics.SolidColor;

			import spark.primitives.Path;

			public var color:uint = 0xFF0000;
			public var path:Path;

			protected function updatePath(changeColor:Boolean=false):void
			{
				if(changeColor)
					color=Math.random()*16777215;

				path = new Path();
				path.percentWidth = path.percentHeight = sizeCheck.selected ? Number.NaN : 100;
				path.data = dataTextArea.text;
				path.fill=new SolidColor(color);

				pathGroup.removeAllElements();
				pathGroup.addElement(path);
			}

		]]>
	</fx:Script>
	<s:VGroup horizontalAlign="right" bottom="10" left="10" top="10" right="10">
		<s:Group id="pathGroup" width="100%" height="100%" click="updatePath(true)" />
		<s:CheckBox label="Actual Size" selected="true" click="updatePath()" id="sizeCheck" />
		<s:TextArea height="100" id="dataTextArea" change="updatePath()" width="100%"/>
	</s:VGroup>
</s:WindowedApplication>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s