BTA Flexing

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

Archive for the ‘Flex’ Category

Using Image Inside the Sprite in Flex

Posted by shardulbartwal on September 18, 2009

Using Image Inside the Sprite in Flex

If we want to add any Image inside the Sprite class in flex,then It is not possible to add image inside the sprite. But if your requirement is as such in that case you can achieve this by adding the Loader inside the sprite. Below is the code for the same.

MainApplication.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="createSpriteWithBitmap()">
	<mx:Script>
	<![CDATA[
	import mx.controls.Image;
	private function createSpriteWithBitmap():void
	{
	var sp : SpriteWithBitmap = new SpriteWithBitmap();
	can.rawChildren.addChild( sp );
	}
	]]>
	</mx:Script>
	<mx:Canvas id="can" x="200" y="200"/>
</mx:Application>

SpriteWithBitmap

package
{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.*;
import flash.net.URLRequest;

import mx.controls.Alert;

public class SpriteWithBitmap extends Sprite
{
	//Pass the source path or url here.
	private var url:String = "http://shardulbartwal.files.wordpress.com/2009/09/ssbrose.jpg";

	public function SpriteWithBitmap()
	{
		loadImg();
	}
	private function loadImg():void
	{
		var loader:Loader = new Loader();
		loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadFailure);
		var request:URLRequest = new URLRequest(url);
		loader.load(request);
		this.addChild(loader);
	}

	private function loadFailure(event:IOErrorEvent):void
	{
		Alert.show("Can't load :" + url);
	}
}

}

Enjoy Flexing………….

Posted in ActionScript 3.0, Flex, Flex 3.0 | Tagged: , , , | Leave a Comment »

Passing variable from outside into a popup window

Posted by shardulbartwal on April 16, 2009

If we are require to pass any variable from outside into a popup window in flex,the way
is slightly different then creating Popup in a classic way.Actully its not the different
instead there is a type casting into the same class which we are going to display in popup.
Let suppose you want to pass a string value into the popup then inside the popup you need
to create a public varible, like I am creating ‘urlValue’ string type variable inside the popup.

Now pass the value inside the popup as below:-

var myPopUp:MyPopup= MyPopup(PopUpManager.createPopUp(this, MyPopup, true));

myPopUp.move(((Application.application.width/2)-(myPopUp.width/2)),((Application.application.h

eight/2)-(myPopUp.height/2)));

myPopUp.urlValue = “value from outside”;

Here the MyPopUp is the class which we are going to show in popup.

Hope it will be helpfull for you.

Posted in ActionScript 3.0, Flex | Leave a Comment »

Unable to resolve a class for ResourceBundle: string

Posted by shardulbartwal on April 15, 2008

Unable to resolve a class for ResourceBundle: string

========================================================

  Few  days  back when I was using the PhotoViewer  from  the adobe’s  sample  example  then

With the download code I got the problem with message ‘Unable to resolve a class for Resource Bundle: string’. This is one of the common problems related to the setting of your applications ‘compiler setting’. If you want to resolve this then just right click right mouse click on your project and then click on the ‘Properties’. It will open a new window with title ‘Properties for …your project name….’.Here Just click on the ‘Flex Compiler’. It will take you to the ‘Flex compiler’. Here under ‘Additional compiler arguments’ you have to write:-

-use-network=false -library-path+=locale/{locale}

-source-path+=locale/{locale} -locale=en_US’.

 Now compile your application. The issue will be resolved.

 

 

Hope it will help you if required……………………

 

Posted in Flex | Leave a Comment »

Testing Flex Application

Posted by shardulbartwal on January 31, 2008

As all of you know that the Flex Technology is totally based on the
flash player  which  is  stateful. So usually it will have the different
approach  for  testing  the  application  in a  automated environment.
Definitely the tools  will  be the different for Functional Testing and
Load  Testing.I have collected  some important links related  to the
different types of Testings.Almost of them are explaining prerequisites,
how  to  get the  Tools ,setting up Testing Envirnment, Writting and
Running Test etc.You can find  out  many  tutorials  related  to the
Testing Flex Application directly from the Adobe’s site.

Functional testing Adobe Flex applicationsFlex Stress Testing Framework

