[vet-mm] actionscript prob

Glenn Drew gedrew at optusnet.com.au
Thu Sep 11 18:24:58 EST 2008


Speaking of scripting - I have an odd issue with Flash CS3 (AS 2.0) and a simple piece of scripting I have used many times before.


A simple and crude calculator
Create 2 input text boxes with variable names, 'num1' and 'num 2' respectively.
Create a dynamic text box with the variable name 'answer'.
A button with the following script

on (press) {
 answer = Number(num1) + Number(num2); //Adds 2 numbers entered into num1 and num2, converting num1 & 2 from strings to numbers
}

It produces the correct output on a teachers PC eg 2 + 3 =5, but not on the students or my laptop where it produces NaN (Not a number).
A check of the datatypes using 'trace(typeof(num1)); etc, shows that num1 and num2 remain as strings.

A trace(answer) command shows a lot of html code?!?!?
It appears different machines compile them differently, is there a setting or formatting I am not finding??

Any clues, anyone?
Glenn Drew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.edulists.com.au/pipermail/vet-mm/attachments/20080911/4897bb53/attachment.html


More information about the vet-mm mailing list