Can you do a use example?

 

Thanks.

 

  _____  

De: [email protected] [mailto:[EMAIL PROTECTED] Em nome
de John C. Bland II
Enviada em: sexta-feira, 15 de dezembro de 2006 02:02
Para: [email protected]
Assunto: Re: [flexcoders] Creating Events

 

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]
<mailto:[EMAIL PROTECTED]> com.br> 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:
<http://branco:8080/projetos/5clicks/extranet/source/flex/bin/amfphp/gateway
.php> 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. <http://www.katapultmedia.com> com
---
Biz Blog - http://blogs. <http://blogs.katapultmedia.com/jb2>
katapultmedia.com/jb2
Personal Blog - http://blog. <http://blog.blandfamilyonline.com>
blandfamilyonline.com
http://www.lifthimh <http://www.lifthimhigh.com> igh.com - "Christian
Products for Those Bold Enough to Wear Them"
Home of FMUG.az - http://www.gotoands <http://www.gotoandstop.org> top.org
Home of AZCFUG - http://www.azcfug. <http://www.azcfug.org> org 

 

Reply via email to