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

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > 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