# Another object control question

**URL:** <https://forum.kirupa.com/t/another-object-control-question/891>\
**Category:** Uncategorized\
**Created:** [August 1, 2002, 7:25pm UTC](https://forum.kirupa.com/t/another-object-control-question/891 "2002-08-01T19:25:19Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuga](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@shuga](https://forum.kirupa.com/u/shuga)\
**Post date:** [August 1, 2002, 7:25pm UTC](https://forum.kirupa.com/t/another-object-control-question/891/1 "2002-08-01T19:25:19Z")

</div>

i have remade the file and now i am trying to set the limits so the user can zoom in once and zoom out once from the center … that is to say i want the scale values to start at 100 and drop to 50 or raise to 150. b/c i don’t want it to get too big or too small.

i don’t think i understand how the player calculates \_xscale and \_yscale and i think i have the \> or \< facing the wrong way.

can someone please help 🙂

thx so much

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 2, 2002, 2:55pm UTC](https://forum.kirupa.com/t/another-object-control-question/891/2 "2002-08-02T14:55:39Z")

</div>

I tried rescripting some of your code, tell me if you like and if you want more help. I attached a new file to this post, download it a check it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 3, 2002, 7:33pm UTC](https://forum.kirupa.com/t/another-object-control-question/891/3 "2002-08-03T19:33:09Z")

</div>

you da man … omgosh i love this forum

k now that thats working i am wondering about the boundaries i have set in the movie. currently when the centerpoint of the symbol blue reaches the bounds it stops. to make it look like it stays within the bounds all the time i could move the bounds further inward and move the line out so the boundaries were not actually where the visible blue line is. but is there a way to do that in code so that the \_x boundary is at 300 and the line is at 300 as well and the edge of the symbol stops at 300 rather than the center of the symbol?

thx very much

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 3, 2002, 9:40pm UTC](https://forum.kirupa.com/t/another-object-control-question/891/4 "2002-08-03T21:40:37Z")

</div>

take out the \_width of your object in your test.

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2002, 2:23am UTC](https://forum.kirupa.com/t/another-object-control-question/891/5 "2002-08-04T02:23:53Z")

</div>

Well you first off might want to try by changing the center of the movieclip to the outside of the movieclip. Then just try adding and modifing the code that I gave you to accompanie your specified numbers.

Hope this helps

Kyle

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2002, 3:03am UTC](https://forum.kirupa.com/t/another-object-control-question/891/6 "2002-08-04T03:03:36Z")

</div>

pom … there is no \_width defined in my object. i don’t understand.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2002, 10:26am UTC](https://forum.kirupa.com/t/another-object-control-question/891/7 "2002-08-04T10:26:15Z")

</div>

\_width and \_height are properties of your movie clip. You don’t have to calculate them or anything. They refer (of course) to the width and the heigth of the movie clip.

Now imagine that we want the ball to go up until its top gets to the limit. For the moment, the code is

```auto
on (press, keyPress "<Up>") {
	if (blue._y>100) blue._y -= 10;
}

```

This means that when the center of the movie clip (the center of the ball) gets to the \_y 100, you can’t move it up. But in fact, we want to move it up until **its top** reaches this position. So we have to calculate the position of the top of the clip.

Now if the clip is centered, the top will be half the height of the movie clip higher than the center, right? That’s why the code has to become

```auto
on (press, keyPress "<Up>") {
	if (blue._y>100 **+blue._height/2** ) {
		blue._y -= 10;
	}
}

```

You can do the exact same left and right with the \_width property.

Notice that the little green circle makes this whole thing fail, because the clip is no longer centered.

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2002, 1:23pm UTC](https://forum.kirupa.com/t/another-object-control-question/891/8 "2002-08-04T13:23:40Z")

</div>

thanks so much pom for your patience … i’m glad you’re so good at explaining this stuff … i understand !!

yeah!!

yeah … i understand about the lil green ball …i put that on there so it would be easy to see the rotate funcion i put in there.

thx again for all your help

[update]  
i put the code into the fla

on (press, keyPress “\<Down\>”) {  
if (blue.\_y\>300-blue.\_height/2) {  
blue.\_y += 10;  
}  
}

up and left work … but right and down don’t  
i checked my pluses and minuses … they look correct to me … i don’t understand what’s going on

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2002, 1:39pm UTC](https://forum.kirupa.com/t/another-object-control-question/891/9 "2002-08-04T13:39:00Z")

</div>

heres the file as it is currently with the code i’ve inserted

thx

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2002, 5:10pm UTC](https://forum.kirupa.com/t/another-object-control-question/891/10 "2002-08-04T17:10:44Z")

</div>

That’s not the good fla, shuga.

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2002, 1:18am UTC](https://forum.kirupa.com/t/another-object-control-question/891/11 "2002-08-06T01:18:30Z")

</div>

i got it to work. i had the \> and the \< switched the wrong way on the bottom and left buttons. thx very much for all of your help
