A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Find which button has been chosen

Hybrid View

  1. #1
    Member
    Join Date
    Nov 2009
    Posts
    35

    Find which button has been chosen

    I have a number of different buttons which I have called
    red, blue and green (instance name)

    I want a piece of code that recognises which of the button red, blue, yellow and green has been chosen. Please note these are buttons and not radiobuttons.

  2. #2
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,317
    Is this what your looking for?
    Code:
    red.onRelease = function () {
    	getCol (this._name);
    };
    blue.onRelease = function () {
    	getCol (this._name);
    };
    yellow.onRelease = function () {
    	getCol (this._name);
    };
    function getCol (butName) {
    	switch (butName) {
    		case "red" :
    			trace ("red pressed");
    			break;
    		case "blue" :
    			trace ("blue pressed");
    			break;
    		case "yellow" :
    			trace ("yellow pressed");
    			break;
    	}
    }
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center