This is a discussion on "variable problems..." within the Flash & Multimedia Forum section. This forum, and the thread "variable problems... are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
variable problems...
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
variable problems...
Hello all,
I am having a variable problem that looks fine to me, but doens't seem to work, here is my script: var barrypoints; var barrytotal; var barrypercent; var barrytotal = 100-barrypoints; if (_root.barrypoints>_root.barrytotal) { _root.barrypercent = 100; } else { _root.barrypercent = Math.round((_root.barrypoints/_root.barrytotal)*100); } barrypoints starting value is 0, and i have a button that will add 1 to barrypoints when pressed. i have a dynamic textbox that displays the value of barrypercent, but when you press the button repeatedly, barrypercent will increase, but it doesn't seem to stop at 100, it just keeps growing past it. did i screw something up? this should be really easy, right? |
|
|
|
|||
|
Re: variable problems...
ok nevermind, I got it.
Are variables in flash case-sensitive? that seems to be the only thing i changed... |
|
||||
|
Re: variable problems...
Yes, ActionScript 2.0 is case-sensitive. Not sure about 1.0 but I can check if you want me too.
|
|
|||
|
Re: variable problems...
No need to check on that, thanks though.
I've made much progress on this project after that little bump, but now I am having another variable problem. I have a script that affects a variable relevant to a specific movie clip, but now I am trying to figure out how to get that same script to affect different movie clips, depending on which button you press. I'll copy and paste what the gist of it is... on (release) { if (_root.interaction="BARRY") { _root.friendPercent = _root.barryPercent; } else if (_root.interaction="DREW") { _root.friendPercent = _root.drewPercent; if (_root.friendPercent>=50) { _root.friendPercent = (_root.friendPercent+0.125); } else { } ...then there is a bunch of if then statements in regard to the value of friendPercent. at the end of the script, I have this code: // re-distribution tree on (release) { if (_root.interaction="BARRY") { _root.barryPercent = _root.friendPercent; } else if (_root.interaction="DREW") { _root.drewPercent = _root.friendPercent; } } which should reapply the value of friendPercent back to barryPercent or drewPercent, right? it doesn't seem to work though...basically I could work it out if I just wrote the same code 10 times over and change the name of the variable, but I wouuld think there is some way to have one "universal" variable that I can switch back and forth to. make sense? I've had my head wrapped around this one for a a few days and it's getting kind of frustrating. |
![]() |
| Tags |
| flash, actionscript case sensitive, flash variables, variable problem |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| variable classes | CloudedVision | PHP Forum | 4 | Feb 14th, 2008 03:07 |
| [SOLVED] PHP variable handling problems | DerrickE | PHP Forum | 5 | Oct 15th, 2007 22:10 |
| is this variable right? | geyids | PHP Forum | 4 | Aug 6th, 2007 21:45 |
| Variable help for a newbie? | phpnoob | PHP Forum | 3 | Nov 27th, 2006 21:14 |
| Variable into an Array | JamieH | PHP Forum | 1 | Sep 6th, 2006 14:43 |