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'?>
|
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'?>
|
target.swf