Passing Visual Basic arguments

As detailed in the D3 Visual Basic documentation, only VARIANT variables can be passed to the FlashBASIC subroutine, and any number of them may be passed. Arguments are passed by references, which means they can be modified on return. There are some exceptions listed in the table below.

Note: Only ANSI strings can be passed to a FlashBASIC routine. Arrays are not supported.
VB Type FlashBASIC Argument See Notes
Byte String with one character  
Short Integer 1, 2
Long Integer 1, 2
Real Floating point in double precision  
Bool Integer 2, 3
BSTR String 4, 5
Empty String with 0 characters  
Null String with 0 characters  
All Others String with 0 characters 6

Notes

  1. If any arithmetic operation is performed, the number is returned as a floating point number (in double precision) on which the usual D3 arithmetic precision factor has been applied. Note the argument is then coerced into a Real (see Note 2).

  2. To use floating point numbers, which improves performance significantly, use the (f option when compiling a FlashBASIC module.

  3. Any non-null number is treated by FlashBASIC as TRUE. If a TRUE value is returned, the numerical value of the result is 1, not the Visual Basic True value which is -1. Note the argument may be coerced into a Real.

  4. Only ANSI strings can be passed to a Flash subroutine. Since Visual Basic uses OLE characters (UNICODE), there may be data loss if the string cannot be converted to ANSI.

  5. If any arithmetic operation is performed on the string, or if FlashBASIC stores a number in the string, the argument is coerced on return into a Real.

  6. By default, all unsupported VARIANT types are received by the Flash subroutine as a null string. On return, the argument is coerced into a Visual Basic string.