Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 12-14-2002, 09:16 PM   #1
utswim
Registered User
 
Join Date: Oct 2002
Location: New York
Posts: 15
Default loadVars()...?

Could someone please suggest the appropriate way to load pictures on a photo website from an external source, like a server? Loading a text file from the same folder as the .swf to a dynamic text box is one thing. I'm trying to figure out how to load images externally for a photo site so the entire .swf size isn't too prohibitive.

Thanks.
utswim is offline   Reply With Quote
Old 12-15-2002, 02:05 PM   #2
Ricod
(@_@) -("pretty lights")
 
Ricod's Avatar
 
Join Date: Sep 2001
Location: the Netherlands
Posts: 3,982
Default dynamically load in jpegs using textfiles

*note* you need MX for this

I can't test it for ya, but this is how it goes. From what I understood its the same as loading in swfs.

Use a naming convention for your photo's and make sure they're jpegs. Gifs etc won't work. You'll eed to put those in their own swfs then. For instnace, all your christmas tree pictures are like "XMas_Tree_0001.jpeg", "XMas_Tree_0002.jpeg" etc. and all your snow covered Tiroler villages are called "Tiroler_001.jpg", "Tiroler_002.jpg" etc.

You then have two series and ofcourse one series is supplied by yourself and the other by someone else. They're way over a 1000 pictures and you don't feel like changing all those .jpg into .jpeg or vice versa. That's where the .txt comes in.

You use your .txt to declare variables like :
&seriesName=XMas_Tree_&seriesExtension=jpeg&series Amount=1082&seriesFolder=XMasTrees&endOfXmas_Tree= 1

do the same for your Tiroler series.

Then either use a third to declare which series you have, but if that's not that dynamic you could as well just declare them in your flashfile.

Having loaded in your variables you can then use these to get the appropriate picture.
ActionScript Code:
function getNextPic () { _root.lastPic++; //you have to set this one to 0 before you do this. var picPath = "\"+_root.seriesFolder+"\"+_root.seriesName+"."+_root.lastPic+"."+_root.seriesExtension; loadMovie (picPath, _level2);

Also, if you use 0001, 0002 instead of 1, 2, 3, etc. you also need to take that in account. You could have a small function determine how many '0's it needs to place before the next number. You can use the seriesAmount variable for that.
if (_root.seriesAmount < 100 && _root.seriesAmount > 10) {
if (_root.lastPic < 10) {
_root.nextPic = "0" + _root.lastPic;
}
}else if (_root.seriesAmount < 1000 && _root.seriesAmount > 100){
if (_root.lastPic < 10) {
_root.nextPic = "0" + _root.lastPic;
} else if (_root.lastPic > 10 && _root.lastPic < 100) {
_root.nextPic = "00" + _root.lastPic;
}[/as]
etc.

If the amount of picturesin your serie is for instance 22 but you named them "seriesName_000022", just ad those extra '0's to your seriesName variable in the txtfile.

Now, if you don't have mx, but flash 5, then you need to put each pic in its own swf in load in the swf. You can then ignore the whole extension thing as it will always be .swf and load in the appr. swfs instead of the jpegs.

This method is especially handy for non-flashers who wish to update their content themselves. They just need to make a new txtfile, declare the appropriate variable data and their done. Those .txtfiles can also be put in a txt file that can be used as a look up table for which txt files there are. Its basically the same.

Now, if you have mx, you can put all those variables in a nice dynamic array and display them in a listbox. But thats beyond the scope of this mini-tutorial.
__________________
RicoD
Link ?
Ricod is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:48 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.