|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Why the variable value shows undefined, plz help!
Hello friends, I have one button for moving upwards and it cotrols two movieclip. I want it work like after the user press the first movieclip, and press the moving upward button, the first movieclip moves upward. And if the user press the second movieclip and press the moving upward button, the second movieclip moves upward, while the first one stays where it was. Any one have some idea with my code, because I cannot pass the spress value on the moving upward button to test which movieclip the user has clicked.
I have on the first movieclip: on (release) { var spress=1; } and on the second one on (release) { var spress=2; } and on the moving upward button, I have on (release) { trace(_root.spress); // the spress is undefined when //I trace it ,so cannot continue, any one has someidea how to get the spress value here, thanks if (spress==1) { _root.screen._y -= 5; switch (state) { case 1 : y_value1 = _root.screen._y; break; case 2 : y_value2 = _root.screen._y; break; case 3 : y_value3 = _root.screen._y; break; case 4 : y_value4 = _root.screen._y; break; } } else if(spress==2) { _root.mulscreen._y -= 5; switch (state) { case 1 : y_valuem1 = _root.mulscreen._y; break; case 2 : y_valuem2 = _root.mulscreen._y; break; case 3 : y_valuem3 = _root.mulscreen._y; break; case 4 : y_valuem4 = _root.mulscreen._y; break; } } } Any idea about this ? Thanks in advance ! |
|
#2
|
|||
|
|||
|
this is just my hunch...
when you define your variable "spress" inside the first movieclip using the syntax 'var spress', the variable is only defined locally -- meaning it's only defined inside the movieclip. try removing the word 'var' from within and see what happens. or you can define the variable in the main timeline, instead of inside the mc's. I'm kinda tired (and lazy :P) to test it out, but I have a feeling that might be the issue. i'm so crappy at explaning things. Last edited by dkkz : August 15th, 2003 at 07:47 AM. |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Why the variable value shows undefined, plz help! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|