-
Senior Member
Stay scrolling when down
I have been trying to get my head round scrolling and am not quite there (a bit of an understatement). I have managed to get a button to move and object left and another to move it right. However it only moves the object every time I click, I want to be able to keep the object moving if I keep the mouse down, also is there a code that makes the object look more like it's moving instead of jumping?????
on (press) {
mouse_x = _xmouse;
setProperty (_root.follow, _x, mouse_x+((getProperty(_root.follow,_x)-mouse_x)+10));
}
on (press) {
mouse_x = _xmouse;
setProperty (_root.follow, _x, mouse_x+((getProperty(_root.follow,_x)-mouse_x)-10));
}
-
Senior Member
Hi.....
If you post the fla. in MX format....i might be able to help.
-
Senior Member
Here you go
-
Senior Member
scroll prob
Hi littlematt....
Here is one way..... two variables...
moveleft... and.... moveright.... which are initialized on the keyframe to control the movement of the 'followMC' .....if their values are switched from false to true then movement occurs...
then a statement that says 'if they go beyond this point, change the variable back to false.....'
So this goes on the keyframe....
code: moveright = false;//variable
moveleft = false;//variable
follow.onEnterFrame = function() {
if (_root.moveright == true) {
this._x += 5;//speed of movement right
if (this._x>550) {//this stops movie going further 550 right
_root.moveright = false;
}
}
if (_root.moveleft == true) {
this._x -= 5;//speed of movement left
if (this._x<100) {//this stops movie going further than 100 left
_root.moveleft = false;
}
};
}
Then to control the variables value ....place this on the left button
code: on (press) {
_root.moveleft = true;
}
on (release) {
_root.moveleft = false;
}
then this on the right one...
code: on (press) {
_root.moveright = true;
}
on (release) {
_root.moveright = false;
}
and that should do the trick!...here is an update of your fla. to demonstrate.....edit the parameters to suit your project.....
hope this helps
hum
-
Senior Member
Nice one! cheers mate
-
Senior Member
Is there a way of stopping the buttons (when clicked again) from moving the mc when it reaches the end of the image?
Last edited by littleMatt; 06-14-2004 at 09:04 AM.
-
Senior Member
how do you mean ....when it reaches the end of the image......
do you mean when it reaches the edge of stage?
-
Senior Member
When it it gets to the end of the image.
-
Senior Member
sorry....not sure what you mean....you have 2 buttons and a small MC with the words 'text'in the fla.....i don't see an image......
Can you explain in more detail.....
-
Senior Member
Sorry, that is the old test file, I have taken that file and placed a long image in the follow mc. The image is 3096px long. I have set the amount so that it can move 4000 pixels each way
if (this._x>4000) {
if (this._y>4000) {
Even when I set it to 3096 each way it keeps scrolling past the end of the image.
I would upload the fla but IE wont let me and my Safari no longer likes flashkit...
Last edited by littleMatt; 06-15-2004 at 11:59 AM.
-
Senior Member
Hi littleMatt....
ok....the length of your image is not 3096 it is 309.6
so you need to put 400 instead of 4000.
code: moveright = false;//variable
moveleft = false;//variable
follow.onEnterFrame = function() {
if (_root.moveright == true) {
this._x += 5;//speed of movement right
if (this._x>400) {//this stops movie going further 550 right
_root.moveright = false;
}
}
if (_root.moveleft == true) {
this._x -= 5;//speed of movement left
if (this._x<400) {//this stops movie going further than 100 left
_root.moveleft = false;
}
};
}
Try that......
-
Senior Member
It doesn't want to move to the right with the < in:
if (this._x<400)
If I change it to > it scrolls but still past the end of the image.
-
Senior Member
-
Senior Member
hi little matt...
can you save it in MX format .....not MX2004......then post the fla.
i have MX......
-
Senior Member
Sorry I keep doing that
-
Senior Member
Try again......that is still mx2004 format.....
There is an option that enables you to save as MX
-
Senior Member
-
Senior Member
ooops....still not working....
a few people have this prob.......check the save as ...then format tab
-
Senior Member
That's what I've been doing
Shall I ftp and post a link?
-
Senior Member
tell you what.....iv'e just got to finish helping someone else then i'll make an image 309.6 on the original fla. you sent... and fix the code so it doesn't scroll off stage.....i don't understand why the fla. you are trying to post doesn't work.....aah well.....i'll post a little later...hang in there!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|