Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-21-2006, 08:25 AM
Junior Member
 
Join Date: Mar 2006
Posts: 5
Default Help!! how to edit/save xml from flash in SWfkit PRO?

im a superb noob in SWFkit PRO...... = =!!

Well, i try to read a xml file from a flash movie, display/edit them and then save it as different xml file but i was facing the problem in retrieving the value from flash variable... the value of the flash was displayed perfectly after i built it using the SWFkit PRO but some how no xml file was created = =!!

anyone ... please help me, im almost frustrated by my own stupidity, please kindly show me the complete code in Action Script and Ffish Script before i pull all of my hair out ~~ "Struggling for time"


this is what i wrote in my Action Script

Code:
myXML = new XML()
myXML.ignoreWhite = true
myXML.load("ABC.xml")

myXML.onLoad = function(succes){
if(succes){
var root = myXML.firstChild
nodes = root.childNodes
text1 = nodes.attributes.name

} else trace("Error loading XML document")
}
stop();
and this is the code i found from the forum/ tutorial which i implement in the SWFkit Pro:

Code:
var xml = FlashPlayer.getVariable("myXML.text1");
var name = Dialogs.fileSave("XML file(*.xml)|*.xml|");
if (name)
{
    var file = new FileStream(name, "w");
    file.writeLine('<?xml version="1.0" encoding="UTF-8"?>');
    file.writeLine(xml);
    file.close();
}
im new im programming too :P
Reply With Quote
  #2 (permalink)  
Old 03-21-2006, 08:36 AM
Junior Member
 
Join Date: Mar 2006
Posts: 5
Default Re:Help!! how to edit/save xml from flash in SWfkit PRO?

oh ya, miss out 1 thing ^^"

i wonder if "myXMl.text1" in

Code:
var xml = FlashPlayer.getVariable("myXML.text1");
is correct = =
Reply With Quote
  #3 (permalink)  
Old 03-21-2006, 01:00 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Help!! how to edit/save xml from flash in SWfkit PRO?

There is no property that can represent the string text of a XML object, so you have to save the string text of it in another variable in action script. And in your code, the variable or property "myXML.text1" doesn't exist at all, so it cannot work.

Please try to do it in the following way:

1. in action script, before you call the ffish script to save the xml file, save the string text of the xml object in another variable
Code:
...
_root.myXMLText = myXML.toString();
2. in ffish script, get the value of the variable
Code:
var xml = FlashPlayer.getVariable("_root.myXMLText");

To test whether the code is correct, you can simply call the trace method in ffish script:
Code:
var xml = FlashPlayer.getVariable("myXMLText");
trace("The context of myXML is:", xml);
var name = Dialogs.fileSave("XML file(*.xml)|*.xml|");
if (name)
{
    var file = new FileStream(name, "w");
    file.writeLine('<?xml version="1.0" encoding="UTF-8"?>');
    file.writeLine(xml);
    file.close();
}
Reply With Quote
  #4 (permalink)  
Old 03-22-2006, 06:04 AM
Junior Member
 
Join Date: Mar 2006
Posts: 5
Default Re:Help!! how to edit/save xml from flash in SWfkit PRO?

thanx a lot for the code .....

but when i copied them into Flash and Ffish script it doesnt work out = =!! im wondering if im missing some command before the

Code:
_root.myXMLText = myXML.toString();
may i know how to call the the ffish script to save the xml file?

sorry if im annoying = =!! coz im very dumb in programming ....
thanx for spending time on my problem ....



Reply With Quote
  #5 (permalink)  
Old 03-22-2006, 12:53 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Help!! how to edit/save xml from flash in SWfkit PRO?

1. insert a script into swfkit named "savexml" and add the following code
Code:
var xml = FlashPlayer.getVariable("myXMLText");
trace("The context of myXML is:", xml);
var name = Dialogs.fileSave("XML file(*.xml)|*.xml|");
if (name)
{
    var file = new FileStream(name, "w");
    file.writeLine('<?xml version="1.0" encoding="UTF-8"?>');
    file.writeLine(xml);
    file.close();
}
2. In action script, after the xml object is modified, add the following code
Code:
_root.myXMLText = myXML.toString();
fscommand("ffish_run", "savexml");
Reply With Quote
  #6 (permalink)  
