I need a little help…Okay I have a flash movie the canvas is 440x200. Okay I have a graphic which is 880x200 and is centered vertically and horizantally. So some of the movie is off stage. Now what I am trying to make happen is when the mouse is on the left side of movie the movie will move to the right revealing the rest of the movie which is not shown because it is off stage. Likewise if you mouse over the right side the image will move to the left revealing the off stage content. The catch is I do not want it to go beyond the length of the movie. I have spent way too much time trying to get this one. Could someone help me please. Actionscript is really hard for me…Dont know why:q:
I’m not sure excatly what you are trying to do but:
this.onMouseMove=funtion(){
picture._x =_xmouse;
}
???
As an add on (make your image a movie clip)
onClipEvent(mouseMove) {
this._x =_xmouse;
if (this._x >= howFarYouWantToGoRight) {
this._x = howFarYouWantToGoRIght;
}
if (this._x <= howFarYouWantToGoLeft) {
this._x = howFarYouWantToGoLeft;
}
}
As an add on (make your image a movie clip)
Do I add your code to Rynoes??
Use lost’s code and change the howFarYouWantToGo to the correct numbers
Oh yeah forgot to mention. I was trying to get it to slide to the appropriate side. As an added bonus I would like for it to slide back in its original place when the mouse is no longer there.
By the way lost your code worked, but I forgot to be more clear on what I was after.
Hey Rynoe you need me to explain in greater detail??
Well if I am thinking correctly and your image takes up the whole stage, there is no way to detect if the mouse is off or not. Even hitTest won’t work :-\
I might be overlooking something though.
onClipEvent(mouseMove) {
position=(_xmouse-440)*-1;
this._x = position;
}
since 880 is exactly twice 440
Okay hhhmmmm… Basically I need to detect if the mouse is on the left or right side of the movie. Image a vertical line going though the horizantal middle f the movie. If the mouse is on the left side of that line slide the movie to the right, If it is on the right side of the line slide my movie to the left. I can picture what I want to happen but I cannot code it. ANd if the mouse is not in the movie at all return it to the middle of the stage.
Oh yeah thanks for the help thus far… I will give credit to you on this little proj…or whoever helps
But see, that is the thing. The clip takes up the whole stage, so by the time your mouse is off the clip it is out of the movie, so it won’t be able to be set to go back to the original spot.
You could probably use hitTest to determine if the _xmouse is within a certain contained area.
ok
onClipEvent(mouseMove) {
if (_xmouse >300) {
this._x = 0;
}
else if(_xmouse<200){
this._x = 440;
else{
this._x=220;
}
}
200 and 300 are estimates
is this what you are looking for?
I came up with this…
onClipEvent(mouseMove) {
if (_root._xmouse<=90 && _root._xmouse>=540 && _root._ymouse<=390 && _root._ymouse>=10) {
trace("in");
} else {
trace("out");
}
};
The above script assumes your movie is 550x400 and sets up a 10px border around your whole movie. If your mouse is inside that border it will trace “in” and if it is outside that border it will trace “out”.
Hey lost and rynoe they both did not work. I think maybe my explanation is not good. I dont know how to explain it better. I can visualize it but I cannot program it.
I tested this and it works for me… I think it might be messing up because of furum so notepad below
Okay rynoe that worked thanks man. And I actually understand the code. Now I am trying to control the speed at which the movie shifts any ideas?
I KNEW you were gonna ask me that!!!
yes I have ideas…
But lostinbeta really has the bead on that one.
It’s a math thing check this for an example.
But I am really glad I could help!
You could use the easing formula…
http://www.kirupa.com/developer/mx/followease.asp
(if I am understanding correctly)
I have come to the realization I suck at AS. I have spent the whole day on this simple thing and cannot get it. I think I am gonna give up on it. I am just not getting it. I really hate to keep leanin on folks for knowledge. If one of you have a .fla I can study that would be cool. (or cut and paste)
bump…i still need help…pleez…
assuming you’re image is inside an mc and the registry point is at the middle of the image:
_root.onEnterFrame = function () {
if (_root._xmouse < 220) {
if (_root.imageInstanceName._x < 400) {
_root.imageInstanceName._x += 2
}
} else if (_root._xmouse > 220) {
if (_root.imageInstanceName._x > 40) {
_root.imageInstanceName._x -= 2
}
}
}
[size=1][ EDIT ][/size]
forgot the fla