The alternative use of the canvas area is for the source editors. Within the Source tab, there is a menu of choices. In general, each is an editor for a specific project file:
The most commonly used editor is the
Script tab. Script is the page JavaScript source editor. This is the contents of the page JS file. For the main page, this is pages/Main/Main.js
, as noted in the upper-right corner, just above the Completions panel.
The most common way to add page code is by using the JavaScript
option in component events. Choosing JavaScript for an event automatically creates a function and places us in the source code script editor. For example, choosing JavaScript for the onShow
event for layer1
creates a stub layer1
show event:
layer1Show: function(inSender) { //Your on click event code here },
Alternatively, you can define the page function first and specify it for the on click event. In practice, it is usually easier to let Studio create the stub function...