Button Events in Flex2.0

Create new Flex project in flex basic radio and choose next then enter project name and finish..

Wow you are in flex coding part

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="" layout="absolute">
<mx:Button id="button1" label="Click me" x="100" y="100" />

this is way for creating button in flex we have given

id name which is used to refer the button later in actionscript or mxml

Label is the text displayed in Button

Then x y values to position button

Handling Events

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="" layout="absolute">
public function launch(evt:MouseEvent):void{

navigateToURL(new URLRequest(""));

<mx:Button id="button1" label="Click me" x="100" y="100" click="launch(event)"/>

Here we are going to write our button handler using Actionscript using mx:script tag
we are calling launch method in click event.

and navigating to url similar to getURL in flash8

Bookmark and Share



Recent Posts

Recent Visitors

Donate Me

About Me

My photo
Chennai, Tamil nadu, India
Nothing more to say about me.. Just a Action Script programmer / Flex developer having 4.5 years of experience.