7.9 – Writing custom Actions

You can write your custom action components easily. All you have to do is to create a class that inherits from iGUIAction and overriding the methods you want. Here is a sample action :

public class StopAnimAndSetScale : iGUIAction {
    public Vector2 scale;
    public override void act(iGUIElement caller){
        foreach(iGUIElement target in targets){
            Destroy(target.GetComponent<iTweeniGUI>());
            target.setScale(scale);
        }
    }
}
import iGUI;

class StopAnimAndSetScale extends iGUIAction {
    var scale : Vector2;
   
    function act(caller : iGUIElement){
        for(var target:iGUIElement in targets){
            Destroy(target.GetComponent("iTweeniGUI"));
            target.setScale(scale);
        }
    }
}