From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ramu p
Sent: Tuesday, October 18, 2005 4:32 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Is it the right way of using dispatchEvent?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns="*">
<mx:Script>
<![CDATA[
function
fun(){
mx.controls.Alert.show("Event
dispatched!")
}
]]>
</mx:Script>
<circle xmlns:circle="*"
cirPress="fun"/>
</mx:Application>
//**************************************************************************
Here is component (circle.as)
//**************************************************************************
// ActionScript Document
import mx.core.UIComponent
import
mx.utils.Delegate
import mx.events.*
class circle extends
UIComponent{
public var
dispatchEvent:Function
[Embed(source="cir_sym.swf",symbol="cir_sym")]
var cir_sym:String;
var
obj:Object
var cirPress
function
circle(){
}
function
init():Void{
super.init();
EventDispatcher.initialize(this);
}
function
draw():Void{
super.draw();
}
function
createChildren():Void{
obj =
attachMovie("cir_sym","cir_sym",1);
addEventListener("cirPressed",Delegate.create(this,tempFun))
}
function tempFun(){
eval("_root."+cirPress).call()
}
function
onPress():Void{
dispatchEvent({type:"cirPressed"})
}
}
//**************************************************************************
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Web site design development | Computer software development | Software design and development |
Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.