Hi, ActionScript doesn't support method overloading. Instead you can use following approach.
function sayHello() { var n:Number = arguments.length; if(n==0) { alert("Hello World"); } else if(n==1) { alert("Hello " + arguments[0]); } else if(n==2) { alert("Hello " + arguments[0] + " " + arguments[1]); } } //usage: sayHello(); sayHello("Abdul"); sayHello("Abdul", "Qabiz"); You can access individual argument using "arguments" array. You can use typeof and instanceof to find the type of each argument and have a switch logic to perform different algorithm for different set of arguments. Does that make sense? -abdul -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Libby Sent: Thursday, September 15, 2005 7:09 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] How to overload methods in Actionscript? When I use same method name more than once (with additional arguments), Flex compiler says I can't use the same name more than once. Is this really true (Flex doesn't support method overloading?) or do I need to do something different? Thanks, Libby -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/