Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / Javascript

Hola Studio - Code Generator for JS Beginners

0.00/5 (No votes)
6 Jul 2016CPOL 7.7K  
Code Generator

Introduction

Developers can use the Hola Studio code generator, to automatically create simple, commonly used operational code. Steps: Select a component and select the event you need to monitor in the component’s events bar to load up the code editor screen. Use the code generator, choose the corresponding operation, and it will automatically generate event processing code and save it.

Background

To help beginners use Hola Studio and learn Javascript easier, Hola Studio provides the code generator. Just choose what event you want and it will show you the code!

Common Uses of the Code Generator

Code Generator Usage Examples

1) Use the win-main window button component OnClick event to close the current window and load a new window scene.

var me = this;

var win = this.win;

var initData = { };

this.openWindow("scene",

    function(retData){ console.log("window closed.");}, true, initData)

2) Click on a button to play a sound effect.

var me = this;
var win = this.win;
// Sound Effect to Play
this.playSoundEffect("hit.mp3", function onDone() {console.log("play finished");});

3) Launch Ad component while window is open.

var me = this;
var win = this.win;
// Target to Launch
win.find("hola_ads").setEnable(true);

4) Click on a label to display the text “Hello world!”

var me = this;
var win = this.win;
// Text to Display
this.setText("Hello world!");

5) Click on image to play a preset animation.

var me = this;
var win = this.win;
// Animation
this.animate("flip");

6) Click on a button to reset the scene.

var me = this;
var win = this.win;
win.replay()

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)