Tutorial / Using with Flash

Code Example 1: button.fla

This example shows how to handle button related events from your I/O module.

  1. import the Gainer library (line 1)
  2. generate a Gainer class instance (line 3)
  3. specify a function for onReady events (line 5)
  4. specify a function for onPressed events (line 6)
  5. specify a function for onReleased events (line 9)
  1. import gainer.*;
  2.  
  3. var gnr:Gainer = new Gainer("localhost", 2000, Gainer.MODE1, true);
  4.  
  5. gnr.onReady = function() {
  6.     this.onPressed = function(){
  7.         sqr._visible = false;
  8.     }
  9.     this.onReleased = function(){
  10.         sqr._visible = true;
  11.     }
  12. }
prev 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 next
Print