Flex Load Testing Tool

Automated Testing of Flex applications

QuickTest Professional support for Flex applications

Automation-ready sample application

About automating applications with Flex

 Enjoy Flexing………………………………

Posted in Flex | Leave a Comment »

Flex and Php Integration using Amfphp

Posted by shardulbartwal on January 6, 2008

Flex and Php Integration using Amfphp
————————————-

You have many ways for the Flex and Php Integration.But the one which I would suggest is through the amfphp.Its quite simple and I think very very fast over any other.
You can see its performance by simply using it.Really I have never seen such a fast communication between remote and client side.

Ok…….now if you want to use it then please proceed with the steps given below.

1)Download the amfphp-1.9.beta from the
http://www.amf-php.org/  and http://sourceforge.net/project/downloading.php

2)After downloading it u will see ‘amfphp’ folder inside this.Please copy this one ‘amfphp’ folder at your Server.
This amfphp is already containg three folder namely:-
a)browser    b)core  c)services  
and except these three folder there are some other php files which are already.

3)Now create one folder in ‘amfphp’ like I am creating with name ‘flex’,this is the folder in which I will keep my flex Application’s output after Building the flex Aplication.

4)Again copy the ’services-Config’ xml file from ‘browser’ folder inside ‘amfphp’,and paste it in to ur Flex application,and set the path of the server at the uri in ‘endPoint’

tag.

5)Now call the Php Class’s method in the Flex’s main application through the Remote Object.and You will get the
desired output from Php in Flex.

6)Build the Flex Application and runit.

Congrats………you have done it……
NOTE >> One important thing is that you can use the ’servicebrowser’ inside ‘amfphp\browser’any time to track the output of php classes and methods of them.

Enjoy Flexing…………………………………

Posted in Flex | Leave a Comment »

Using Inbuilt Validators Of Flex in Classic Style

Posted by shardulbartwal on December 22, 2007

 Using Inbuilt Validators Of Flex in Classic Style

 classicvalidations.jpeg

In the flex you can find out many inbuilt Validators.But one of the important thing about using them is that if there is any error messaage on the submition of any button than how to fatch the error message related to the validator.Normally it just makes the border of our Input field red and nothing else.If you want to know what the error message than you have to go to that control and only on the mouse over of that you can see.But the most often need is to get the error message related to all input fields in just one Button’s click.Acheving it is very easy.For acheving this just copy and paste the code below.

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” creationComplete=”init()”
 top=”15″ bottom=”15″ left=”15″ right=”15″ horizontalAlign=”center” verticalAlign=”middle” backgroundColor=”#ffffff” cornerRadius=”5″>
<mx:Style>
 Alert {
            color : #0f3177;
   title-style-name :”.alertTitle”;
   header-height:15;
   border-thickness: 1;
   drop-shadow-enabled: true;
   background-color: #ffffff;
   modalTransparency: 0.5;
   corner-radius :6;
   border-style :solid;
   header-colors : #90a4d1, #5970a0;
   footer-colors : #9db6d9, #ffffff;
   border-color : #5970a0;
   drop-shadow-color :#d1ddf7;
            modalTransparencyBlur:4;
            modalTransparencyColor: #DDDDDD;
            modalTransparencyDuration: 1000;
        }
</mx:Style>
<mx:Script>
  <![CDATA[
   import mx.controls.Alert;
   import mx.collections.ArrayCollection;
   import mx.managers.CursorManager;
   import mx.validators.*;
   import mx.rpc.events.ResultEvent;
   import mx.events.ValidationResultEvent;
    
   [Bindable]
         private var validatorArr:Array;
       
         private var shipping:Boolean=false;
        
         private function init():void
        {
         validatorArr = new Array;
         validatorArr.push(nameTxtInputVld);
         validatorArr.push(birthDateFieldVld);
         validatorArr.push(emailTxtInputVld);
        } 
       
         private function funValidateForm(event:MouseEvent):void
        {
              var validatorErrorArr:Array = Validator.validateAll(validatorArr);
              var isValidForm:Boolean = validatorErrorArr.length==0;
              if(isValidForm)
              {
              Alert.show(“Validation Successful”,”Validation Summary !”);
     nameTxtInput.text=”";
              birthDateField.text=”";
              emailTxtInput.text= “”;
       }
        else
        {
          var err:ValidationResultEvent;
         var errorMessageArray:Array=[];
         for each (err in validatorErrorArr)
         {
           var errField:String = FormItem
           (err.currentTarget.source.parent.parent).label
           errorMessageArray.push(err.message);
         }
         Alert.show(errorMessageArray.join(“\n”),”Validation Summary !”);
             }
          }  
   ]]>
