Ultrashock Forums > Flash > ActionScript
AS3 - How to use Button.selected?

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
AS3 - How to use Button.selected?
Old 2008-08-06 Last edited by ad.sign : 2008-08-06 at 17:34.

I'm trying

ActionScript Code:
  1. import fl.controls.Button;
  2. var b1:Button = new Button();
  3.  
  4. this.addChild(b1);
  5. b1.selected = true;

And it doesn't work.

Should the Button be supposed to 'select'.. ?
Where is the error?

Tanks in advance.
Alvaro Braga
postbit arrow 3 comments | 1470 views postbit arrow Reply: with Quote   
Registered User
ad-sign is offline
seperator
Posts: 143
2003-04-08
ad-sign lives in Brazil
seperator

Ultrashock Member Comments:
Nutrox's Avatar Nutrox Nutrox is offline Super Moderator Nutrox lives in United Kingdom 17 Creative Assets 2008-08-06 #2 Old  
Don't you have to set the toggle property to true as well?

ActionScript Code:
  1. button.toggle = true;
  2. button.selected = true;
Reply With Quote  
ad-sign ad-sign is offline ad-sign lives in Brazil 2008-08-06 #3 Old  
Yes, that's it I was missing. Tanks Nutrox!
I don't know why, but my Flash isn't supported by extensive v3 Components Documentation, as it was used to be for v2 ones.

By the way, following the same subject of 'things that aren't working as expected', I will bring a second one to the table.

ActionScript Code:
  1. import fl.controls.Button;
  2. import flash.display.MovieClip;
  3.  
  4. var b:Button = new Button();
  5. var m:MovieClip = new MovieClip();
  6.  
  7. m.addChild(b);
  8. this.addChild(m);
  9.  
  10. m.enabled = false;

PS.: Dont forget to push v3 Button Assets into your library before hitting CTRL+ENTER!

I was considering that by executing this code, Flash should came up with a Button on the stage, wich could not answer to mouse actions. But, going against the expectations, the Button does perform normally.

Whats wrong again? Could anyone stuck-me out of that?

Unlimited Tanks! (first one was very helpfull)
Reply With Quote  
ad-sign ad-sign is offline ad-sign lives in Brazil 2008-08-08 #4 Old  
I'm sorry for so many questions... It is because I'm starting at AS3 now, and expectations sometimes goes beyond what documentation says.

For those that could be stucked on the same subject, here goes the answer: use 'mouseChildren' instead, cuz 'enabled' just blocks mouse interactions with the single property owner.
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: