PDA

View Full Version : preload large image and autoscroll


jdulberg
01-13-2002, 04:30 AM
I'm pretty new to flash so please bear with me on this.

I am creating an image that is about 1000px wide by about 100px high so the filesize is going to be pretty large so I would need to preload it somehow.

My main issue is that once the image is loaded, I would like it to automatically start scrolling towards the left at a relatively slow speed. Then when it gets to the end, it should start scrolling from the beginning again. This big scrolling image would be in the center of the screen underneath a few other layers (images/text) - including text that is created using the really cool tutorial (http://www.actionscripts.org/tutorials/intermediate/animating_text_with_actionscript/index.shtml) from Actionscripts.org.

I have seen a bunch of panoramic tutorials around but they require mouse interaction - I just want it to scroll onload without checking the mouse position.

I'm assuming doing something like this is pretty simple - if anyone has any tips/code, please let me know.

Thanks :)

Jason.

Jesse
01-13-2002, 06:00 AM
See the Flash 5 Preloader tutorial and http://www.actionscripts.org/movies-results.php?searchTerm=%2Bcontinuous+%2Bloop

jdulberg
01-23-2002, 01:31 AM
I added the continuous image scroller code fromhere (http://www.actionscripts.org/showMovie.php?id=23) to my file and it loops but doesn't restart in the correct position.

I am using an image that is 1600x30. Once it scrolls to the end of the image, it leaves a huge blank space then starts again.

Is there a way keep it in 1 seamless, continuous motion - without the gap? It looks kindow weird how it is now.

Here's the frame action:

function movePiece (target) {
with (target) {
_x -= 10;
if (_x<-_width/2) {
_x = 400+_width/2;
}
}
}


And the object action:

onClipEvent (enterFrame) {
_root.movePiece(this);
}

Any help is greatlly appreciated :)

Jason.

Jesse
01-23-2002, 01:45 AM
You just have to adjust the 400 to match your movie width.

jdulberg
01-23-2002, 01:53 AM
That's the strange thing....

It's 400 in the actionscript and the movie is 400x400

Basically, I'm attempting to keep the image scrolling, window horizontally filled, with no gaps.

Would providing the .fla help?

Thanks.

Jesse
01-23-2002, 02:00 AM
Oh sorry, I thoguth your stage was 1600. OK post the fla.

jdulberg
01-23-2002, 04:43 AM
Thank you for helping me with this.

Here is the fla file

Jason.

Jesse
01-25-2002, 01:25 AM
a

Jesse
01-25-2002, 01:26 AM
bleh I screwed up, read below

Jesse
01-25-2002, 01:26 AM
Hmm this script isn't really made for that purpose. You can't get a single graphic to wrap, so I've achieved the effect you want using three copies of the graphic. I haven't changed any code, just added two more copies, but there's a little bug. I sgeest you either break the image into X smaller images and use my script or look for a different (more appropriate) script at www.flashkit.com/movies/ . Goo dluck.
Attached is the version I did. (The 'dumb' is in regard to the method I used, it's not a critisism :))

jdulberg
01-25-2002, 03:37 AM
I understand what you mean...

So it would be better if I split the image into 10 individual jpg's, convert 'em to symbols? I'm assuming that I add the action script to each of the jpg's that I put on the stage, correct?

Even though that way is a bit more work, perhaps it would be more efficient as the filesize would be smaller because the image doesn't need to be duplicated 3 times.

Thank you again for your time :)

Jason

jdulberg
01-26-2002, 11:02 PM
I just added all the individual images, converted them to movie clips and dropped 'em all on the stage. They rotate pretty much as expected but I'm now running into another problem.

After the first rotation, the images x position get somewhat displaced making gaps between some of the images. They should all be snapped to eachother.

I checked the actionscript for the movie's x dimensions and they are correct.

I tried to attach the .fla to this post but it wouldn't let me 'cuz its over 100K zipped (the fla is 119K).

So if you have any suggestions, please let me know.

Thanks for your help with this :)

Jason

Jesse
01-27-2002, 05:57 AM
Erg that's just abit of fine tuning. If all the images aren't the same width that coudl cause problems. Try and fix it yourself and if you can't email it to me (jesse@...kinda obvious) and I'll try and find time.

jdulberg
01-27-2002, 06:55 PM
I checked all the images and some of them were a bit off... so now they are all 150x100.

Unfortunately, they are still not looping correctly. One of the images is still be chopped and a couple of the images aren't even displayed after the first rotation... I checked to make sure all the actionscript is in place and its all there and the settings are correct (I think).

I just emailed you the fla file. Thank you for taking a look at it :D

Jason

Jesse
01-29-2002, 02:13 AM
Ah crap my post just got cut short. What I said was that you needed to center each image in its MC so that the _x and_width values came accorss right, I've done that and changed the code slightly. Can't post it here so I'll email it back to you.

jdulberg
01-29-2002, 04:35 AM
Thanks a TON for helping me out with this, it works perfectly now!!

I noticed that you added the following actionscript to the code:

if (_x<-300) {
_x = 8*_width-5;
}

Is the -5 the number of pixels that the images move to the left?

thanks again :D

Jason

Jesse
01-29-2002, 06:16 AM
Yeah I found that if it didn't include the -5 there was a gap. The gap turns out to be 5 pixels (the amount subtracted from the _x of the clip each time it moves), so if you change how far they move each frame, you'll need to change that too.

_sic
06-12-2002, 10:19 PM
could one of you guys please email me the final .fla? I´m trying to resolve the same issues and am having no luck

thanks

_sic

rustys27851
08-30-2007, 06:13 PM
Me as well, please. My images need to be different sizes and have transparency between them. rsegars@gmail.com