I have :

var somefunc:Function =giveMeMyFunc();

if(!somefunc) …

I get very misleading warning :

“Function value used where type Object was expected. Possibly
the parentheses () are missing after this Function refference”

but if I do this :

if(somefunc==null) no warming shows up,

this sounds like a bug?

is this a bug?

|||
Hey,

do you happen to come from a PHP world???

If so, then if (!var) is possible in PHP, but not in
ActionScript.

ActionScript is strong(er) typed then PHP so you have to
compare a variable against something. In PHP variable can change
type.. in ActionScript not.

So if (!variable) means nothing in Actionscript.

For example if var==null, what is !var ??

Ries
|||
I dont agree,

in AS if (!var) means same as if (var==null) , remember AS
is based on EcmaScript and last I checked EcmaScript still allows
this kind of notation.

its actualy very easy to test :

var test:Object = null;

Alert.show(!test+”"); // output true

Alert.show((test==null)+”");// output true

test = new Object();

Alert.show(!test+”"); // output false

Alert.show((test==null)+”"); // output false

P.S I come from java :) world .

|||
Hey,

properly you are right. I have had the same, but now trying I
couldn’t duplicate it.

Me coming and doing a lot with database I find the while if
(!Object) very strange where a object can be null.

SELECT NULL; — results in NULL

SELECT NOT NULL; — result in null

Both of the below statements return true :)

select NULL IS NULL;

select (NOT NULL) IS NULL;

Anyways, I started to get used to specifying what I really
mean eg:

I am nowdays using if (object == null)

I think in the above message that AS might get confused
because it finds a function with the same name, might be a bug
indeed….

Ries

Related posts:

  1. XML and ResultEvent parsing
  2. error message activations
  3. Flex and Javascript
  4. Alert component causes infinite loop
  5. error message while tried to download free trial version

Related posts brought to you by Yet Another Related Posts Plugin.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

   
© 2012 free icons download Suffusion theme by Sayontan Sinha

Featuring Recent Posts WordPress Widget development by YD