this works for me, since i only need either 1 or 2 arguments, never more.
Thanks for all the examples guys,
Sid
Matthew James Poole wrote:
True, but with the rest argument you can have as many args as you
want...
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jim
Hayes
Sent: 07 February 2008 12:11
To: Flash Coders List
Subject: RE: [Flashcoders] AS3 Function question
I normally just set a default value for the second argument :
function someFunction(arg1:int,arg2:String=null):void
{
if(arg2==null)
{
//whatever.
}
//some code ...
}
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sidney
de Koning
Sent: 07 February 2008 11:45
To: Flash Coders List
Subject: [Flashcoders] AS3 Function question
Hi list,
I have a function in AS3, and it takes two arguments, but sometimes i
want it to have 1 argument. But when i run it now it errors:
1136: Incorrect number of arguments. Expected 2.
How do i do this? keep one arguments standard in the function brackets
and check for the second argument with the arguments array like in AS2?
Help would be advised,
Thanks,
Sidney
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
______________________________________________________________________
This communication is from Primal Pictures Ltd., a company registered in
England and Wales with registration No. 02622298 and registered office:
4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W
5PA, UK. VAT registration No. 648874577.
This e-mail is confidential and may be privileged. It may be read,
copied and used only by the intended recipient. If you have received it
in error, please contact the sender immediately by return e-mail or by
telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not
disclose its contents to any person.
This email has been scanned for Primal Pictures by the MessageLabs Email
Security System.
______________________________________________________________________
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
______________________________________________________________________
This e-mail has been scanned for viruses by the Virtual Universe e-mail
security system - powered by MessageLabs.
http://www.virtual-universe.net
______________________________________________________________________
The contents of this email are confidential and may be subject to legal
privilege and protected by copyright. If you are not the intended recipient any
use, copying or disclosure of this e-mail to any third party is strictly
forbidden by the sender and we reserve all rights and remedies against any
person or entity making any such unauthorised use. If you have received this
email in error, please contact the sender immediately by telephone or return
the email to the sender and then delete this email and any copies of it on your
system. Virtual Universe Limited may monitor the contents of emails sent and
received via its network for viruses and to ensure the lawful and authorised
use of its systems. Virtual Universe Limited will not be held responsible for
any damage caused by viruses which may be transmitted upon receipt of this
email or the opening of any attachment thereto. Any views or opinions presented
in this email are solely those of the author and do not necessarily !
represent those of Virtual Universe Limited.
Virtual Universe Limited is a company established under the laws of England and
Wales with registered number 03064568 and has its registered office at 1 Regent
Street, London, SW1Y 4NW and principal place of business at 28-39 The Quadrant,
135 Salusbury Road, London NW6 6RJ, United Kingdom. It is registered for VAT in
the United Kingdom with number GB877113217.
______________________________________________________________________
This e-mail has been scanned for viruses by the Virtual Universe e-mail
security system - powered by MessageLabs. http://www.virtual-universe.net
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders