-
FK's Official War Driver
You know how there are basic HTML pages that contain thumbnails of images? Well, I would like to do one in Flash. Say I have a Flash page with multiple "boxes" named occordinally box"1-18". Basically, I just want to be able to drop images into my images folder, and Flash will automatically detect them and add them into the slots. If there are no images, it will remain blank. Anyone have a good start on this?
-
FK's Official War Driver
Okay, here is some code i've been expirementing with...
On my screen, I have 24 boxes with instance names box1, box2, etc...
Code:
i = 1;
for (i; i<25; i++) {
loadMovieNum("\"i\"+.jpg", "box+\"i\"");
trace(i);
}
It doesnt load any .jpgs
Hope that helps!
[Edited by wiReZ on 07-29-2002 at 06:13 PM]
-
Code:
directory = "photos/";
loadMovie(directory add MATH add ".jpg");
stop();
I think you need a directory set to load pictures from, and make sure they are numbers 1.jpg, 2.jpg, etc...give it a try, I'm not entirely sure (new to AS).
what version are you using? F5 can't load jpgs...you'd have to use a individual swf for each of them...mx can, hope you've got mx...
[edit]wait...this is the MX section...*slaps self*[/edit]
-
FK's Official War Driver
That's not the problem, thanks for trying though.
-
well, if you want a random image loader:
Code:
images = 25;
directory = "randimg/";
randomswf.loadMovie(directory add Math.ceil(Math.random()*images) add ".jpg");
stop();
that works. although its not really what your after...that's my first foray into AS. But, hey, maybe it'll give you an idea.
-
FK's Official War Driver
Hehe, not to sound rude or anything but I know what I want, I understand what your putting, but it does not help contribute toward anything I am doing. Sorry, thanks anyway though.
-
FK's Official War Driver
bump...
-
maybe?
Code:
image = "" + i + ".jpg"
target = "box" + i
target.loadMovie(image);
-
FK's Official War Driver
-
again, i'm not sure but...
inside the for loop...
Code:
number_of_images = 25
for (var i = 1; i < number_of_images; i++) {
image = "" + i + ".jpg"
target = "box" + i
target.loadMovie(image);
}
-
your images are named 1.jpg, 2.jpg, etc... right? boxes are box1, box2, etc... ?
-
FK's Official War Driver
-
Poof! Whaddya need?
You're so close!
I think it's just a minor syntax problem, really. You've done most of the work.
Your code is:
Code:
i = 1;
for (i; i<25; i++) {
loadMovieNum("\"i\"+.jpg", "box+\"i\"");
trace(i);
}
Try;
Code:
for (i=1; i<=25; ++i) {
loadMovie (i+".jpg", "box"+i);
}
-------------------------------------
Explanation: LoadMovieNum will try to load your JPEG to a level. You want to load to a target, so you just need loadMovie.
Your method of setting the counter i was a little off. Set its initial value in the "for" statement. And since you have 25 images, you don't want to stop at 24. The <= will make sure you catch the 25th one. Finally, I like to increment i before running the rest of the command. Would probably work either way, since I'm letting it continue when i reaches 25.
--------------------------------------
works fine for me.... let me know.
-
FK's Official War Driver
Ah it works! Thanks man! I noticed the LoadMovieNum problem a few minutes ago. And actually, it only goes to 24 images. Works like a charm otherwise. Now the next step. I want the image to load only in the area given by the MC. So, I dont want it to overlap. Is that somewhat possible?
-
Poof! Whaddya need?
scale before or after
The easiest thing to do, of course, is to make your jpeg the right size to begin with.
But of course, there's a hard way too!
Do this:
Code:
box1._x=200;
box1._y=200;
or
Code:
box1._xscale=50;
box1._yscale=50;
The first is used to set an absolute size in pixels, the second allows you to scale by percent. You'd put either one of these methods after the AS that imports the images.
Cool?
--Rissa
-
FK's Official War Driver
Okay, sounds great, now another "dilemma". Is there a way to detect if the image is not loaded, then spit out an MC saying "Movie Not Loaded"? Just a thought...
-
Poof! Whaddya need?
love a challenge
oooooh I just love a challenge...
Here ya go! So there!
Code:
for (i=1; i<=24; ++i) {
loadMovie (i+".jpg", "box"+i);
if (this[i+".jpg"].onLoad(true)) {
trace ("loaded"); // my test: put whatever
} else {
trace (i+"failed"); // ditto
};
}
--Rissa
-
FK's Official War Driver
Unfortunatly, that code does not work. It always outputs the images as if they failed, even though they are loaded. But it's no biggie, It wasn't necessary, thanks for all your help though, greatly appreciated.
-
Poof! Whaddya need?
sorry, my bad
Hey wiReZ
That's what I get for trying to do something at quitting time on the day before a day off!
I must've had the output window too small -- as soon as I saw that the last image had failed to load, I thought I'd solved it.
I've tried a few more ideas, but haven't gotten there so far. It's a good idea, though, so I may try again a little later. If I come up with something, I'll let you know.
--Rissa
-
Senior Member
Have you checked the tutorial the ultimate slideshow MX under dynamic content on the flashkit site?
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
|