* Google Search


Author Topic: XML usage easly in AS2  (Read 608 times)

0 Members and 1 Guest are viewing this topic.

Offline lipka

  • Elite Developer
  • *****
  • Posts: 198
  • Thanks Meter: 0
    • View Profile
  • Model: s5620
XML usage easly in AS2
« on: March 25, 2011, 03:40:34 AM »
Hi
There is simple way to use xml file ( with settings of your mod eg.).

First AS2 :
Code: [Select]
var NumOfWallpapers:Number;
var NumOfWidgets:Number;
var Name:String;
var Version:String;

Settings_xml = new XML();
Settings_xml.ignoreWhite = true;
Settings_xml.onLoad = function(sucess) {
        if (sucess) {
                Parsej(Settings_xml);
                trace('Name: ' + Name);
                trace('Version: ' + Version);
                trace('NumOfWallpapers: ' + NumOfWallpapers);
                trace('NumOfWidgets: ' + NumOfWidgets);
        }
};
Settings_xml.load('Settings.xml');
function Parsej(file_xml) {
        for (a in file_xml.firstChild.childNodes) {
                var headerXML = file_xml.firstChild.childNodes[a].nodeName;
                var contentXML = file_xml.firstChild.childNodes[a].childNodes[0];
               
                if(headerXML== 'NumOfWallpapers'){
                    NumOfWallpapers = contentXML;
                }
                if(headerXML == 'NumOfWidgets'){
                    NumOfWidgets = contentXML;
                }
                if(headerXML == 'Name'){
                    Name = contentXML;
                }
                if(headerXML == 'Version'){
                    Version = contentXML;
                }
        }
}

Settings.xml
:
Code: [Select]
<Settings.xml>
    <NumOfWallpapers>10</NumOfWallpapers>
    <Version>1.0</Version>
    <NumOfWidgets>25</NumOfWidgets>
    <Name>Lipka testing xml</Name>
</Settings.xml>

DFG StarMods

XML usage easly in AS2
« on: March 25, 2011, 03:40:34 AM »

Offline siris_cac

  • Super Elite Master Modifier - MonteDroid Developer - Monte Elite Modder - DFG Elite Modding Team
  • Global Moderator
  • *****
  • Posts: 166
  • Thanks Meter: 0
  • Happy to help!
    • View Profile
    • SiriS's CaC's Mod For s5620
  • Firmware: XEJE1,DDJE1,MFJF1,JTJL2
  • Model: s5620
  • Mods: MonteEvo 3D, HTC Sensation HD,Indoptimus 3D,Android Honeycomb 3.0,HTC HD2 with SENse UI,v-Black,OSX Landscape,Android Gingerbread 3.0,Panonhideung,Windows SPB Shell 5,Windows Aero
Re: XML usage easly in AS2
« Reply #1 on: March 25, 2011, 05:18:27 AM »
Good job..
easy way to learn for future moddders!
« Last Edit: March 25, 2011, 05:20:29 AM by siris_cac »
      --MonteDroid Developer--
Vist My Site:
http://www.siriscac.co.cc
Subscribe me on YouTube:
http://www.youtube.com/siriscac
Add Me on Facebook:
http://www.facebook.com/siriscacmods
Follow me on Twitter:
=http://twitter.com/#!/siris_cac

Offline Patr0

  • Developer
  • *****
  • Posts: 403
  • Thanks Meter: 1
    • View Profile
  • Model: s5230
  • Mods: StarHero by Jdotcong & OneStyle07
Re: XML usage easly in AS2
« Reply #2 on: March 25, 2011, 06:09:04 AM »
Great job ;)
Here is another one: http://www.youtube.com/user/tutvid?feature=chclk#p/c/A6E5FB31FA1DBDD6/34/O2KT20LMwQE
This guy makes great tutorials
« Last Edit: March 25, 2011, 06:17:44 AM by Patr0 »
Most people shout "OMG!!!" just before they lose control of a car... but I say: "Hold my beer and watch this!"

