Here is a custom event class. Just change LevelEvent to whatever you want
and the public var level to whatever custom data you want/need. But...you
only need this if you need to pass some sort of data with your event. You
could easily do dispatchEvent(new Event("myEventName")) and it'll work fine.

package events{
import flash.events.Event;
public class LevelEvent extends Event{
 public var level:Object;
 public function LevelEvent(level:Object, type:String,
bubbles:Boolean=false, cancelable:Boolean=false){
  super(type, bubbles, cancelable);
  this.level = level;
 }

 public override function clone():Event{
  return new LevelEvent(level, type);
 }
}
}


On 12/14/06, marloscarmo2004 <[EMAIL PROTECTED]> wrote:

  I need create a personalized event in my class in AS3. In AS2 I use
the dispatchEvent comand.

this.dispatchEvent( { type : "onResult", target : this, data :
result_arr } );

How do I do in AS3? See my code below.

package as3.db
{
import flash.net.NetConnection;
import flash.net.ObjectEncoding;
import flash.net.Responder;

public class AMFConnection
{
public var gateway : NetConnection;

public function AMFConnection() {
gateway = new NetConnection();
gateway.objectEncoding = flash.net.ObjectEncoding.AMF0;
gateway.connect(
"
http://branco:8080/projetos/5clicks/extranet/source/flex/bin/amfphp/gateway.php
");
}

public function callMethod( nameMethod : String, params : Array ) :
void {
gateway.call( "extranet.callMethod", new Responder( onResult,
onFault ), nameMethod, params );
}

public function onResult( result : String ) : void {
}

public function onFault( result : String ) : void {
}
}
}






--
John C. Bland II
Chief Geek
Katapult Media, Inc. - www.katapultmedia.com
---
Biz Blog - http://blogs.katapultmedia.com/jb2
Personal Blog - http://blog.blandfamilyonline.com
http://www.lifthimhigh.com - "Christian Products for Those Bold Enough to
Wear Them"
Home of FMUG.az - http://www.gotoandstop.org
Home of AZCFUG - http://www.azcfug.org

Reply via email to