|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#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
|
|||
|
|||
|
First of all:
var myVar; will make your var local. And you don't want it.. (so delete this "var" before) Second try to code this way. Eg, you are on the _root, the _root holding your 2 mc. On the _root code layer: PHP Code:
Cu mate... |
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Flash Development > Why the variable value shows undefined, plz help! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|