</mx:Script>
 <mx:StringValidator id=”nameTxtInputVld” source=”{nameTxtInput}” minLength=”3″ maxLength=”20″ property=”text” required=”true” requiredFieldError=”Please Enter Name.” tooShortError=”There should be minimum 3 characters in first name.”/>
 <mx:StringValidator id=”birthDateFieldVld” source=”{birthDateField}”  property=”text” required=”true” requiredFieldError=”Please Enter Birth Date.”/>
 <mx:EmailValidator  id=”emailTxtInputVld” source=”{emailTxtInput}” property=”text” required=”true” requiredFieldError=”Please Enter Email Address.” tooManyAtSignsError=”More than one @ symbol is not allowed.”/>

 <mx:HBox width=”100%” height=”100%” horizontalAlign=”center” verticalAlign=”middle” paddingBottom=”10″ paddingTop=”10″ paddingLeft=”10″ paddingRight=”10″ cornerRadius=”5″>

   <mx:VBox id=”mainVBox”  width=”300″ height=”180″ verticalGap=”10″ horizontalAlign=”center” verticalAlign=”middle” backgroundColor=”#8000ff” borderColor=”#ff0000″ horizontalScrollPolicy=”off” verticalScrollPolicy=”off” cornerRadius=”5″ borderStyle=”solid”>
    <mx:Label text=”*** Applying Flex Validation In Classic Style ***” textAlign=”center” fontThickness=”6″ fontWeight=”bold” color=”#ff0000″/>         
          <mx:Form width=”100%” height=”100%” cornerRadius=”5″ defaultButton=”{submitBtn}”>
 
         <mx:HBox width=”100%” height=”5%” horizontalGap=”0″ horizontalAlign=”Center”>
          <mx:Text text=”Fields marked with (“/>
          <mx:Text text=”*” color=”red”/>
          <mx:Text text=”) are compulsory.”/>
         </mx:HBox>
      
           <mx:FormItem label=”Name:”>
              <mx:HBox width=”100%” horizontalAlign=”center” verticalAlign=”middle” horizontalGap=”1″>
              <mx:TextInput id=”nameTxtInput” restrict=”a-zA-Z” borderStyle=”solid” cornerRadius=”7″/>
                 <mx:Label text=”*” color=”red”/>
                 </mx:HBox>
         </mx:FormItem>
        
        <mx:FormItem label=”Birth Date:”>
            <mx:HBox width=”100%” horizontalAlign=”center” verticalAlign=”middle” horizontalGap=”1″>
                  <mx:DateField id=”birthDateField” yearNavigationEnabled=”true”/>
                   <mx:Label text=”*” color=”red”/>
                </mx:HBox>
           </mx:FormItem>
        
         <mx:FormItem label=”Email Id:”>
       <mx:HBox width=”100%” verticalAlign=”middle” horizontalGap=”1″>
        <mx:TextInput id=”emailTxtInput” restrict=”a-z0-9.@_” borderStyle=”solid” cornerRadius=”7″/>
          <mx:Label text=”*” color=”red”/>
        </mx:HBox>
        </mx:FormItem>
        
       <mx:HBox id=”buttonHBox” width=”100%”  height=”5%” horizontalAlign=”center” verticalAlign=”middle”>
                   <mx:Button id=”submitBtn” label=”Submit” buttonMode=”true” useHandCursor=”true”  click=”funValidateForm(event)”/> 
             </mx:HBox>
           
      </mx:Form>
   
         </mx:VBox>   
 
 </mx:HBox>            
 
</mx:Application>

Enjoy Flexing…………………..

Shardul Singh Bartwal 

Posted in Flex | Leave a Comment »

What Is RIAs Exactly?

