PDA

View Full Version : problems with AS1 to AS2 - type mismatch



oneczech
October 12th, 2004, 07:38 AM
hi ..

i have a problem running this script under AS2 (flash player 7) .... with AS1 (flash player 6) there is no problem. Only AS2 cause an error ...

Type mismatch.
var dX = parseInt(_root._xmouse - this.rotateTarget._x);

i have no idea what part of this line is not good enough for AS2

could I ask for help or advice? thanks

claudio
October 12th, 2004, 09:55 AM
Because perseInt converts a string into a number, and both _root._xmouse and this.rotateTarget._x are numbers.
AS2.0 is much more strict with variable type than AS1.0

[m]
October 12th, 2004, 01:38 PM
Why use parseInt in the first place?

claudio
October 13th, 2004, 07:41 AM
In this case parseInt is really not necessary, but it's not a deprecated command.