variable problems...

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.



Go Back   Webforumz.com > Main Forums > Design Your Website > Flash & Multimedia Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 9th, 2006, 22:49
New Member
Join Date: Sep 2006
Location: chicago
Age: 25
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
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?
Reply With Quote

  #2 (permalink)  
Old Sep 9th, 2006, 23:21
New Member
Join Date: Sep 2006
Location: chicago
Age: 25
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: variable problems...

ok nevermind, I got it.

Are variables in flash case-sensitive?

that seems to be the only thing i changed...
Reply With Quote
  #3 (permalink)  
Old Sep 10th, 2006, 04:12
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Re: variable problems...

Yes, ActionScript 2.0 is case-sensitive. Not sure about 1.0 but I can check if you want me too.
Reply With Quote
  #4 (permalink)  
Old Sep 12th, 2006, 21:07
New Member
Join Date: Sep 2006
Location: chicago
Age: 25
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote
  #5 (permalink)  
Old Sep 13th, 2006, 13:01
JacobHaug's Avatar
SuperMember

SuperMember
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to JacobHaug Send a message via MSN to JacobHaug
Re: variable problems...

Have you checked the ActionScript dictionary yet? That is where I find most of my solutions. If you still can't find it let me know.
Reply With Quote
Reply

Tags
flash, actionscript case sensitive, flash variables, variable problem

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 20:07.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43