Posted by shardulbartwal on December 16, 2007

What Is RIAs Exactly?

RIAs refers to ‘Rich Internet Applications’ in the Software market.I don’t think that any one can define this word exactly,but the major concerns which are important in this respect are following:-
1).These are the web Application which provides you general look and functionality like a desktop application over the browser.So there is no concept of installations etc.
2).With the RIAs it is a common Practice to transfer bulky data from the Application Server to the web client.But the important thing is that the state of the Application is preserved up to backing the Data to the Application Server.
3).Sendbox can be think as framework for running RIAs.Sendbox is set of Rules and Regulation to run securely any application. If one is going outside the Sendbox Security Mechanism then not possible to run it.
4). For handling such a responsible task at client end there is always a concept of Client Engine.

Why RIAs.?

As After coming through the different Architecture in the Software development currently with web browser. we are simply following the thin client.But with this Architecture, the RIA is one who provides the balance between the thin client and Fat Server(our Application Server).
Because this is the only RIA which transfer enough data to client,and defnetly  it improves the performance.
For the round trips like the HTML pages based application here is no place. Surely require the Server trips,but not every time.The Richness of the Presentation in RIA is unbeatable.

Tools to Develop RIAs:

  Already there were many Tools to develop it, but by the end of year 2007 there are too many options.All the big name are now here.Microsoft has already launched ‘Silver Light’.Adobe’s Flex is already having a good market.Open Laszlo was already performing well in the field.Ajax is also having the same approach and further more let see when will the Sun Micro-System going to launch it’s ‘JavaFx’ which is already announced by Sun.

Just enjoy RIAs……..

Shardul Singh Bartwal

Posted in Flex | Leave a Comment »

Custom ImagePresenter Component

Posted by shardulbartwal on December 7, 2007

Custom ImagePresenter Component

This is the concept for the creating an Image Presentation component.As you have seen many Image Gallery playing different Images.This is for the same.You can use this small component for the same purpose and can give many features to this.Below is main logic for this and you can extend it up to any level.You can add any number of the images to the Array-Collection and it will show the images continuously.

Just copy and paste the code below,and put images in the folder structure as the path is used in the code below.

———————————————————————————————————————————

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml
 layout=”absolute” creationComplete=”init()”>
<mx:Script>
 <![CDATA[
  import mx.collections.ArrayCollection;
 
  [Bindable]
  private var selectedImageIndex:Number=0;
 
  [Embed(source="/assets/productImg/h1.jpg")]
  [Bindable]
  private var img1:Class;
 
  [Embed(source="/assets/productImg/h2.jpg")]
  [Bindable]
  private var img2:Class;
 
  [Embed(source="/assets/productImg/h3.jpg")]
  [Bindable]
  private var img3:Class;
   
    [Bindable]
  public var myDataArrayCollection:ArrayCollection = new ArrayCollection([
  {scene:"Image1",source1:img1},
  {scene:"Image2",source1:img2},
  {scene:"Image3",source1:img3},
  ]);
 
  [Bindable]
  private var lengthOfDataSource:Number=myDataArrayCollection.length;
 
  private var timerId:Timer;
  
  private var countersceneIndex:Number=0;
 
    private function ReturnCountersceneIndex():Number
    {
     if(countersceneIndex<lengthOfDataSource-1)
     {
      for(countersceneIndex;countersceneIndex<lengthOfDataSource;countersceneIndex++)
      {
      countersceneIndex++;
      break;
      }
    return countersceneIndex;
     }
     else
     {
      countersceneIndex=0;
      return null;
     }
    }
     
  private function init():void
  {
   timerId = new Timer(1000);
              
   timerId.addEventListener(TimerEvent.TIMER , timerHandler);
  
   timerId.start();
  }
 
  private function timerHandler(event:TimerEvent):void
  { 
   imgscene.source=myDataArrayCollection.getItemAt(countersceneIndex).source1;
   
   imgscene.source=myDataArrayCollection.getItemAt (ReturnCountersceneIndex()).source1;
  }

 ]]>
