Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-02-2004, 01:46 AM
Junior Member
 
Join Date: Sep 2004
Posts: 7
Default Newbie

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
Reply With Quote
  #2 (permalink)  
Old 09-02-2004, 02:23 AM
Junior Member
 
Join Date: Sep 2004
Posts: 7
Default Re:Newbie

Any help will do??
???
Reply With Quote
  #3 (permalink)  
Old 09-02-2004, 01:14 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Newbie

1. Add a button into your swf
2. Add action script code for the button
Code:
on (release)
{
    fscommand("ffish_run", "saveimage");
}
When you click the button, FFish script "saveimage" is called

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.

Reply With Quote
  #4 (permalink)  
Old 09-02-2004, 04:53 PM
Junior Member
 
Join Date: Sep 2004
Posts: 7
Default Re:Newbie

Thanks for the reply,
I will try what you said.

M, ;D
Reply With Quote
  #5 (permalink)  
Old 09-08-2004, 09:53 PM
Junior Member
 
Join Date: Sep 2004
Posts: 7
Default Re:Newbie

???

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;
And on the saveimage script i added this,
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);
}
When I click Build test application i get this output error that my files do not exists. I run the program and it works fine, I can draw on it and when i click save the save dialog box appers but when i save it, it doesnt do anything, it doesn created anywhere....

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.
Reply With Quote
  #6 (permalink)  
Old 09-09-2004, 06:05 AM
Member
 
Join Date: Jan 2003
Posts: 54
Send a message via MSN to swfbaz Send a message via Yahoo to swfbaz
Default Re:Newbie

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
Reply With Quote
  #7 (permalink)  
Old 09-09-2004, 08:27 AM
Junior Member
 
Join Date: Sep 2004
Posts: 7
Default Re:Newbie

k, I am trying to understand this coding in general thing.
I am not a expert on scripts of any kind. But thanks for the info.
I will keep trying.

Thanks,
Reply With Quote
  #8 (permalink)  
Old 09-09-2004, 12:47 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Newbie

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
Reply With Quote
  #9 (permalink)  
Old 09-09-2004, 09:23 PM
Junior Member
 
Join Date: Sep 2004
Posts: 7
Default Re:Newbie

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;
On the saveimage script i have this

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);
}
And on the SWF Movie i have the button and the action that you told me to put that is this,

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...
Reply With Quote
  #10 (permalink)  
Old 09-09-2004, 09:29 PM
Junior Member
 
Join Date: Sep 2004
Posts: 7
Default Re:Newbie

Sorry, here is the file,

www.ximis.com/monstruo/saveimage.skp
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:46 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.