Showing posts with label comboScript. Show all posts
Showing posts with label comboScript. Show all posts

Monday, August 16, 2010

Flex Framework ComboBoxScript


Flex Framework ComboBox with actionScript


Aim:

            A combo box is a commonly used graphical user interface. A combo box is a component with a drop-down arrow that users click to display an associated list of choices

Problem:

Create combo box and display on the label components which choice we will choose.

Requirements:

          1). Combo Box 2). Label 3). Button

Procedure:

Step 1:

Create project. Already I have explained how to create project. If you forget, please remind the previous post.

I give the name for the project FlexExample.


Step 2:

Create file. Already I have explained how to create file. You follow that steps to create file.

I give the name for the file ComboScript.mxml

Flex Framework ComboBox with ActionScript


Flex Framework ComboBox with actionScript


Aim:

            A combo box is a commonly used graphical user interface. A combo box is a component with a drop-down arrow that users click to display an associated list of choices

Problem:

Create combo box and display on the label components which choice we will choose.

Requirements:

          1). Combo Box 2). Label 3). Button

Procedure:

Step 1:

Create project. Already I have explained how to create project. If you forget, please remind the previous post.

I give the name for the project FlexExample.


Step 2:

Create file. Already I have explained how to create file. You follow that steps to create file.

I give the name for the file ComboScript.mxml



Include the following coding into the ComboScript.mxml


< ?xml version = '1.0' encoding = 'utf-8'? >
< mx:Application xmlns:mx = 'http://www.adobe.com/2006/mxml' >
< mx:Script >

private function display(event:Event):void
{
if(country.selectedItem=="India")
{
count.text="India";
}
if(country.selectedItem=="Pakistan")
{
count.text="Pakistan";
}
if(country.selectedItem=="Srilanka")
{
count.text="Srilanka";
}
if(country.selectedItem=="Bangladesh")
{
count.text="Bangladesh";
}
}
< /mx:Script >

< mx:Panel title="ComboBox and Radio Button" height="500" width="500"
layout="vertical" >
< mx:Label id="count"/ >
< mx:ComboBox id="country" >
< mx:String > India < /mx:String >
< mx:String > Pakistan < /mx:String >
< mx:String > Srilanka < /mx:String >
< mx:String > Bangladesh < /mx:String >
< /mx:ComboBox >

< mx:Button label="OK" click="display(event);"/ >

< mx:Panel >

< /mx:Application >


Step 3:

Create build.xml. Already you have build.xml, you just made some changes in build.xml.

Include following coding into build.xml
…..
< exec executable='${compiler}' failonerror='true' >
< arg line='-output F:\FLEXWORKSPACE\FlexExample\ComboScript.swf' / >
< arg line='F:\FLEXWORKSPACE\FlexExample\ComboScript.mxml' / >
< /exec >
…..
…..

if you create new build.xml, you include following coding into build.xml


< project name='Flex' default='mxml' >

< target name='mxml' >
< property name='compiler' location='E:\InstalledSoftware\FlexSoft\bin\mxmlc.exe' / >

< exec executable='${compiler}' failonerror='true' >
< arg line='-output F:\FLEXWORKSPACE\FlexExample\ComboScript.swf' / >
< arg line='F:\FLEXWORKSPACE\FlexExample\ComboScript.mxml' / >
< /exec >

< echo > mxml file compiled successfully < /echo >
< echo > swf file generated successfully < /echo >
< /target >


< /project >

Step 4:
Run the Application.

Click build.xml. inside the build.xml window,right click and
select Run As – 1. Ant Build















Step 5:

Go to the folder. Where you have saved the ComboScript.swf and ComboScript.mxml. and open the ComboScript.swf.