</mx:Script>
<mx:HBox id=”imgGalary” width=”100%” height=”100%” paddingBottom=”25″ paddingTop=”25″ paddingLeft=”25″ paddingRight=”25″
 horizontalGap=”0″ horizontalAlign=”center” verticalAlign=”middle” backgroundColor=”#8c8c8c”>
 <mx:Box id=”boxImageHolder” width=”250″ height=”200″ borderColor=”#FF0000″ borderStyle=”solid” backgroundColor=”#000000″
   horizontalAlign=”center” verticalAlign=”middle”
   paddingBottom=”10″ paddingTop=”10″ paddingLeft=”10″ paddingRight=”10″>
  <mx:Image id=”imgscene” source=”{myDataArrayCollection.getItemAt(selectedImageIndex).source1}” width=”200″ height=”150″/>
  <mx:Label id=”timeLabel” fontWeight=”bold” fontSize=”11″ width=”200″ textAlign=”center”/>
 </mx:Box>
</mx:HBox>
 
</mx:Application>
Enjoy Flexing…………………

Shardul Singh Bartwal

Posted in Flex | Leave a Comment »

Passing Data With Custom Event

Posted by shardulbartwal on December 3, 2007

As being an event driven language Action Script provides the mechanism of sending any kind of object with the event.The concept is more important when we are supposing to get value of any varialbe of mxml into any another mxml which is far enough in the structure(Folder Structure)of our Application.It is very simple to create any custom event for the occurence of any particular event.Within the same parent folder in which your mxml containing the variable create a folder (let suppose with name ‘event’).In this mxml let suppose you are having a variable of arrayCollecton type its name is ‘myArrayCollection’ and it is already having some value.
Now you want to get this variable in any another mxml which is far from this.Then for doing this make one custom event ‘GetMyArrayCollectionEvent’ in the folder where your mxml(which is having that arrayCollection)is present.

Just create one action Script class file Copy and Paste the code below.
——————————————————————————————–
package myPro.events
{
 import flash.events.Event;
 
 public class GetMyArrayCollectionEvent extends Event
 {

  public var mybool:Boolean=true;
  public var myArrayCollection:ArrayCollection;
 
  public function PropertyThumbEvent  (type:String,myArrayCollection,mybool:Boolean=true):void
  {
   super(type);
   this.myArrayCollection = myArrayCollection;
   this.b=b ;
  }
 
  override public function clone():Event
  {
   return new GetMyArrayCollectionEvent(type,myArrayCollection,mybool);
  }
  
 }
}
——————————————————————————————–

Now at this mxml where ‘myArrayCollection’ is present First add Metadata as below :-
——————————————————————————————–
<mx:Metadata>
[Event(name="myCustomEvent",type="myPro.events.GetMyArrayCollectionEvent")]
</mx:Metadata>
——————————————————————————————–

Again from the same mxml just dispatch one event i.e. as:-

——————————————————————————————–
dispatchEvent(new GetMyArrayCollectionEvent(“myCustomEvent”,myArrayCollection,true));

——————————————————————————————–
One thing noticable here is that here ‘myCustomEvent’ is the name of event which can  be any variable name,and ‘GetMyArrayCollectionEvent’ is the type of the event.
Now on the mxml where you want to get this variable just get the event and with this event you will find ‘myArrayCollection’.You can just see it by tracing i.e.  
      trace(event.myArrayCollection).

Now you can do any thing with this collection as per your requirement.
Enjoy Flexing………………

Posted in Flex | Leave a Comment »

Flex Charting with Editable Datagrid

Posted by shardulbartwal on November 20, 2007

Charting in Flex

charting.png

Charting in flex is one of the important and owesome feature of flex.Here is a example in which you u can see the Chart representation of the values in a Datagrid.Hoping you all will enjoy it.The important featureof the flex is the that on changing the value in the datagrid there is the coresponding change in the Chart and for achieving this you don’t require to do any thing more.

   Just  copy and paste the code below in your Application mxml of Flex.

******************************************************************

<?xml version=”1.0″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” paddingTop=”50″
layout=”vertical” verticalScrollPolicy=”off”
>
<mx:Style>
Application {
backgroundColor: #333333;
}
Label{
color:#ff0000;
fontSize:11;
textAlign:justify;
font-family:Verdana;
}

