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.
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?
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.
_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
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
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.