pm771
07-30-2008, 04:41 AM
I started learning FLEX 3 using 'From the Source' book and have Action Script question.
If I have a function that normally returns a custom object but in some cases needs to return null, do I need to cast null as the object?
Something along these lines:
function Sample():SomeObject {
var myObj:SomeObject
....
if (someCondition) {
myObj = new SomeObject();
} else {
myObj = null; // Or should it be: null as SomeObject ?
}
return myObj
}
TIA, Eugene
If I have a function that normally returns a custom object but in some cases needs to return null, do I need to cast null as the object?
Something along these lines:
function Sample():SomeObject {
var myObj:SomeObject
....
if (someCondition) {
myObj = new SomeObject();
} else {
myObj = null; // Or should it be: null as SomeObject ?
}
return myObj
}
TIA, Eugene