facebook

Writing javascript – ANSWERED

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #311344 Reply

    dtr
    Member

    In the Javascript “_custom.js” file, is it possible refer to objects in the current mbi ? e.g. buttons, list items etc so that I could (e.g.) change label text dynamically ?
    Is it possible to pass variables between mbi contexts and/or set global variables ?

    Thanks

    #311422 Reply

    wayne
    Moderator

    MobiOne converts all design components and layout to HTML and CSS for execution in the emulator or on your device. So you can access any button, label, image, etc using std javascript or jquery.

    To update the label of a button who’s id is “m1-Untitled1-push1” then use a snippet such as the following jquery code:

    $(‘#m1-Untitled1-push1’).html(‘Hello World’)

    Add this to a function in the xxx_custom.js file.

    NOTE: mobione regenerates all HTML & CSS files which can result in loss of any customization of those files. The xxx_custom.js file is not regenerated and can be modified without concern for loss. Please backup any HTML and CSS changes you make before exporting as HTML. The next release will be provide much better notices.

    Wayne
    Genuitec Mobile Team

    #311423 Reply

    wayne
    Moderator

    A short-cut you may want to try is putting you javascript snippet(s) in the Link property of you key actions, e.g., button.

    To see an example do the following:
    1) create new design
    2) add a button
    3) select the button
    4) in properties add this snippet in the Link property

    javascript:alert(‘hello world’)

    5) select the Run in Test Center button
    – save design file as needed
    6) in test center select the button and you should see the alert appear

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Writing javascript – ANSWERED

You must be logged in to post in the forum log in