Offline Keiran

  • Administrator
  • Elite Member
  • *****
  • Posts: 6237
  • Thanks Meter: 0
    • View Profile
    • The Darkforest Group
  • Firmware: 4.0.2.A.0.42
  • Model: Sony Ericsson Xperia Play
Re: XML usage easly in AS2
« Reply #3 on: March 29, 2011, 09:34:11 AM »
There is an easier way than this, it located nodes and stuff in an xml and doesn't require defining variables.

There is also loops, that fly through all the nodes and search for a certain attribute and attribute value, this is used in some of the popular themes like StarHero and MonteHero, and is easy to do once you get the grasp of it.
Follow me on twitter

Offline lipka

  • Elite Developer
  • *****
  • Posts: 198
  • Thanks Meter: 0
    • View Profile
  • Model: s5620
Re: XML usage easly in AS2
« Reply #4 on: April 01, 2011, 09:25:57 AM »
Please write some examples... Which method is better / faster for mobile phone?

Offline John brac

  • Contributor
  • *****
  • Posts: 22
  • Thanks Meter: 0
    • View Profile
  • Firmware: MFJF1
  • Model: S5620 Monte
Re: XML usage easly in AS2
« Reply #5 on: April 02, 2012, 03:58:04 AM »
How do i make as2 open the browser and go to a desired URL???
Eg:on click of a button, i want as2 to go to darkforestgroup.com from the gadget using the phone browser
« Last Edit: May 09, 2012, 07:40:06 AM by John brac »
Any help regarding to modding, and i am here.......

 


Chat

Refresh History
  • White Rider: @fare1180, port/driver problem. reinstall the drivers and try different usb ports. are you able to use the media player mode with computer?
    April 29, 2013, 09:13:30 PM
  • farey1180: :-[
    April 27, 2013, 11:10:07 PM
  • farey1180: my phone is not seen in multi loader. why?
    April 27, 2013, 11:02:04 PM
  • CookieMen: @goku i know it, but i have other patch menu? but i downloaded it from this topic. can you make screens with enabled patches?
    April 26, 2013, 05:05:33 AM
  • beginnerPRO: can you help me to make scrolling background for gadget.swf please..!!
    April 25, 2013, 09:25:18 PM
  • wahyuaire: :(
    April 23, 2013, 07:16:07 AM
  • wahyuaire: i miss U all Guys
    April 23, 2013, 07:16:04 AM
  • Goku: Deactivate all patchs and activate nly the ones i postd ther..
    April 19, 2013, 11:10:27 AM
  • CookieMen: default eabled patches, not settings
    April 18, 2013, 05:10:44 AM
  • CookieMen: white screen, but with default settings phonebook and lockscreen doesnt work
    April 18, 2013, 05:10:10 AM
  • CookieMen: pb
    April 18, 2013, 05:08:33 AM
  • Goku: Wat help u want??
    April 17, 2013, 11:28:28 AM
  • CookieMen: anyone can help me with this theme? http://darkforestgroup.com/starmod/index.php?topic=1999.msg24556#new
    April 17, 2013, 05:31:34 AM
  • iXamueL: Good ol' forum where everything started :D
    April 13, 2013, 11:44:00 PM
  • White Rider: @it , and nothing has changed since you left....  :(
    April 10, 2013, 07:01:30 AM
  • it: it's been so long since my last visit.. :)
    April 09, 2013, 08:12:51 PM
  • onlook: ...
    March 25, 2013, 02:35:41 AM
  • White Rider: Bored....
    March 20, 2013, 10:56:00 AM
  • null14: yeah
    March 14, 2013, 11:13:46 PM
  • Goku: Thats true...
    March 14, 2013, 11:14:48 AM

SimplePortal 2.3.3 © 2008-2010, SimplePortal