|
-
Continuous scroll with images loaded from xml file
Hello everybody,
I'm trying to figure out how to make a window which will scroll images gathered from a xml file and auto scroll them continuously...any direction anyone can point to me, I've searched the boards and have not found anything that has given me the right solution.
It seems simple enough...I'm just not very handy with actionscript.
ANY hepl will be greatly appreciated.
-
FK'n_dog
have you tried searching the Movies section for - scroll images ?
http://www.flashkit.com/movies/
-
Thank you for the reply a_modified_dog.
Yes I have searched the movies section but I have not found one that will scroll continuoisly and has images loaded by means of an xml file.
-
FK'n_dog
1 - load the xml file with your xml object
2 - within the xml.onLoad add all image names to an array
--- arr1=["1.jpg","two.jpg","3.jpg","four.jpg","5.jpg"];
3 - when the array is complete, run a function to load the first image in the array
--- when the loaded image has reached its x position endpoint
--- load the next image in the array. when you reach the end
--- of the array, return to the start point (arr[0]) and repeat.
PHP Code:
folderpath = "imgs/"; // assuming all images are in folder - imgs
count = 0;
speed = 50; // speed at which setInterval will run
tgt = this; // make a reference to the main timeline
function make(clip,num){
ref = tgt.createEmptyMovieClip("mover",1);
ref1 = ref.createEmptyMovieClip("loader",2);
ref1.loadMovie(folderpath+clip);
int1 = setInterval(mover,speed,ref1);
};
function mover(clip){
if(clip._x>285){ // assuming x position endpoint is 285
clearInterval(int1); // when x position is reached, clear the interval
count!=arr1.length-1 ? count++ : count = 0; // if array endpoint, then start again
make(arr1[count],count); // run the next load/move sequence
}else{
clip._x+=2; // adjust to suit
}
};
make(arr1[0],0); // initiate
hth
-
Thank you once again a_modified_dog, your prompt responses are very appreciated.
I will play around with this, thank you once again for your help.
-
I am trying to do something similar, however, I'd like the images to be right next to each other and never have blank space before the first image starts scrolling through again. Basically, I want a constant scroll where one image is making its way off the screen while the next image is making its way onto the screen, as opposed to an image scrolling and completely leaving, and then the next image appearing and starting to scroll.
Every tutorial I've seen has a set image width, so it knows where to put each one next to the other (if every image is 100px, then put the first one at _x 0, the 2nd at _x 100, the 3rd at _x 200, etc.) I'm throwing a monkey wrench in, where all the images are different widths - one may be 100px wide, and another may be 300px wide.
Unless there's a better way to go about it, I'm thinking I need to load my XML file that has all the image paths, then load each image into a movie clip, finding out the width of each one as I go (save that in another array??), and then developing my main image movie clip to hold each one next to the other, as well as a mask for the scroll. I'm not sure if AS (I'm using AS2 btw) has a better way of going about this.
Any help would be very much appreciated, as I've spent a great part of all of last week trying to figure this out.
Thanks!
Tags for this Thread
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
|