BTA Flexing

My passion RIAs…………..Shardul Singh Bartwal

Archive for December, 2010

Using old Flex 3 Component’s Properties in Flex 4

Posted by Shardul Singh Bartwal on December 26, 2010

Some time we wants to create the flex 4 application which requires the
same set of properties etc which were there in flex 3 based component e.g.
backgroundAlpha with TextInput .In other words we can say that one wants
to update flex 3 application to flex 4 without using the spark or new flex 4
based components.The things are clear that in that case you are simply looking
for the all mxml library of the flex 3.Because the mxml based components of flex 4
are lacking many old properties of flex 3.If you are looking for those all properties
of flex 3 then to achieve it is very simple.Simply go to the properties of your project.
Then go to the ‘Flex Build Path’,there you will see tab with heading ‘Library Path’,select
the Radio button ‘Mx only’ and click OK.You have done it,you will get all the properties
of all flex 3 based components in flex 4,e.g. ‘backgroundAlpha’ of ””.
Hope you will like this………

Enjoy Flexing……..

Advertisements

Posted in ActionScript 3.0, Flex 4 | Tagged: , , , , , , , , , , , , , , , , , , , , | 2 Comments »

Datagrid with multiLine variable height text Item Renderer in Flex

Posted by Shardul Singh Bartwal on December 15, 2010

I was trying to get the multiline text inside the item renderer of a column and I tried a lot for this with multiple controls like TextInput, Textarea, Label etc by using the item render but was not getting the proper output.The thing which I was getting was that every item rendererer was taking the same height which was for the maximum height item renderer,and was not based on the content inside it.
The reason was only that earlier I was putting my these controls inside a Container and
there was sizing related issue for the container as I was not able to make different item renderes of different heights depending upon the text of the field inside it. But later I created my item render directly from the Text component and got the perfect result.

Main Application

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="0xFFFFFF" 
	layout="vertical">
	<mx:Script>
		 <![CDATA[
       	import mx.controls.Alert;
           import mx.collections.ArrayCollection;
           
           [Bindable]
           public var arrayCollection:ArrayCollection = new ArrayCollection([
               {indexNo : '1',description:'Shardul just trying for multiline text item Renderer'},
               {indexNo : '2',description:'This text should appear on more then one line of text and it will definetly appear lets try.'},
               {indexNo : '3',description:'Cool its working fine without any prolbem hope you all will like this.'},
           ]);
           
       ]]>
	</mx:Script>   

   
 	 <mx:DataGrid width="300" height="200"
                variableRowHeight="true"
                dataProvider="{arrayCollection}">
        <mx:columns>
        	<mx:DataGridColumn headerText="IndexNo" dataField="indexNo"/>
            <mx:DataGridColumn headerText="Label Check" dataField="description" itemRenderer="VariableHeightItemRenderer"/>
        </mx:columns>
    </mx:DataGrid>
    
</mx:Application>

VariableHeightItemRenderer

<?xml version="1.0" encoding="utf-8"?>
<mx:Text xmlns:mx="http://www.adobe.com/2006/mxml"  text="{data.description}"
	 buttonMode="true" useHandCursor="true" mouseChildren="false" >
	<mx:Script>
		<![CDATA[
			override public function set data(value:Object):void
			{
				if(value != null)
				super.data = value;
			}
		]]>
	</mx:Script>
</mx:Text>

Hope you will enjoy this.
Keep rocking………..Happy flexing….

Posted in ActionScript 3.0, Flash Builder 4.6, Flex, Flex 4 | Tagged: , , , , , , , , , , , , , , , , , , , , | 2 Comments »