-
Matching Variables question
hi, I'm trying to get a dynamic text box to stop going higher when it reaches a number defined by another dynamic text box, ex. text box 1 starts at Zero, and text box 2 starts at 25, whenever you click a button, text box 1 goes higher, but can't go higher than text box 2.
This is the code I have that doesn't seem to be working:
if(_root.A >= _root.B);{
_root.A == _root.B;
}
Thanks in advance
-
.
Hi,
Try
PHP Code:
if (_root.A >= _root.B) {_root.A = _root.B;}
-
that hasn't worked, sorry :\ No error or anything, it just keeps going up
-
.
Hi,
attach your file or link to it, perhaps post your full code
-
variables.fla
This is the file
-
.
Hi,
Simple, for your coding practices as well do this,
remove the code off of the button , give the button an instance name of "button" no quotes.
and put this under your A and B variables on the timeline;
PHP Code:
var A:Number = 0;
var B:Number = 25;
button.onRelease = function()
{
_root.A += 5;
if (_root.A >= _root.B)
{
_root.A = _root.B;
}
};
or if you want to do it the button method put this on the button itself and remove the if statement from the timeline
PHP Code:
on (release) {
_root.A += 5;
if (_root.A >= _root.B)
{
_root.A = _root.B;
}
}
-
thanks, It's always something stupidly simple like that
-
That is a nice start to it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|