Hi Steven,
Thanks for the explanation.
If you mean Moock's Essential Actionscript, I've had a read of that
section and AFAICS it doesn't mention a bug.
The only real issue I know of in try/catch do with return is that
you shouldn't put a return in a finally clause, because finally gets
AM
To: Flash Coders List
Subject: Re: [Flashcoders] AS3 - Checking if a Function Exists
Hi Steven,
Thanks for the explanation.
If you mean Moock's Essential Actionscript, I've had a read of that
section and AFAICS it doesn't mention a bug.
The only real issue I know of in try/catch do
There's a bug if you return in a try or catch (maybe it's just catch). Colin
Moock mentions it in his AS3 book. I personally think it's cleaner to return
after a try catch because try catch is not an if else and really shouldn't be
treated as such, but that might be because I have avoided
I'm afraid I don't think either Han's or Steven's solutions work in
AS3 - you'd still get a ReferenceError (unless currentSection is
dynamic).
I'd do it using flash.utils.describeType, like so:
import flash.utils.describeType;
:
var desc:XML=flash.utils.describeType(currentSection);
if
Or, thinking about it, you could catch the reference error in a
try/catch block. It's more of a kludge, but might give you much higher
performance!
Ian
On Tue, Oct 28, 2008 at 8:33 AM, Ian Thomas [EMAIL PROTECTED] wrote:
I'm afraid I don't think either Han's or Steven's solutions work in
AS3 -
Method:
public static function refExists(obj:Object,name:String):Boolean
{
try
{
if (obj[name]!=null)
return true;
}
catch (e:ReferenceError) {}
return false;
}
HTH,
Ian
On Tue, Oct 28, 2008 at 8:36 AM, Ian
This is great - thank you
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas
Sent: 28 October 2008 08:46
To: Flash Coders List
Subject: Re: [Flashcoders] AS3 - Checking if a Function Exists
Method:
public static function refExists
28, 2008 at 2:13 PM, Karim Beyrouti [EMAIL PROTECTED] wrote:
This is great - thank you
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas
Sent: 28 October 2008 08:46
To: Flash Coders List
Subject: Re: [Flashcoders] AS3 - Checking
Do not call return in a try catch.
Ian Thomas wrote:
Method:
public static function refExists(obj:Object,name:String):Boolean
{
try
{
if (obj[name]!=null)
return true;
}
catch (e:ReferenceError) {}
return false;
}
- Original Message -
From: Steven Sacks [EMAIL PROTECTED]
To: Flash Coders List flashcoders@chattyfig.figleaf.com
Sent: Wednesday, October 29, 2008 2:20 AM
Subject: Re: [Flashcoders] AS3 - Checking if a Function Exists
Do not call return in a try catch.
Are you suggesting
Hello Group -
This should be really easy. I am trying to find out how to check if a
function exists or not in AS3 -
I tried this:
code
If ( currentSection.refresh != null ) {
currentSection.refresh();
}
/code
But I get ReferenceError: Error #1069: Property
If ( currentSection[refresh] != null ) {
currentSection[refresh]();
}
?
grtz
JC
On Mon, Oct 27, 2008 at 3:02 PM, Karim Beyrouti [EMAIL PROTECTED] wrote:
Hello Group -
This should be really easy. I am trying to find out how to check if a
function exists
if (currentSection.refresh)
{
currentSection.refresh();
}
Karim Beyrouti wrote:
Hello Group -
This should be really easy. I am trying to find out how to check if a
function exists or not in AS3 -
I tried this:
code
If ( currentSection.refresh != null ) {
13 matches
Mail list logo