How to extract

Discussion in 'Jiggy Runtime Development' started by technoman, Jun 25, 2008.

  1. technoman

    technoman New Member

    Joined:
    Jan 27, 2008
    Messages:
    49
    Likes Received:
    0
    hey

    i need a lil help with a code ..

    http://jiggyapp.com/download/examples/

    here "uipreferencestable.js" is the code i want to ask a question from ....

    u must have executed this file nd seen that it has a place(or a cell) called "cheat code" where we can enter a word .

    Now my question is how do i extract that word i just entered in that cheat cell nd put it in a database...
    nd view it again from the database.


    id really appreciate ur help.....
    need it ASAP thanks
  2. Ryan

    Ryan Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    4,129
    Likes Received:
    28
    Device:
    Nexus 4
    i duno much about a database but you could store it in a text file and then bring the text file back up when u need it.

    just say it and ill give u the code for it.
  3. technoman

    technoman New Member

    Joined:
    Jan 27, 2008
    Messages:
    49
    Likes Received:
    0
    ok.. plz give it to me
    that might help ....
  4. Ryan

    Ryan Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    4,129
    Likes Received:
    28
    Device:
    Nexus 4
    ok so lets say your cheat box as it were, was called cheatbox1 ok?

    Ok first we need to make the save function this is simple

    Code:
    function saveText(location,text) 
    { 
      var dynamic = new Data(); 
      dynamic.loadFromString(text); 
      dynamic.writeToFile(location); 
    }

    Ok next we want to save the contence of cheatbox1 in a text file.

    To do this we need to use this bit of code.

    Code:
        var txtfile = cheatbox1.text;
        saveText(Bundle.bundlePath+"cheatbox.txt",txtfile);
    ok so that basicly creates a file in your app directory called cheatbox.txt and saves the contense of cheatbox1 to it.


    Ok now if u want to load it back up

    we need the load function which is

    Code:
    var daata = new Data(); 
    then the actual loading is in this bit

    Code:
      daata.loadFromFile(Bundle.pathForResource("cheatbox1.txt"));
      cheatbox1.text = daata.asString();
    this will load the file and put it in the cheatbox1.


    Hope this helped

    Please Register or Log in to view images

  5. technoman

    technoman New Member

    Joined:
    Jan 27, 2008
    Messages:
    49
    Likes Received:
    0
    thanks for help man....
  6. Ryan

    Ryan Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    4,129
    Likes Received:
    28
    Device:
    Nexus 4
    np did u get it working?

Share This Page