Archive

Posts Tagged ‘flex’

Learning Flex

July 13th, 2011 No comments

Hi. I’ve been for a while trying to learn Flex. I think is a wonderfull platform.

There are alot of tutorials/videos/books out there that i’ve been reading, but some of them are old and the code referes to previous versions. A way to make me learn and to test myself with Actionscript/MXML, i’ve been choosing tutorials that use previous versions of Flex and try to convert to Flex 4.5.

I’ve started with this tutorial from Switch on the Code : http://www.switchonthecode.com/tutorials/basic-flex-list-row-item-styling

I’ll be posting here all the code that i’ve converted.

Code for the main Application file:

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

		@namespace s "library://ns.adobe.com/flex/spark";
		@namespace mx "library://ns.adobe.com/flex/mx";

		s|List
		{
			font-size: 22;
		}

		<![CDATA[ 			import mx.collections.ArrayCollection; 			 			[Bindable] 			private var movies:ArrayCollection; 			 			private function init():void 			{ 				movies = new ArrayCollection(); 				movies.addItem({name:"Pan's Labyrinth", style:"BlackMovie"}); 				movies.addItem({name:"Stargate", style:"BlackMovie"}); 				movies.addItem({name:"Ghostbusters", style:"RedMovie"}); 				movies.addItem({name:"Fargo", style:"GreenMovie"}); 				movies.addItem({name:"Predator", style:"BlackMovie"}); 			} 		]]>

The code for the file StyleClassRenderer.mxml:

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

		@namespace s "library://ns.adobe.com/flex/spark";
		@namespace mx "library://ns.adobe.com/flex/mx";

		.BackMovie
		{
			color: #000000;
		}

		.RedMovie
		{
			color: #8e2800;
		}

		.GreenMovie
		{
			color: #5caa2f;
		}

NOTE: All the credits go to the original creators of each tutorial. I’m just trying to make updates.

Categories: Flex Tags: