A scroll effect

Hi

I need to create a sideways scroll effect, ideally using only actionscript, but to keep it simple I essentially need to be able to click and hold down a button and have another MC move, a progressive movement as opposed to an abrupt change from point A to B. I can’t use motion tweening animation between frames it has to be done with code…

Can this be done?

Thanks

Not unless you make loads of little “abrupt changes” till it gets where you want it!

:-/ … doh I’ll have to think of something thanks anyway

it can be done without too much trouble.

care to elaborate? :slight_smile:

do you have a fla? What you can do it set up a button to create an onEnterFrame handler for your movie clip that will move it a few pixels at a time. This will end up looking like motion. Then, you set it up to delete the onEnterFrame handler when they let go of the button, stopping the motion. I posted something like this a couple days ago let me see if i can find it.

I do have an fla but it’s like 600kb, this is just a tiny feature in my fla

I just need to create motion without a timeline basically i.e click a button and have an object move

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=33248

what i meant was that you can move something onEnterFrame little by little until it gets where u want it to be!!!

this.onEnterFrame = function(){
if( myClip._x+5 < myLimit){
myClip._x +=5;
}
}

There are much better ways of doing it (easing with physics, etc)
but this is the basic thing you need

SHO

oh haha. ok eki. I thought you were saying it couldnt be done without changing a bunch of things. Now that I read your post again, it makes sense.

Cool that is very near to the effect i wish to achieve, 1 last thing

Is it possible to have it so that it only scrolls when the user holds the button down? as opposed to a rollover…

flash MX only has a press event :-/

oh yeah.
[AS]
on (press){
this.onEnterFrame = function(){
if(targetMovie._x < moviesXLimit) targetMovie._x+=5;
}
}
on (release){
delete this.onEnterFrame;
}
[/AS]

should do it. you can use the on press event coupled with onEnterFrame to make a scrollbar type effect.

Where’s your mouse button when you press?

?

*Originally posted by grandsp5 *
**? **

Is it possible to have it so that it only scrolls when the user holds the button down? as opposed to a rollover…

flash MX only has a press event :-/

Where’s your mouse button when you press?

SHO

Thanks grandsp5 that worked perfectly, I have never come across anything like
[AS]this.onEnterFrame = function(){
if(targetMovie._x < moviesXLimit) targetMovie._x+=5;
}
[/AS]

Is this new to FlashMX, do you know where i can learn more?

Thanks again :thumb:

The onEnterFrame handler is I believe a new thing. (I only started flash about a 2 and a half months ago so I’m not totally sure, I really only have experience with MX) Do some searching on the forums, I had a thread i posted about the onEnterFrame handler a while back. It basically runs a check at the framerate of the movie and executes the code. IE - that code would be executed 12 times a second if your fps is 12.

glad it worked for you :slight_smile:

Thanks will do