Read text from resource

Former Member
Former Member
Is it possible to read plain text file (not xml) from resource?
  • No. It uses XML.

    What are you trying to do? There may be a different way to do what you want.
  • Former Member
    Former Member over 8 years ago
    I try to read xml file strings1.xml

    Ui.loadResource(Rez.strings1.str1);

    and have error: Could not find symbol strings1.

    What I am doing wrong?
  • I try to read xml file strings1.xml

    Ui.loadResource(Rez.strings1.str1);

    and have error: Could not find symbol strings1.

    What I am doing wrong?


    Should probably be just Rez.str1
    You don't need to specify filenames as part of the resource identifier.
  • If the resource is a string resource (i.e., it is declared as <string ... in the xml), you should refer to it inside the Rez.Strings module. Failing to do so will result in a Symbol Not Found error.

    As an example, if you have the following in one of your xml files...

    <string id="AppName">Tic-Tac-Toe</string>


    ... and you wanted to access that string in your code, you'd write this...

    var appName = Ui.loadResource(Rez.Strings.AppName);


    The name of the resource file is not important, but the type of the resource is. The submodules of Rez are Layouts, Menus, Strings, Properties and Settings.

    Travis
  • Former Member
    Former Member over 8 years ago
    Yes! I find error! It is work! Thank you!!!