Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
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
       
event.target.label
       
event.currentTarget.label

Target.mxml

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

      public function google(event:Event):void{
        var url:URLRequest = new URLRequest(
        'http://www.google.com/search?hl=en&q='
         + event.target.label);
        
        navigateToURL(url);
      }
      public function googleImage(event:Event):void{
        var url:URLRequest = new URLRequest(
        'http://images.google.com/images?hl=en&q=' 
        + event.target.label);
        
        navigateToURL(url);
      }
      
      public function clickListener():void{
        Panel_0.addEventListener(MouseEvent.CLICK, 
          roseindia);        
        Panel_1.addEventListener(MouseEvent.CLICK, 
          google);        
        Panel_2.addEventListener(MouseEvent.CLICK, 
          googleImage);        
      }  

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

    
    </mx:Panel>

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

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

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

Target.swf

 

Download the code

                         

» View all related tutorials
Related Tags:

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.