Hi all
Im relatively new at flash, and am needing to make a "demo file" which consists of a photo album. The people viewing the album must then be able to click on an image, and this will bring up a dialogue box that will allow them to save the image they clicked on and the associated word file in a location of their choice.
I have looked at Jsystem by Flashjester, but am not sure if this is the right path to follow, as it only seems to mention .txt files, and Im needing the graphic element too.
any help would be greatly appreciated.
thanks
I don't know if there is a way to do that only with AS, but sure there is one with the help of the beloved php.
From that dialog box in your flash movie you should set up two links, one for the image, and one for the doc. You'll also need to have all the required files (pics and docs) in some specific folder ,like, "/files", or whatever you want. Then a php file which will handle and trigger the downloads instead of letting the browser try to open the files directly.
I'll explain the PHP file first, and then I'll tell you how to make the "trigger" links in flash.
It's a very simple php script file that only contains this:
[PHP]
<?php
//I get the name of the file from the get method array.
//the "files/" part is the folder, if the files are in the same folder, just delete this part and leave only $_GET['f'].
$thefile = "files/" . $_GET['f'];
//I define the Content-type (MIME) of the file that i'm outputting:
$mime = mime_content_type($thefile);
header('Content-type: ' . $mime);
//Then I define that it will be an attachment and the new name (the original name in this case)
header('Content-Disposition: attachment; filename="' . $thefile . '"');
//And output literally the entire file, but because its disposition is defined as an attachment the browser will attemp not to show it, but to save/download it
readfile($thefile);
?>
[/PHP]
Save this file in the same folder as the flash movie with any name you want, for sake of the example i'll call the file download.php
Now all you gotta do is define the links (buttons) in the flash movie.
All you need to do in order to trigger this links is the following line if code in your button:
For the image: -
getURL("download.php?f=pic.jpg","_blank");
-
For the doc: -
getURL("download.php?f=thedoc.doc","_blank");
-
Well, hope you find it usefull!
NOTE: The mime_content_type function is available in php since PHP 4.3.0 and PHP 5. If you are using an older version of PHP that function won't work.