Link to home
Start Free TrialLog in
Avatar of squirtle98
squirtle98Flag for United States of America

asked on

Horizontal Scrolling Flash Movie

Hi- I have been working to learn Flash, and I recently started looking for a tutorial on how to create an "endless" scrolling gallery of images. It doesn't need to be interactive, just scroll slowly through the images, and then repeat without seeming to end. The closest thing I found was a tutorial that scrolled depending on where the mouse was in reference to a certain point on the movie. http://www.kirupa.com/developer/mx/infinite.htm
Is there a way to modify this so that it will scroll "endlessly" on its own?
Avatar of Zeffer
Zeffer
Flag of New Zealand image

replace the code on the instance of ..menu_general.. movieclip with this..

onClipEvent (load){
   speed=1/75;  //bigger number to slow it down..smaller to speed it up
}
onClipEvent (enterFrame){
   var distance=100;
   _x+=(distance*speed);
   if (_x > 0) _x=-300;
   if (_x < -300) _x=0;
}

Z
Avatar of Aneesh Chopra
I have done a similar sample sometime in past,
please download it here....
http://www.4shared.com/file/2088414/50cc10a4/moving_pictures_tutorial.html

images stacks one after another horizontally and moving right to left slowly....
It takes images dynamically, all code is on first frame.....

just set following two variables to control speed and images...
------------
//defined images here, as many as you want....
var img_arr = ["image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg"];
//set speed using this....
speed = 3;
---------------
Aneesh Dude.. the question was..

>>Is there a way to modify this so that it will scroll "endlessly" on its own?<<

You are not addressing the question.

Kind Regards
Zeffer
Hi Zeffer,

with due respect,
I agree that your suggested code in first comment will be sufficient to modify the mentioned movie to scroll endlessly.
but mentioned movie does not show images,

I actually had a ready version of endlessly scrolling image gallery, hence I just wanted to make it available for the author, if it helps in any way.
eventually Author's final requirement is to have solution which  scroll images horizontal.
Yes we all have.. 'versions ready'.. I was just endevering to answer the question.

Z
Avatar of squirtle98

ASKER

Zeffer -
What modification would I need to make to my image file to keep the end of the movie from showing...does that make sense? So that the movie doesn't have an ending? Do I need to make the image larger? I have uploaded it so you can see what it is doing...
G:\Star\Star_E_Olson ONLINE\Elizabeth Rim\Website\index2.htm
See how it kind of...blinks...and starts over? Is there a way to make the images seem endless - like they just keep scrolling instead of starting over?
Not sure what you mean..I tried the code and there is a continuous seamless scroll.
That url you have given is for a local machine not the web.
That tutorial has room for only 5 images..and is based on the size of the stage to give the  seamless movement..this code here..
if (_x > 0) _x=-300;
if (_x < -300) _x=0;

if you have added more images you need to change the width of the stage to accommodate the extra images..eg..at the moment each image is 60 pixels wide if you added 2 more then the stage would need to be 420 wide and the code would need to be changed to..

if (_x > 0) _x=-420;
if (_x < -420) _x=0;

Z

http://www.newhinesvillehome.com/index2.htm

Sorry- this is the actual address - does this help explain what I mean?
http://www.pixelhivedesign.com/tutorials/Endless+Scrolling+Background/
This is what I am aiming for - see how it never seems to end? It never blinks back to the beginning...you can't tell when it starts over. I have tried to use this tutorial as well, with no luck...
ASKER CERTIFIED SOLUTION
Avatar of Zeffer
Zeffer
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, I have one more question in regards to this movie - I got it to work once, and now I can't get it to scroll again. I get 2 errors, and it doesn't move when I preview publish it... Did I mess up the code somewhere? I tried to upload the file so you could see it, but it isn't an allowed extension...here is the internet location...

http://www.newhinesvillehome.com/index2.htm
just looked at your web page and the scrolling is working fine..
you may be looking at a cached version so clear out your temp files.
if you still have problems you can post the file here..just give it a .txt extension..eg..
myMovie.fla.txt

Z
Ah! You are correct...YAY!  
Does this file translate as easily into the same thing except vertical? And is it possible to click on the movie and go to another .html page?

onClipEvent (load){
   speed=1/100;  }
onClipEvent (enterFrame){
   var distance=100;
   _y+=(distance*speed);
   if (_y > 0) _x=-1469;      //120x6  
   if (_y < -1469) _x=0;      //same
}
yes it will go vertically and to make it clickable put a hotspot button over the top of all the images inside the swf..a hotspot button just has the HIT area defined and appears as a turquoise shape in authoring so you can position it..it turns invisible when the swf is run

Z