TABLE
MAKE
CUSTOMIZE
EFFECTS
EFFECTS CYCLE
EFFECTS CYCLES
VIRTUAL BOX
PLUG-IN
GLIDER
|
Tutorial
An example that shows how to create a tutorial/presentation with the Tutorial Class. You can change the steps with the
keyboard's arrows too. The cycle options is disabled, so in this case you can't switch from the last step to the first and
vice versa.
Step1: Create a Class
The first step is obviously the Class creation.
So let's make it with the powerful Class constructor. The initialize method is called as object constructor: var myClass = new Class({ initialize: function() { // your properties } });next Step2: Adding Extras
As you want to create an OOP application, you have to create a hierarchy. Your class
extends another class called myAnotherClass and implements some MooTools core functionalities
form either the Options and the Events objects:
var myClass = new Class({ Extends: myAnotherClass, Implements: [Options, Events], initialize: function() { // your properties } });prev | next Step3: Adding methodsStep4: Instance it
When you have finished about class mechanization, the next step is to create an instance.
Once you have done it, you can use all the methods declared into the Class:
var class = new MyClass('My Class'); // let's use its methods // the following returns 10 class.getSomething();prev
|