Home Flex Flex target property example

Related Tutorials


Share on Google+Share on Google+

Flex target property example

In coding the below flex application we have use an event object property target .

Flex target property example


In coding the below flex application we have use an event object property  target . We also have another event object property currentTarget. 
These properties enables the programmer to  track the event of which the object is made, during the event's propagating process. Properties target and currentTarget differ in their targeting jobs.  target property may dispatch the event to a component or component's sub component, whereas currentTarget will target the event to a particular node in which the event listener (function in which the event object is made) is called or tested.

Syntax for using these object properties


<?xml version = '1.0' encoding = 'utf-8'?>
<mx:Application xmlns:mx = 'http://www.adobe.com/2006/mxml'
 initialize = 'clickListener()'>
  public function roseindia(event:Event):void{
  var url:URLRequest;
  url = new URLRequest('http://www.roseindia.net/'
 + event.target.label);

  public function google(event:Event):void{
  var url:URLRequest = new URLRequest(
 + event.target.label);
  public function googleImage(event:Event):void{
  var url:URLRequest = new URLRequest(
  + event.target.label);
  public function clickListener():void{

  <mx:VBox width = '100%' height = '100%'>
  <mx:Panel id = 'Panel_0' title = 'Roseindia techno
  logies'  width = '30%' height = '40%
  color = 'green' backgroundColor = '#660033'>
  <mx:LinkButton label = 'java'/>
  <mx:LinkButton label = 'flex'/>
  <mx:LinkButton label = 'ant'/>
  <mx:LinkButton label = 'ajax'/>
  <mx:LinkButton label = 'jsp'/>
  <mx:LinkButton label = 'hibernate'/>
  <mx:LinkButton label = 'spring'/>


  <mx:Panel id = 'Panel_1' title = 'Google web
  backgroundColor = '#CCFF66' width = '30%'
  height = '40%' color = 'red'>

  <mx:LinkButton label = 'newstrackindia.com'/>
  <mx:LinkButton label = 'livetechtalk.com'/>
  <mx:LinkButton label = 'allcooljobs.com'/>
  <mx:LinkButton label = 'javajazzup.com'/>

  <mx:Panel id = 'Panel_2' title = 'Google images
  width = '30%' height = '40%' backgroundColor
 '#6633CC' color = 'blue'>  
  <mx:LinkButton label = 'Rachel weisz'/>
  <mx:LinkButton label = 'Trinity'/>
  <mx:LinkButton label = 'neo'/>
  <mx:LinkButton label = 'vampire'/>



Download the code


If you enjoyed this post then why not add us on Google+? Add us to your Circles

Liked it!  Share this Tutorial

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 11, 2009

Related Tutorials

Discuss: Flex target property example  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image