How to add "Disabled" State to a button?


i have flash main web site navigation menu has (7) buttons (actual button objects created in flash - not movieclips) load different html pages. working perfect (rollover states, linking, etc.), cannot figure out how write as3.0 code create "button disabled" state? have seen code snippets talk if using movieclips, how can make "button" disable after clicking?

 

i assume need variable capture , retain last button clicked?

 

any appreciated keep coming against same issue.

 

here current code makes buttons work:

 

var mainbuttons:array = new array(mainbtn0,mainbtn1,mainbtn2,mainbtn3,mainbtn4,mainbtn5,mainbtn6);

var mainbuttonsurls:array = new array("http://www.thekentcompanies.com/pages/index.html", "http://www.thekentcompanies.com/pages/whatsnew.html", "http://www.thekentcompanies.com/pages/facebook.html", "http://www.thekentcompanies.com/pages/golf.html", "http://www.thekentcompanies.com/pages/motorsports.html", "https://thekentcompanies.tms.hrdepartment.com/cgi-bin/a/searchjobs_quick.cgi", "http://www.thekentcompanies.com/pages/register.html");

 

 

function loadmainpagetoframe(event:mouseevent):void {

var count:number = mainbuttons.length;

var index:number;

for (var i:number =0; i<count; i++) {

if (event.target.name == mainbuttons[i].name) {

var myurl:urlrequest = new urlrequest(mainbuttonsurls[i]);

navigatetourl(myurl, "_self");

}

}

}

 

for (var i:number = 0; i<mainbuttons.length; i++) {

 

mainbuttons[i].addeventlistener(mouseevent.click, loadmainpagetoframe);

// mainbuttons[i].mousechildren = false;

}

if talking simplebutton objects, have ability control states can't add disabled state.  might able create impression of one, make easier manage if use movieclips instead of buttons.

 

here's link sample file makes use of different button state properties (new as3) realize disabled button.

 

http://www.nedwebs.com/flash/as3_disable_btns.fla

 

the disabled graphic defined in hit state frame.  problem run losing particular state when change it, need object around reference restore it.  example use other button's state this, if buttons have labels differ, won't work you.... you'd need second set of buttons, if go movieclips can avoid juggling of states.



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

CS5 Adobe Media Encoder: Encode failed because the source duration is nil.

cf_sql_integer vs cf_sql_bigint vs cf_sql_int??

localhost/joomla15/administrator doesnt work - Joomla! Forum - community, help and support