We help IT Professionals succeed at work.
Get Started

How do I control the x,y range using a symbol?

joannah00
joannah00 asked
on
291 Views
Last Modified: 2012-05-10
I have two buttons. The "Right" button each time it is clicked moves a tiny symbol (tinysquare2) to the right 5 pixels; the Left" button moves the symbol to the left 5 pixels.  I have been able to restrain it between two points (x axis: 252 and 347) but it jumps to the middle position once it reaches the furthest point instead of moving from that current position in the far right or far left. How to get it to move left from the furthest right position instead of it jumping to the middle then moving to the left?

Right Button:

on (press) {
if (VOL.text=="VOL"){
      turn2._alpha = 100;
      Turnknob2.text = "Right >";
      tinysquare2._x += 5;
};
if (tinysquare2._x >= 347.1) {
      tinysquare2._x = 347.1;
};
if (tinysquare2._x <= 252.2) {
      tinysquare2._x = 252.2;
      
};

}

Left Button:

on (press) {
if (VOL.text=="VOL"){
      turn2._alpha = 100;
      Turnknob2.text = "< Left";
      tinysquare2._x -= 5;
};
if (tinysquare2._x >= 347.1) {
      tinysquare2._x = 347.1;
      
};
if (tinysquare2._x <= 252.2) {
      tinysquare2._x = 252.2;
      
};

}
Comment
Watch Question
This problem has been solved!
Unlock 2 Answers and 9 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE