ButtonGrid

Kind of class: public class
Package:
Inherits from:
Version: 7 Mar 2010
Author: John Polacek, john@johnpolacek.com
Classpath: com.johnpolacek.components.ButtonGrid
File last modified: Thursday, 24 February 2011, 22:09:57
Adds simple button interactivity to ImageGrid
Example

  • Create grid 4 images wide (images should be same size) var grid:ButtonGrid = new ButtonGrid(4); create grid 4 images wide x 3 images high var grid:ButtonGrid = new ButtonGrid(4, 3); create 4x3 grid, with 10 pixels spacing var grid:ButtonGrid = new ButtonGrid(4, 3, 10); create array of image url's
    var images = ["img/image1.jpg","img/image2.jpg"...];
    grid.loadImages(images);
    
    Add event listener to the grid to detect which button gets clicked
    grid.addEventListener(UIEvent.BUTTON_SELECT, onButtonSelect);
    function onButtonSelect(event:UIEvent):void
    {
    trace(event.value); // button index
    trace("You clicked button #" + (event.value+1));
    }
    

Summary

Constructor
Instance methods
Instance methods inherited from ImageGrid

Constructor

ButtonGrid

function ButtonGrid(w:int, h:int, s:int)
Parameters
 

Instance properties

baseAlpha

baseAlpha:Number = .8(read,write)

rolloverAlpha

rolloverAlpha:Number = 1(read,write)

Instance methods

onImageClick

function onImageClick(event:MouseEvent) : void

Image click handler. Dispatches UIEvent.BUTTON_SELECT Event

onImageLoadComplete

override function onImageLoadComplete(event:Event) : void

Image load complete handler