Old 03-22-2006, 12:56 PM
Junior Member
 
Join Date: Mar 2006
Posts: 5
Default Re:Help!! how to edit/save xml from flash in SWfkit PRO?

Oh Yeah !! i've got it done !!! but there's a window pop up and ask me to save the file, how to get rid of it and let it automatically save as a XML file name which i describe in the script?

this is the code that i got from you ;D

Code:
var xml = FlashPlayer.getVariable("_root.myXMLText");

var xml = FlashPlayer.getVariable("myXMLText");
trace("The context of myXML is:", xml);
var name = Dialogs.fileSave("XML file(abc.xml)|abc.xml|");
if (name)
{
    var file = new FileStream(name, "w");
    file.writeLine('<?xml version="1.0" encoding="UTF-8"?>');
    file.writeLine(xml);
    file.close();
}
thanx a lot ^^
Reply With Quote
  #7 (permalink)  
Old 03-22-2006, 01:06 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Help!! how to edit/save xml from flash in SWfkit PRO?

It launches a dialog box because you use the "Dialogs.fileSave" method to show a file save dialog box to choose the output file name. If you don't like it, you can use an appointed file name instead

Code:
var xml = FlashPlayer.getVariable("myXMLText");
trace("The context of myXML is:", xml);

var file = new FileStream("c:\\test.xml", "w");
file.writeLine('<?xml version="1.0" encoding="UTF-8"?>');
file.writeLine(xml);
file.close();
Reply With Quote
  #8 (permalink)  
Old 03-24-2006, 08:42 AM
Junior Member
 
Join Date: Mar 2006
Posts: 5
Default Re:Help!! how to edit/save xml from flash in SWfkit PRO?

oh yeah, thanx for the teaching!!! gosh, it really help a lot!!!

1 more question please :P ...

i was creating the XML file in C :\ ... but what if i wana create it in a directory named as below :

C:\Documents and Settings\YuYu\Desktop\XML\XML\Untitled\Application

i tried the following code but it doesnt seems to work ...

Code:
var file = new FileStream("C:\Documents and Settings\YuYu\Desktop\XML\XML\Untitled\Application\test.xml", "w");
is there anything i can do to overcome that problem? thanx for the help!! really~
Reply With Quote
  #9 (permalink)  
Old 08-10-2009, 04:18 PM
Junior Member
 
Join Date: Aug 2006
Location: Germany
Posts: 28
Send a message via MSN to snakemedia Send a message via Yahoo to snakemedia
Smile

Hi
@denwcp, are you sure with directory?

C:\Documents and Settings\ = %homedir% If we use any language of directory: Example: My directory is in German: C:\Dokumente und Einstellungen or any language of directory. Please use frist special target directory!!! like

C:\Windows\ = %windir%
C:\Windows\system32\ = %systemroot%
C:\documents & settings\<username>\ = %homedir%

any directories i do not know everything.. Thanks and best regards
Reply With Quote
  #10 (permalink)  
Old 11-10-2009, 11:50 AM
Junior Member
 
Join Date: Aug 2006
Location: Germany
Posts: 28
Send a message via MSN to snakemedia Send a message via Yahoo to snakemedia
Smile Problem with FileStream

Hello again???

I have problem with autosave once config.xml like database saves automacally. If you want to load default configure by your swfkit application. I want to know about filestream and file...

Example:
How do file & filestream should to save while your application loads at frist afther installation?
- If your config.xml does not exist than file / filestream should to write new file config.xml.

Change your favorite color on application background color! If you apply at config.xml than you can restart your application - that is my currect application background color.

Change your language like color! for examples....

If you want to make back default config than file & fileStream should rewrite again.. Or If you delete config.xml than file & fileStream create and write again new config.xml.

That is very posible for "Loading, Writing and Updating Config File" like Adobe Air or any application with C++ by Visual Studio Applications.. Did you know about any softwares? Example OpenOffice 3.4.x is default afther installation - i change help panel to invisibled. I restart OpenOffice and work without help panel. What does it happen? No problem was config files from AppStrongDirectory saved by OpenOffice. That is trick by I/O Functions.

Please make swfkit application with I/O Function sure! Thanks!

I have been tried code in ffish script. i can not understand. That is high level :S

Best regards, SnakeMedia
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 03:37 AM.


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.