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

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
Flex current target property example 
 

Example below describes the working of currentTarget property in flex. Code below shows a method .setSelection which is used to highlight the text letters as defined closed indexes.

 

Flex current target property example

                         

The example below describes the working flex currentTarget property. Code below shows a method .setSelection which is used to highlight the text letters as per defined closed indexes. Here, use of <![CDATA --- ]]>  is optional. In the code, two functions are defined, viz.,  protocol and virus; both are event handler functions. First method defines the Label control id and  puts data in to core.text, where text is the attribute defined in TextInput control and the second function highlights the text characters from index 5 to 20 in TextInput. Both are click based event functions, however the protocol function gets initialized first because it is passed in the initialize attribute of the root tag. Root tag is coded as <Application/>, and is called as the root tag of the application inside which other flex control and container tags are coded. 

 

 

 

 

currentTarget.mxml

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

  <mx:Script>
    <![CDATA[
      public function protocol(event:Event):void{
master.text = 'Label' + event.currentTarget.id + 'is clicked';
core.text = 
'Weaving = Agent Smith said that in an interview about Matrix Reloaded';  
  
      }

      public function virus(event:Event):void{
        TextInput(event.currentTarget).setSelection(5,20);
      
    ]]>
</mx:Script>

<mx:TextInput id = 'core' text = 'click on me' click = 'virus(event);' />
      <mx:Label id = 'master' click = 'protocol(event);'/>
</mx:Application>

currentTarget.swf

 

In the code below event.current.Target feature is used in the function constructor. Function is called through the click attribute of Button control.


target.mxml

<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<mx:Application xmlns:mx = 'http://www.adobe.com/2006/mxml'>
<mx:Script>
  import mx.controls.Alert;

    public function nick(s:String):void{
      Alert.show('Button control id is : ' + s);
}

</mx:Script>

  <mx:Button label = 'Click me' id = 'Cathastorus
        click = 'nick(event.currentTarget.id)'/>

</mx:Application>

target.swf

        


Download the source code

                         

» View all related tutorials
Related Tags: c gui com class controls ui select button style control io components sed implementation component definition tag name using this

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
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
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.

» View all related tutorials
Related Tags: c gui com class controls ui select button style control io components sed implementation component definition tag name using this

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 

Current Comments

0 comments so far (
post your own) View All Comments Latest 10 Comments:
Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
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.