Alert{
modalTransparencyBlur: 5;
modalTransparency: 0.6;
modalTransparencyColor: #DDDDDD;
modalTransparencyDuration: 1000;
color : #0f3177;
title-style-name : “.alertTitle”;
header-height:19;
border-thickness: 1;
drop-shadow-enabled: true;
drop-shadow-color :#d1ddf7;
background-color: #ffffff;
corner-radius :6;
border-style :solid;
header-colors : #90a4d1, #5970a0;
footer-colors : #9db6d9, #ffffff;
border-color : #5970a0;   
}

.alertTitle{
font-family :Times New;
font-size :20;
font-weight :bold;
text-align :left;
color :#ffffff;
}
</mx:Style>

  <mx:Script><![CDATA[
    import mx.utils.ArrayUtil;
     import mx.collections.ArrayCollection;
     import mx.events.DataGridEvent;
     import mx.events.ListEvent;
     import mx.controls.Alert ;
   
  public var expenses:ArrayCollection = new ArrayCollection([
        {Month:"January", Profit:2000000, Expenses:1500000,ENo:100},
        {Month:"February", Profit:1000000, Expenses:200000,ENo:80},
        {Month:"March", Profit:1500000, Expenses:500000,ENo:110},
        {Month:"April", Profit:1500000, Expenses:500000,ENo:130}
     ]);
      
     public function functionAddRecord(expenses:ArrayCollection):void
     {
     var strMonth:String=txtMonth.text;
  var strProfit:String=txtProfit.text;
  var strExpenses:String=txtExpenses.text;
  var strENo:String=txtENo.text;
  if(strMonth.length==0){Alert.show(“Enter the month First,it can not be Empty.”,”Blank field”)}
  else if(strProfit.length==0){Alert.show(“Enter the Profit First,it can not be Empty.”,”Blank field”)}
  else if(strExpenses.length==0){Alert.show(“Enter the Expenses First,it can not be Empty.”,”Blank field”)}
  else if(strENo.length==0){Alert.show(“Enter the ENo First,it can not be Empty.”,”Blank field”)}
  else
   {
    expenses.addItem({Month:strMonth,Profit:strProfit,Expenses:strExpenses,ENo:strENo});
        expenses.refresh();
        txtMonth.text=”";
        txtProfit.text=”";
        txtExpenses.text=”";
        txtENo.text=”";
     }
  }
 
      public function functionRemoveRecord(expenses:ArrayCollection):void
      {
       var _selectedindex:Number=dg1.selectedIndex;
       var _expensesLength:Number=expenses.length;

           if(_selectedindex!=-1)
        {
         var _selectedindex:Number=dg1.selectedIndex;
        expenses.removeItemAt(_selectedindex);
         expenses.refresh();
        }
         else if(_expensesLength==0)
         {
          Alert.show(“There is no Record to Delete”,”Error”);
         }
      }
  
  public function functionCheckStatusOfRemove():void
  {
   if(dg1.selectedIndex >0)
   {
    btnRemove.enabled=true;
   }
  }  
  
     public function functionitemEditEnd(event:DataGridEvent):void
        {
        /* var _rowIndex:Number=event.rowIndex;
        var _columnIndex:Number= event.columnIndex;
        var cell:String=(String(event.currentTarget.itemEditorInstance));
           if(event.currentTarget.itemEditorInstance.length==0)
           {
            Alert.show(“Not Possible”);
           } */
         }
 
  public function functionItemClick(event:ListEvent)
  {
        /*   var _rowIndex:Number=event.rowIndex;
          var _columnIndex:Number=event.columnIndex;
          {
           if(_rowIndex==1)
            {
    //trace(expenses.getItemAt((event.rowIndex-1)).Month);
    expenses.refresh();
            }
          } */
        }
  ]]>
  </mx:Script>
