Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a numerical file name 1

Status
Not open for further replies.

EricAndresen0

Programmer
Jul 30, 2003
15
0
0
US
I am using the .loadMovie() command to load JPEGs into a Flash slideshow. The JPEGs are pictures labeled with numbers (#.jpg) and they are located in the same folder as the Flash file. It is working fine if I type

this.loadMovie("1.jpg")

but I want to be able to use a variable to load the other pictures, and I am not sure how to do this. I would greatly appreciate any help.
 
lots of ways to do this

do you want them all loaded at once or like a slideshow at intervals or a new one loaded by clicking a button

it may well work with names like 1.jpg, 2.jpg etc but its better if they are named image0.jpg, image1.jpg and so on
 
I want them to load all at once so that I can scroll them across the screen. I can name them whatever I need to, but I don't know how to concatenate or to get it to recognize my variable as a part of the file name. I am confused...
 
for(var i=1;i<10;i++)
this.loadMovie(i +&quot;.jpg&quot;)


adding that to the frame actions will dump jpgs named 1 to 9 onto the stage

will be untidy though
 
Do you know if there is any way to do some sort of error-checking code or something to allow me to add code that executes when a picture cannot be loaded. I want to be able to make a slide show that lets me swap pictures and vary the number of pictures that I use without having to change the code.
 
sounds like what you want to do is read a directory and see how many images there are

the image names could then be loaded into an array and flash would know how many pics are in the slideshow by getting the array.length

this way you can add and remove pics at will from the directory (/images ?) and have them called anything you like...no need for sequential numbering


needs a server side script though. i can help if you have php
 
just ask your server people if they support php

php is a server side scripting language
 
ok now this will only work when placed on the internet...cant be properly tested in authoring mode


make sure that you only place images in the directory named examples as flash will try to load anything it finds in that directory

just place all your images in that folder. they can be added to and removed whenever you want and can have any name

this just allows you to load the files via a button
 
Hi again. One more question. The way taht you suggested works fine on the internet, but I am trying to do one know for offline use. I have it working fairly well, except that there is slight blink while the picture loads while the movie is playing. I was planning to fix this by loading all of the JPEGs into the library and then swapping them on the fly, but is there even a way to do this? Can you swap movie clips and bitmaps in the way that you would with the little &quot;Swap&quot; button on the properties menu while the movie is playing?

 
sure if they are in the library you get swap them in and out using attachMovie instead of loadmovie
 
Oh, cool, thanks. That worked perfectly. My slide show is now working. :) Thanks for all the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top