flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Rovira <carlosrov...@apache.org>
Subject Re: [FlexJS] static method with arguments failing
Date Sat, 14 Jan 2017 00:18:14 GMT
The problem seems related to the method name "toString" already in use...

But the object doesn't extend nothing, so there's no super.toString()

This seems a bug right?

I workaround changing the name to _toString(...)



2017-01-14 0:26 GMT+01:00 Carlos Rovira <carlosrovira@apache.org>:

> Hi, I'm trying to create a ObjectUtil.as Core class with the following
> method borrowed from Flex SDK:
>
> /**
>          * Convert the object to a string of form: PROP: VAL&PROP: VAL
> where: PROP is a property VAL is its corresponding value & is the specified
> optional delimiter
>          * @param obj Object to convert
>          * @param delimiter (optional) Delimiter of property/value pairs
>          * @return An string of all property/value pairs delimited by the
> given string or null if the input object or delimiter is null.
>          */
>         public static function toString( obj:Object=null, delimiter:String
> = "\n" ):String
>         {
>             if ( obj == null || delimiter == null )
>             {
>                 return "";
>             }
>             else
>             {
>                 var ret:Array = [];
>
>                 for ( var s:Object in obj )
>                 {
>                     ret.push( s + ": " + obj[s] );
>                 }
>
>                 return ret.join( delimiter );
>             }
>         }
>
>
> when I try to use it in a SWC library it fails with this error:
>
> Incorrect number of arguments.  Expected no more than 0
>            var str:String = ObjectUtil.toString(value);
>                             ^
>
> I'm trying to see where is the problem without luck
>
> Some idea of what is going wrong here?
>
> Thanks
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>
>


-- 
Carlos Rovira
http://about.me/carlosrovira

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message