<mx:WipeLeft id=”myWipeLeft” duration=”2000″/>
<mx:WipeRight id=”myWipeRight” duration=”2000″/>
<mx:WipeUp id=”myWipeUp” duration=”1000″/> 
<mx:HBox width=”100%” height=”50%” verticalScrollPolicy=”off”>
<mx:VBox width=”50%” height=”100%” creationCompleteEffect=”{myWipeRight}”>
<mx:Panel title=”Monthly Status of Company” id=”pChart” width=”100%” headerColors=”100%” height=”100%”>
     <mx:ColumnChart id=”myChart” dataProvider=”{expenses}” addedEffect=”{myWipeLeft}” 
     mouseDownEffect=”{myWipeUp}” creationCompleteEffect=”{myWipeUp}”>
        <mx:horizontalAxis>
    <mx:CategoryAxis dataProvider=”{expenses}” id=”ca” categoryField=”Month”/>
        </mx:horizontalAxis>
 <mx:series>
   <mx:ColumnSeries xField=”Month” yField=”Profit” displayName=”Profit” addedEffect=”{myWipeUp}”/>
   <mx:ColumnSeries xField=”Month” yField=”Expenses” displayName=”Expenses” addedEffect=”{myWipeUp}”/>
   <mx:ColumnSeries xField=”Month” yField=”ENo” displayName=”No Of Employees” addedEffect=”{myWipeUp}”/>
 </mx:series>   
     </mx:ColumnChart>
     <mx:Legend dataProvider=”{myChart}”/>
</mx:Panel>
</mx:VBox>

<mx:VBox width=”50%” height=”100%” creationCompleteEffect=”{myWipeLeft}”>
 <mx:HBox width=”100%” height=”50%”>
  <mx:Panel width=”100%” height=”100%” title=”Add New/Remove Record”>
  <mx:Spacer height=”5″ width=”100%”/>
  <mx:HBox width=”100%” height=”20%”>
   <mx:Label text=”Month” width=”100″/>
   <mx:TextInput id=”txtMonth” width=”150″ height=”30″ restrict=”A-Z,a-z” toolTip=”Value should be non numeric.”/>
   </mx:HBox>
  <mx:HBox width=”100%” height=”20%”>
   <mx:Label text=”Profit” width=”100″/>
   <mx:TextInput id=”txtProfit” width=”150″ height=”30″ restrict=”0-9″ toolTip=”Value should be numeric.”/>
  </mx:HBox>
  <mx:HBox width=”100%” height=”20%”>
   <mx:Label text=”Expenses” width=”100″/>
   <mx:TextInput id=”txtExpenses” width=”150″ height=”30″ restrict=”0-9″ toolTip=”Value should be numeric.”/>
  </mx:HBox>
  <mx:HBox width=”100%” height=”20%”>
   <mx:Label text=”No of Emp.” width=”100″/>
   <mx:TextInput id=”txtENo” width=”150″ height=”30″ restrict=”0-9″ toolTip=”Value should be numeric.”/>
  </mx:HBox>
  <mx:HBox width=”100%” height=”20%”>
   <mx:Spacer width=”70″/>
   <mx:Button label=”Add New Record” click=”functionAddRecord(expenses)”/>
   <mx:Button id=”btnRemove” enabled=”false” label=”Remove Selected Record” click=”functionRemoveRecord(expenses)” toolTip=”For Removing any item first select it from ‘Edit Records’.”/>
 </mx:HBox>
</mx:Panel>
</mx:HBox>

<mx:HBox width=”100%” height=”50%”>
<mx:Panel id=”p1″ width=”100%” height=”100%” title=”Edit Records”>
<mx:DataGrid id=”dg1″ width=”100%”  editable=”true” selectable=”true” dataProvider=”{expenses}”
 itemClick=”functionItemClick(event)” itemEditEnd=”functionitemEditEnd(event)” enterFrame=”functionCheckStatusOfRemove()”>
 <mx:columns>
  <mx:DataGridColumn dataField=”Month” headerText=”Month” editable=”false”/>
  <mx:DataGridColumn dataField=”Profit” headerText=”Profit” textAlign=”center”/>
  <mx:DataGridColumn dataField=”Expenses” headerText=”Expenses” textAlign=”center”/>
  <mx:DataGridColumn dataField=”ENo” headerText=”No Of Employee” textAlign=”center”/>
 </mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:HBox>
</mx:VBox>
</mx:HBox>
</mx:Application>

******************************************************************

******************************************************************

Enjoy Flexing.

Shardul Singh Bartwal

Posted in AIR, ActionScript 3.0, Flex | 2 Comments »