|
|||
|
I have this flash file Swf. And it loads an image. I want to be able to have a button( which i dont know how to do in SWFkit) and have the option of saving as a jpg.
I have seen earlier post, but they dont talk about how to paste the code where, or how to create the button, ? Any help will do. Thanks |
|
|||
|
1. Add a button into your swf
2. Add action script code for the button Code:
on (release)
{
fscommand("ffish_run", "saveimage");
}
3. In swfkit, add the "saveimage" script 4. In "saveimage" firstly launch a FileSave dialog to choose the output file, then use the Image object to save the image. |
|
|||
|
???
Ok, I added the code to the swf movie, Also i added in the initialize script this Code:
//Initialize
var tmp_image = Shell.getSpecialFolder("temp") + "\\~" + (new Date()).getTime().toString() + ".jpg";
getMainWnd().onClose = function ()
{
if (File.exists(tmp_image))
(new File(tmp_image)).remove();
}
return true;
Code:
//saveimage
//Get image name
var image_name = FlashPlayer.getVariable("_root.image_name");
trace(image_name);
//Open the filesave dialog
var saveFilter = "Jpeg files(*.jpg)|*.jpg|";
var image_to_save = Dialogs.fileSave(saveFilter, ".jpg");
if (image_to_save && image_name != '')
{
trace(image_to_save);
var img = Image.load(image_name);
img.save(image_to_save);
Shell.open(image_to_save);
}
Again be patient with me, I am not a programmer or a coder, and I do apologize if my question seem silly or dumb. But i really need this to work. |
|
|||
|
hey man!!!
the example given by topcmm works fine!!! nothing wrong with it. why dont you try and understand the given example? it will help you alot. well.. anyways keep asking questions. bye!
__________________
SWFBaz Preview [October 2006] http://www.SWFBaz.com |
|
|||
|
You must use the Image object to load an external image before you convert it to jpg.
Could you send us your code? We'll help you to resolve the problem. You can also talk with us on MSG messenger tomorrow: support@swfkit.com |
|
|||
|
Ok, here is the problem. I added the scripts and when ever i click the button, i get the save dialgo box but doesnt save.
here is the code, on the Initialize i have this Code:
//Initialize
var tmp_image = Shell.getSpecialFolder("temp") + "\\~" + (new Date()).getTime().toString() + ".jpg";
getMainWnd().onClose = function ()
{
if (File.exists(tmp_image))
(new File(tmp_image)).remove();
}
return true;
Code:
//saveimage
//Get image name
var image_name = FlashPlayer.getVariable("_root.image_name");
trace(image_name);
//Open the filesave dialog
var saveFilter = "JPEG files(*.jpg)|*.jpg|";
var image_to_save = Dialogs.fileSave(saveFilter, ".jpg");
if (image_to_save && image_name != '')
{
trace(image_to_save);
var img = Image.load(image_name);
img.save(image_to_save);
Shell.open(image_to_save);
}
on(release){ fscommand("ffish_run", "saveimage"); } My problem is that it doesnt save anything.. I am getting really close to a turning the project in, and i just need this to finish HELP... |
|
|||
|
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|