Flash problem...hope there is an answer

I was wondering if there is anyway to have a flash animation be able to detect what date it is…and then place a picture and text about that date from a list of jpg’s or text files…

for example I am making a WW2 site…I would like for the flash to load…load a small picture with a blurb of what happened on each day depending on the date…

Is this possible?

Thanks guys,

Casey

Oh yeah… Flash MX has a whole object devoted to Date’s and the such…

If that’s what you mean byt hat… Or are you tlaking about… A person enters a date… Say Sept 20, 1923 or soemhting and it loads upa particular event?

Both of them are possible and loading up a .jpg is as simple as providing the path in a loadMovie operator…

loadMovie(“picture1.jpg”);

Now… What you will wnat to do though… Is make seperate .swf files. Int he .swf files you will have the jpeg already loaded in and the text that you wnat to display… That way when a user clicks a date or anything liek that… Blam… it’ll loadup the .swf and play it…

I hope this helps.

Yes that does explain some to me…I am fairly new to Flashmx so you might have to be more basic…

What I really would like to do it…have it keep track of the current date…like if the user loads the page on Feb 1…it will load a picture corresponding to the date and have a small blurb of what happened on that date…then the next day Feb. 2 …it will tell what happened this day…so on and so forth…throughout the year…

Is this possible and if so could you help me to understand how…

:geek:

thanks guys and gals

Casey

YEha man… Just explain yourself thoroughly each time you ask a question… I try to like to pinpoint exact things…

Here you go…

First thing you need to do is open up the frame or wherever you want to put this…

You wnat to set up a new date object so…

currentDay = new Date();
currentMonth = new Date();
currentYear = new Date(0;

This sets up 3 variables to handle dates… Now… What do you wanna put in each one…

currentDay.getDate();
currentMonth.getMonth();
currentYear.getFullYear();

The getDate function will return a number 1-31 to tell you what day of the month it’ll be…
The getMonth function will return a number 0-11 to tell you what month it is… 0-January and so on and so forth…
The getFullYear will return a four digit code representing the year… 2000, 1985… Whatever year it’ll be…

So calling these would make this:

currentDay would = 1
currentMonth would = 1
currentYear would = 2003

That is as good as gold… As for setting up images… I would just do it this way then man… I would set up a string variable…

currentDMY = new String("");

Then we want to set up this string to hold the 3 vaules you have… In one easy string…

currentDMY.concat(currentDay, currentMonth, currentYear);

Now… Your string variable should look kind-a like this:

currentDMY would = “112003”

Now… What use would this have for me you say? Well… Now… Make each of the .jpg’s a certain name… that corresponds with that above number…

Say… If you’d like an image to show up on december 15, 2003, you would make the image name this…

15112003.jpg

But… Now how would you put this into code to check for this…

currentDMY.concat (".jpg");

loadMovie(currentDMY);

Then it would just load tha current image you’d like into place…

I hope this helped you out… If you have any further questions… Please ask…

First off I would like to say thank you so much…that explanation helped very very much…I understand completely everything that you listed…

since the all of the things happened in the past i really don’t need the year so it will be that much easier…now for my second question…

could i do the same thing for text files and load them into a dynamic text box below the picture…having a little text blurb?

If so thats great

Seriously you are very helpful and the best…thanks so very much

:beam: :beam: :beam: :beam:

Case

Oh yeah man… You can do it with text files as well…

Check this out… We will use my past example with the variable currentDMY variable in the same manner… Cept… We want to gte rid of that statement I made near the end… When I use the currentDMY.concat(".jpg");

Don’t do this… Instead…

imageLocation = new String("");
textLocation = new String("");

That defines two new variables… One variable is going to hold where we can find the image… The other… The text…

imageLocation.concat(currentDMY, “.jpg”);
textLocation.concat(currentDMY, “.txt”);

So… Now our two file locations will be…

imageLocation would = “112003.jpg”;
textLocation would = “112003.txt”;

Now… You would of course load up the jpeg like such:

loadMovie(imageLocation);

But how would you handle the text files? Well Flash MX and I believe 5 had this in it… It’s called loadVariables…

loadVariables(textLocation, “_root.textName”);

Just put the target or _root.textName as your dynamic text box’s instance name… And you are set man…

Hope this helped out as well and thank you :slight_smile:

Thanks alot again…I’ll see if I can get this working…

(-:

Case

Say if I had the images set into a images/Thumbs/ directory

how would I specify that in the Loadmovie code or would I add that in the concat section?

Also is it possible for the image loaded to be a link to the fullsize Image how would I do that as well?

Case

I try and

in frame 1:

imageLocation.concat("/Images/Thumbs/",currentDM,".jpg");

in the frame I want the movie loaded

loadMovie(imageLocation,_root.Picoftheday);

but when I do that it will not load anything

And do I have to make more than 1 blank movie clip when I want to load mulitple pic’s Images…or just different instance names?

Case