ahh I see , I replaced the String param with another class and it all makes
sense now
thanks :)
firdosh
On 7/9/07, reflexactions <[EMAIL PROTECTED]> wrote:
Declaring the parameter type as String already gaurantees the
parameter is of type String which makes use of "is" or "typeof"
superfluous.
If you losely type the variable you pass in it will do an implicit
conversion or if it is an unrelated type it will call toString(),
whichever you are still going to get a string (but not the original
object if it called toString).
Answer is dont losely type ....
--- In [EMAIL PROTECTED] <flecomponents%40yahoogroups.com>,
"Firdosh Tangri" <[EMAIL PROTECTED]>
wrote:
>
> Hey all,
>
> I am trying to make sure that a object passed to my method has to
be of type
> String so I did
>
>
> function methodA (val:String):void{
>
> if (val is String){
> trace (" I am string");
> }
>
> trace(typeof(val));
>
>
> }
>
>
> if I pass this to the method var t:* = new AnyClass();
>
> it traces out
> I am string
> string
>
>
> is there a way to make sure that the param passed to my method is
of type
>
> thanks
> firdosh
>