Groups | Blog | Home
all groups > flash actionscript > july 2004 >

flash actionscript : A noobie Q about mouse controled picture moving.


Big_Gulp
7/10/2004 8:48:34 PM
Below is the code I use to move a picture Movie Clip and the code works fine.
If my mouse is on the right half of my stage, the picture will move to the left
and vise versa.

But my problem is that the movie clip will keep going outside of my stage. Is
there anyway to control it so that the Movie Clip will always stay inside the
stage?

By the way, the code is inside a frame.
----------------------------------------------------------
onEnterFrame = function()
{
xdiff = _root._xmouse-275;
pic._x -= xdiff/20;
}
kit_hoffman
7/10/2004 9:19:47 PM
if(pic._x+pic._width>=Stage.width){
pic._x = Stage.width+pic._width;
}else if(pic._x <=0){
pic._x = 0;
AddThis Social Bookmark Button