
Chintan Buch
here I m – Chintan Buch from India. I m working as Interactive Media Developer (its a bit longer, plz bear with it) in AOL. probably few people want to know @ my AS exp, so I've to tell u that this is not what I was earlier! started my career with Network Admin with the passion of Digital Art & Animation. I remember it was Flash4 when I was playing with it.. was doing animation stuffs during my college time (yes I was getting paid). after couple of yrs (precisely 3), some1 decided to gamble on me & from that day, I was officially a part of AS community. most of my work is in de area of intranet/remoting, unbelievable huh! oh yes I remember, I did couple of projects with different social networking sites as well ;-)
these days I m playing with Flex & AIR, & you know what!? I m pretty much in good shape (although I make silly mistakes most of the time, but m newbie... ;-).
yes I’ve my site globulous.net, but don’t expect anything there ;-) only my R&D projects & few personal files will be there (don’t try to search for those links, you won’t find it) hopefully I’ll design my site someday & add all favorite things there... but till that time u can reach me through email if u need any help from me : chintanbuch
Methods to Load / Update Skin Data:
- There are two methods “loadConfig()” & “updateConfig()”, both methods require File operation. These methods are using “File” & “FileStream” objects.
o “File” object creates a pointer to the configuration file & “FileStream” object is used to open configuration file for reading or writing the data.
|
// load configuration data
from XML file private function loadConfig():void { //
resolve the file path of config file configFile
= File.applicationStorageDirectory.resolvePath("config.xml"); // incase file doesn't exist copy to storage directory if(!configFile.exists) { configFile
= File.applicationDirectory.resolvePath("config.xml"); configFile.copyTo(File.applicationStorageDirectory.resolvePath("config.xml")); } //
create a file stream object to read config file fStrm
= new FileStream(); //
read config fStrm.open(configFile,
FileMode.READ); //
getting XML content configData
= XML(fStrm.readUTFBytes(fStrm.bytesAvailable)); // change skin changeSkin(configData.skin); //
close file fStrm.close(); } // save changes back to XML private function updateConfig(ParamValue:String):void { // load current file to update the value var configOld:File =
File.applicationStorageDirectory.resolvePath("config.xml"); fStrm
= new FileStream(); // open it in write mode fStrm.open(configOld,
FileMode.WRITE); // form new data for config file var strNewData:String = '<?xml version="1.0" encoding="UTF-8"?>'; strNewData
+= configData; // wirte new data fStrm.writeUTFBytes(strNewData); fStrm.close(); } |
- “loadConfig()” will do read operation. First it’ll try to read the configuration file from the Application storage directory. If it doesn’t found the file then it’ll copy the existing file to that directory & then load the data.
o Using “applicationDirectory” I was getting security error and after some googling I found a LINK for this solution HERE or you can go directly to the solution URL HERE.
- “updateConfig()” will update the config file with new data (skin detail).
Spread The Word
Attachments
3 Responses to "Create Skinnable Application Using Flex + AIR" 
|
said this on 16 Nov 2008 5:27:44 AM CST
Thanks for the article. T
|
|
said this on 14 Jan 2009 9:04:39 PM CST
WOW!
Very nice article. Th Dipz ------------ www.webvariations. |
|
said this on 19 Jan 2009 4:34:27 AM CST
Great Job! This helps me
|


Author/Admin)