private var myForm:mdmForm = mdm.Forms.getFormByName("MainForm");
private var myPrefFile:String = "pref.json";
private var urlLoader:URLLoader;
private var urlReq:URLRequest;
protected function onCreationCompleteHandler(event:FlexEvent):void
{
mdm.Application.init();
var exists:Boolean = mdm.FileSystem.fileExists(myPrefFile);
protected function onApplicationCompleteHandler(event:FlexEvent):void
{
mdm.Application.addEventListener("onAppExit", onAppExitHandler);
mdm.Application.enableExitHandler();
}
private function onAppExitHandler(evt:flash.events.Event):void
{
var objString:String = JSON.stringify({
posx:this.myForm.x,
posy:this.myForm.y,
appwidth:this.myForm.width,
appheight:this.myForm.height,
message:this.textarea.text
});
mdm.FileSystem.saveFile(myPrefFile, objString);
mdm.Application.exit();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Platzieren Sie nichtvisuelle Elemente (z.*B. Dienste, Wertobjekte) hier -->
</fx:Declarations>
<mx:TextArea id="textarea" left="10" right="10" top="10" bottom="10"/>
</mx:Application>
And use MDM Zinc 4.0.22 right Panel: Change to sizable Standard and visibale = false;
Don't worry!
Bottom Panel: Switch to Extension "mdm.FileSystem" marks "X"
Than it compiles.
If you write message like this "Hello I am here and i save it. Don't worry!" than you Close Zinc app and open again from compiled Directory like C:\Users\<Username>\Adobe Flash Builder 4.6\<Name of Project>\bin\My Flash Application.exe and you see what does it happen? It saved after loading data.
If you want know. Zinc app saves "pref.json" and you can check Notepad++ or Editor
Example saved Preference file:
Code:
{"message":"Hello Jens this is example message.\r\rYes it works fine :D","appheight":719,"appwidth":867,"posx":195,"posy":141}
And i would like to know: How do i add / remove line into json file? Example plugin is Array:
Plugin:
1-plugin-name
2-plugin-name
...
Than i would like delete 1-plugin-name and it doesn't matter for saving and updating json file.
Thanks for help and Suggestion.
P.S: Thanks for welcome to our Forum
Best regards, SourceSkyBoxer
Hello my dear @angelhdz and @Terrencing are you okay?? I think you know code or not? Ia m sorry i am nervous :/ I must keep cool Thanks
File System If folder doesn't exist than it creates and if file doesn't exist than it will create tempfile and write from embedded file to local file? Is it possible?