Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-06-2004, 09:01 PM   #1
whoo
Registered User
 
Join Date: Apr 2004
Posts: 20
Default trouble with variable getting lost

Hi,

here is the scenario, well 2 actually that I have tried

1. assigning a variable on the main timeline. easy enough.
2. changing said variable depending on which of 3 buttons is pushed
3. retrieving variable at end of movie and using it in a match function

ive tried assigning it as
Code:
_level0.scorvar=1;
and then doing:
Code:
on (release) {
    NLev = new Array ();
    NLev[0] = new Array (4, 3, 20);
    NLev[1] = new Array ();
    NLev[1][1] = new Array (1, 20, 2, 1);
    NLev[1][2] = new Array (0, 2, 2, 3, 3, 3);
    NLev[1][3] = new Array (6, 5, 4, 4, 4, 3, 3, 3);
    NLev[2] = new Array ();
    NLev[2][1] = new Array (2, 25, 3, 2);
    NLev[2][2] = new Array (1, 1, 6, 6, 6, 7, 7, 7, 4, 4);
    NLev[2][3] = new Array (1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5);
    NLev[3] = new Array ();
    NLev[3][1] = new Array (1, 30, 4, 3);
    NLev[3][2] = new Array (8, 8, 8, 8, 10, 10, 11);
    NLev[3][3] = new Array (1, 4, 5, 6, 4, 4, 5, 5, 6);
    NLev[4] = new Array ();
    NLev[4][1] = new Array (2, 15, 2, 4);
    NLev[4][2] = new Array (0, 2, 3, 3, 3, 12);
    NLev[4][3] = new Array (1, 1, 1, 3, 3, 4, 4, 4, 4, 5, 2);
    NLev[5] = new Array ();
    NLev[5][1] = new Array (3, 25, 2, 5, 1);
    NLev[5][2] = new Array (6, 4, 5, 5, 7, 7);
    NLev[5][3] = new Array (1, 1, 1, 3, 4, 4, 4, 5, 5, 6, 6);
    NLev[6] = new Array ();
    NLev[6][1] = new Array (5, 30, 3, 6);
    NLev[6][2] = new Array (8, 8, 10, 10, 11, 11, 13);
    NLev[6][3] = new Array (1, 2, 3, 4, 5);
    NLev[7] = new Array ();
    NLev[7][1] = new Array (3, 20, 1, 1);
    NLev[7][2] = new Array (0, 2, 2, 3, 3, 13);
    NLev[7][3] = new Array (2, 2, 2, 2, 3);
    NLev[8] = new Array ();
    NLev[8][1] = new Array (5, 25, 2, 2);
    NLev[8][2] = new Array (5, 5, 9, 9, 14, 14, 14, 4, 4, 4);
    NLev[8][3] = new Array (1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 5);
    NLev[9] = new Array ();
    NLev[9][1] = new Array (4, 30, 3, 3);
    NLev[9][2] = new Array (10, 10, 11, 11, 13, 13, 13);
    NLev[9][3] = new Array (2, 3, 4, 5, 6, 2, 2, 3, 3, 4, 4, 4, 5);
    NLev[10] = new Array ();
    NLev[10][1] = new Array (6, 15, 1, 4);
    NLev[10][2] = new Array (0, 0, 2, 2, 3, 3, 3, 12);
    NLev[10][3] = new Array (1, 1, 1, 2, 2, 2, 3, 4);
    NLev[11] = new Array ();
    NLev[11][1] = new Array (4, 25, 2, 5, 1);
    NLev[11][2] = new Array (3, 3, 3, 3, 3, 3, 2, 2, 0);
    NLev[11][3] = new Array (1, 2, 3, 4, 5, 6, 1, 1, 1, 2, 2, 4, 4, 5, 6);
    NLev[12] = new Array ();
    NLev[12][1] = new Array (6, 30, 2, 6);
    NLev[12][2] = new Array (1, 6, 6, 7, 7, 4, 4, 4, 4);
    NLev[12][3] = new Array (1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 5);
    NLev[13] = new Array ();
    NLev[13][1] = new Array (7, 20, 2, 1);
    NLev[13][2] = new Array (7, 7, 6, 6, 14, 14, 14, 4, 4, 4);
    NLev[13][3] = new Array (1, 2, 3, 4, 5, 6, 1, 2, 2, 3, 4, 4);
    NLev[14] = new Array ();
    NLev[14][1] = new Array (8, 25, 2, 2, 1);
    NLev[14][2] = new Array (6, 4, 4, 5, 5, 9, 9, 9, 14, 14, 14);
    NLev[14][3] = new Array (1, 2, 3, 4, 5, 2, 2, 2, 4, 4, 4);
    NLev[15] = new Array ();
    NLev[15][1] = new Array (7, 30, 2, 3);
    NLev[15][2] = new Array (9, 9, 9, 5, 4, 10);
    NLev[15][3] = new Array (1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 6, 6, 6);
    NLev[16] = new Array ();
    NLev[16][1] = new Array (8, 15, 3, 4);
    NLev[16][2] = new Array (7, 10, 10, 11, 13, 13, 13);
    NLev[16][3] = new Array (2, 2, 2, 3, 4, 4, 4);
    NLev[17] = new Array ();
    NLev[17][1] = new Array (9, 25, 3, 5);
    NLev[17][2] = new Array (13, 13, 13, 11, 11, 10, 10);
    NLev[17][3] = new Array (1, 2, 3, 4, 5, 6, 1, 1, 1, 4, 4, 4, 6, 6, 6);
    NLev[18] = new Array ();
    NLev[18][1] = new Array (4, 30, 2, 6, 1);
    NLev[18][2] = new Array (10, 10, 11, 11, 8, 8, 8, 8, 8);
    NLev[18][3] = new Array (1, 1, 1, 2, 2, 2, 4, 4, 4, 5);
    NLev[19] = new Array ();
    NLev[19][1] = new Array (9, 20, 2, 1);
    NLev[19][2] = new Array (10, 10, 11, 11, 8, 8, 13);
    NLev[19][3] = new Array (1, 1, 1, 2, 2, 2, 3, 3, 3, 6);
    NLev[20] = new Array ();
    NLev[20][1] = new Array (7, 25, 2, 4);
    NLev[20][2] = new Array (10, 11, 8, 13, 5);
    NLev[20][3] = new Array (1, 2, 3, 4, 5, 1, 2, 3, 5, 1, 2, 3, 5, 2, 3);
    play();
    aircnt = 17;
    scorevar = 2;
}
this works until the other movieclips and what not load and unload, then the variable actually comes and go's literally (ive installed a debugging text box to debug it)

