1 Reply Latest reply on Sep 4, 2009 7:19 AM by JonKaros

    Read XML to change StyleSheet for Theme Support.

    JonKaros

      I'm having trouble accessing an XML document and using that XML document to direct me to a StyleSheet. The idea is to allow the application to support themes. I first need to read a config like xml document that directs me to a folder where a theme defination xml document. Which is similiar to this:

      <?xml version="1.0" ?>
      <AirNote>
           <theme>
                <style>main.css</style>
                <tabs>
                     <width>156</width>
                     <rightOfTabs>34</rightOfTabs>
                     <leftOfTabs>136</leftOfTabs>
                </tabs>
           </theme>
      </AirNote>
      

      I found 2 methods, the first is the use of a xhttpObject and wait for the repsonse. However becuase the loading of the xmlDoc does not happen in concurrent with the procedure, and its a fucntion call when load has finished, Air won't let the change of theme take place. I belive its the same idea of not allowing you to evaluate javascript after you have hit the initialization point. The class GetThemeSettings_Old is what I tried to use for the first method, check the attachment.

       

      The second method I used is a common xmldoc object that is supposed to read the xml document. xmlDoc.load gives me a error:

      TypeError: Value undefined does not allow function calls.
           at GetThemeSettings() (AirNote/lib/egt/Config.Pref.js:44)
           at LoadTheme() (AirNote/AirNote.html:59)
           at initialize() (AirNote/AirNote.html:54)
           at onload(event) (AirNote/AirNote.html:826)
      

       

      Here is the js Class code I use to read the theme data where the nativePathToApplicationDirectory is the full string path to the application directory. Please help me find a proper solution to get the themes to work, thank you!

       

      Message was edited by: JonKaros to condense message.