Array and NaN problem

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Foudou
Posts: 19
Joined: March 27th, 2009, 1:54 am

First things i'm french, so sorry if my english is a little bit strange.

I'm creating a script who add text layer from a text file in a certain way (the text layers is touching each other).

I have made the big part of my script but i'm actually blocking by two problem : .

The first problem is very stupid, but i' can't find a good answer : i'm using a two dimension array, but i don't now how to declare it. Usually on internet the answer is to write

var Donnee = new Array(), but it create a one dimension array.
And when i'm writing something like that : Donnee[2][5] = X1, AEFX is returning a error alert, undefined object.

I have find a solutions by writing Donnee[x] = [X1,X2,X3, etc...], but i just want to know how to declare it without error.

The second problem is more problematic, the script calculate position of each new layer with the previous layer position and some sinus cosinus math, but he gives me some NaN value : one for the second layer, more for the third until the script crash when he finally used a NaN value to set position of a new layer.

I have add to alert to see exactly where the NaN value appeared but it's never in the same time.
I have reducted to integer the position value, but the problem is still here.

I have a last solution by writing a select case for configuration (sixteen!) but i'm not sure that it will make my script work.

You're my last chance.

Thanks for help.
Image
FrenchEnglish inside.
Yenaphe
Posts: 84
Joined: February 3rd, 2009, 6:30 pm
Location: Paris - France
Contact:

Hi Foudou,

whould you mind posting an exerpt of your code (mostly for your second problem) so we can see what went wrong with your script ?
Foudou
Posts: 19
Joined: March 27th, 2009, 1:54 am

Finally strangly i have find the answer to my problem just after my post.

It was just a mistake about the index of one array : i was using using 1 at first index, i have just forgot that the first value of an array is the 0 value.

Now i have the just some mathematical problems, but nothing impossible.

Thanks. I will post my script when it was finished.
Image
FrenchEnglish inside.
Post Reply