The drawer animation is done through MAKI Scripting. The script is short
and simple but it demonstrates the power of modern skins: with little programming,
you can add functionalities to your skin or user interface. In your XML,
you need to specify which MAKI script you want to use.
Lets break down the script:
a. Introduction Comments:
The first part of the script should be a brief introduction to the script. It should talk about the purpose and the functionality of the script.

b. #include Section:
The second part is the #include section. Use "#include" to include any
file you need. If you need to call or use another function that is defined
in another file, make sure you include that file in your script.
c. Variable Declaration Section
Any variable that you'll use in your script, declare them in this section.
d. System.onScriptUnloading() Section
When the script is unloaded, this part of the script will run. Typically,
you do your clean up in this section. Our triangle script is simple and
therefore doesn't need anything in this section.
e. System.onScriptLoaded() Section
When the script is first loaded, this part of the script will run. Typically,
if anything you want to make happen when the script first start, you do that
here. In our example, we initialized some objects and set the initial state
for those objects. Just like the previous section, it is perfectly fine to
leave this section empty. If you do that, nothing will happen when the script is loaded.
f. Your own functions
This section is where you put all your own functions that will define the behavior
of your script. Make sure that any variable you use in this function is decared
and their initial state has been initialized. For our example, we have two functions.
- button_triangle.onleftbuttonup(int x,int y) function
This function responds to the event when the triangle button is pressed. The triangle
buttons has two states: open or closed. Depending on the current state, its position
is changed so that it is moved.
- button_triangle.ontargetreached() function
This function responds to the event when the triangle has reached its destination.
What event occurs, the state of the button is changed to its new state.
|
|