load jpg in MX
- Started
- Last post
- 13 Responses
- CX
Someone asked me this. I havent done it. Loading jpgs in flash dynamically with a forward/back nav. There only 9 so when it gets to 10 theres an error.
How can Flash know how many files you have dynamically?
- unfittoprint0
//create some empty mc
//create a variable likecount=1
//create an array for each jpg
my array = new array("1.jpg","2.jpg" etc...)
//and for each click -
if (count >1){
count=--count
mc.loadmovie(myarray[count])
}//and for each click +
if (count <9){
count=++count
mc.loadmovie(myarray[count])
}
- unfittoprint0
i may have forgotten some stuff, but with some tweaking it should work....
- blindpilot0
if you load the images into a mc, then get the size of the clip after advancing the image number [1.jpg, 2.jpg,...]
if the sixe <2 * 2, [no image], then ...
this does work quite nicely, i have just done the same thing for myself, if you want the fla, email me and you shall have it when i get into work
- CX0
thanks blindpilot Ill email you.
unfit, correct me if Im wrong but by putting the 1 and the 9 there does it make it less dynamic? Im thinking of dumping any number of jpgs into a folder and Flash would know how many are in there and adjust itself back to one accordingly when you come to the end.
- unfittoprint0
only with server side scripting is possible to know how many files are in a certain folder, you can't do that within flas. COnstructiong a database PHP driven, you could upload images to a certain folder and send a variable with a list of those files to Flash, for it to know its location, name or even dimension.
- unformatted0
why not use xml and flash then?
- unknown0
"Im thinking of dumping any number of jpgs into a folder and Flash would know how many are in there and adjust itself back to one accordingly when you come to the end. "
i'm trying to do the same... i finally want to make a flash site wich i can easily update... this xml, is completely new to me... but seems very interesting.
any links... fla with xml script?
- unknown0
thanks!
- Cadillac0
An XML-based solution would require you to update the XML file every time you dump movies in a folder. A better choice would be to use PHP, ASP, or Perl (depending on your server) to create a very simple directory reader and print the paths to flash.
You would then have flash create a new instance of a movie clip for every filename passed, loading the appropriate JPEGs designated by the filenames passed.
- blend0
I was thinking of doing dynamic loader of my own as well. My plan was to pass the number of items as a parameter in the html object tag. Not maybe what you're looking for, but I think it will be work for me. I want to encorporate as small amount of flash on my sites as possible, but still use it to my advantage.
- aplus0
Some good info in this thread.
Related Question:
When I load a jpg into a mc and then try to animate that mc inside a parent, the parent animation stops onLoad.
Any idea why?Cheers.
- miracola0
Check out http://www.swift-tools.com
for Swift Generator
it might help you as well.