Flash Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignFlash Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old August 15th, 2003, 01:37 AM
SBUH SBUH is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 18 SBUH User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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 !

Reply With Quote
  #2  
Old September 30th, 2003, 01:13 AM
zeflasher zeflasher is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: New Caledonia
Posts: 7 zeflasher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to zeflasher
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:
 yourMC1.onRelease = function () {
spress=1;
}

yourMC2.onRelease = function () {
spress=2;



Cu mate...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignFlash Development > Why the variable value shows undefined, plz help!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway