473,385 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

save dialogue box in flash (saving external jpg + .doc files)

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
Jun 11 '07 #1
3 4045
xNephilimx
213 Expert 100+
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:
Expand|Select|Wrap|Line Numbers
  1. getURL("download.php?f=pic.jpg","_blank");
  2.  
For the doc:
Expand|Select|Wrap|Line Numbers
  1. getURL("download.php?f=thedoc.doc","_blank");
  2.  
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.
Jun 21 '07 #2
endline
10
very cool, though im not the person that asked the question, i have a feeling that this will be useful to me. ty for the expertise.
Jun 22 '07 #3
xNephilimx
213 Expert 100+
very cool, though im not the person that asked the question, i have a feeling that this will be useful to me. ty for the expertise.
lol. I hope so.
You're welcome.
Jun 29 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Raymond H. | last post by:
Hello, I tried the line in vb but it open the dialogue box (I'd like not to open this box; I'd like save without viewing a dialogue box). WebBrowser1.ExecWB OLECMDID_SAVEAS,...
7
by: Martin | last post by:
Again drawing on the groups experience:- 1. For general file opening and file saving, using VB6, are there any issues with using the FileOpen and FileSave Common Dialog Boxes? 2. Is using the...
8
by: tmb | last post by:
1 - Can you build an entire web page or site with Java... sorta like you can with Flash? 2 - Can you do... .. Drag & Drop .. Push Buttons .. Hot Spot .. Hot Object .. Pull Down's (combo...
5
by: kevin | last post by:
Hi, Any help with this would be really appreciated! I'm trying to download a file from a remote server. The access permissions is okay but the problem I'm facing is that the file is getting...
3
by: Mike | last post by:
I have a simple flash file that plays within a webform of an asp.net app. When running from the server the flash file works fine. But when I run it from my localhost the flash file simply doesn't...
5
by: hp_1981 | last post by:
Hi Is there anyway avoiding users to save my web pages? this idea came to my mind when I tried to save a web page, but in the middle of saving progress something like the following error...
0
by: sp | last post by:
Hi everyone, Just joined this group. I have a question about saving bitmap images from flash too a .NET site using VBScript. There are several tutorials showing how this can be done using php...
1
by: MaxWall | last post by:
Hi Everyone, I'm new to the forum and to the Actionscripting world. I need some help with a project I'm working on and would appreciate any guidance. I'm working on a flash app for CD-ROM...
1
by: billelev | last post by:
I have written some code that allows the printing of a report to a pdf file. Ideally, I would like to name the file via code and not have the pdf application prompt the user for a file name. I have...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.