A Flash Developer Resource Site

Results 1 to 20 of 28

Thread: Passing args with event ?

Threaded View

  1. #6
    Junior Member
    Join Date
    Mar 2003
    Location
    Quebec !
    Posts
    9
    Hey !

    Based on your little code I've created a (realy simple) class which act like the old "arguments supported delegate"..without changing the scope

    Code:
    package {
    	
    	import flash.events.Event;
    	
    	public class CallArg{
             
             
            public function CallArg(){
    		
            }
             
    	public static function create(method:Function, ... args):Function {
    		return function(event:Event):void{				
    			method.apply(null, [event].concat(args));
    		}		
    	}
         }
    
    }
    Use :

    Code:
     someObj.addEventListener(SOME_EVENT, CallArg.create(SOME_FUNC, ARG1, ARG2, ARG3 ) )
    and the listening handler should have his first arguments as an Event

    Code:
    SOME_FUNC(_event:Event, ARG1, ARG2, ARG3) { 
    
    }
    Attached Files Attached Files
    OULALALALLALAOUAOUALALLALL...

    I hate signature

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center