so then , of course, I decided to set it as a _global-- same problem, didnt actually stay a _global, and it was there sometimes, and other not there, and most importantly not there when i needed it to do the math.

I might add, that i set the varibale on the main timeline, the buttons all exist on the main time line, my debugging text box and my math function all exist on the main timeline.

So, could it be that the the array is messing this up? I did notice that if i removed the array code from the button, it worked (i think) I have so many versions of this floating around in my head, I could be wrong. With that in mind i actually tried to use another button action (press) to set this damn variable, that didnt work either.

Ideas or reccomendations welcome, and thanks!

Last edited by whoo; 08-06-2004 at 09:21 PM.
whoo is offline   Reply With Quote
Old 08-07-2004, 05:06 PM   #2
curryjon51
Registered User
 
Join Date: Jul 2003
Posts: 257
Default

Hi

Don't know about all the array stuff, but when I pasted it all into a bttn, and changed scorevar into just score (including on frame one where the variable is assigned), score updated nicely. Var is a keyword... and so it could be that that is cousing the trouble...

hth
curryjon51 is offline   Reply With Quote
Old 08-07-2004, 05:52 PM   #3
whoo
Registered User
 
Join Date: Apr 2004
Posts: 20
Default

ohh, hmm, you might be right I never thought of that!
whoo is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:01 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.