Mouse click functions mouseEvent

2010-09-08  来源:本站原创  分类:Flash  人气:133 

<? Xml version = "1.0" encoding = "utf-8"?>
<S: Application
xmlns: fx = "http://ns.adobe.com/mxml/2009"
xmlns: s = "library: / / ns.adobe.com / flex / spark"
xmlns: mx = "library: / / ns.adobe.com / flex / halo"
initialize = "init ()">
<fx:Script> <! [CDATA [
q
private function init (): void (
button3.addEventListener (MouseEvent.CLICK, handleClick);
w
)
private function handleClick (event: MouseEvent): void (
e
if (event.target == button2) (
label.text + = 'Button 2 clicked \ n';
) Else if (event.target == button3) (
label.text + = 'Button 3 clicked \ n';
)
)
]]></ Fx: Script>
<s:VGroup width="100%">
r
<S: Button label = "Button 1"
click = "label.text + = 'Button 1 clicked \ n'" />
t
<S: Button label = "Button 2"
click = "handleClick (event)" />
y
<s:Button label="Button 3"/>
<s:Label/>
</ S: VGroup>
</ S: Application>

相关文章