Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Keep Button in down state after click

Explorer ,
Feb 09, 2010 Feb 09, 2010

Using the Button Class, how would one keep it in its Highlighted, down state after clicking it?

Not using SimpleButton or creating a movieclip button but using the provided Button that comes with Flash.

TOPICS
ActionScript
2.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2010 Feb 09, 2010

you can't.

use a movieclip button.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 09, 2010 Feb 09, 2010

Well, I almost have it..  using 'emphasizedSkin'.

But the issue now is that the label disappears.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2010 Feb 09, 2010

lol.  that's making a simple task as complicated and time-consuming as possible.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 09, 2010 Feb 09, 2010

kGlad.. The simple task you said could not be done?

Now that I know how to do it..  it is not very time-consuming.

Maybe you can offer a useful alternative that does the same.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 09, 2010 Feb 09, 2010

i did:  use a movieclip button.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 09, 2010 Feb 09, 2010

The goal was to make this work using the Button class.

This could be used in a project which already has lots of Buttons used and you do not want to replace them all with MovieClips.

For those interested in a way to achieve this:

First go to the 'Component Assets' in your Library and then 'ButtonSkins'

Duplicate the 'Button_downSkin' and call it 'highLightSkin' and alter it as you like.

The AS is as follows:

function month_click(event:MouseEvent):void {
            for (var rx in btns) {
                btns[rx].emphasized = false;
            }

     event.target.setStyle("emphasizedPadding", 3);
     event.target.setStyle("emphasizedSkin", "Button_highLightSkin");
     event.target.emphasized = true;

}

btns is a movieclip which contains all of the buttons.

Perhaps  'someone'   can advance this..   c'mon..  you know you want to.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 09, 2010 Feb 09, 2010

Components are probably the least efficient items to include in a design in terms of file weight... I avoid them as much as possible for that reason.  Just as an example.... An Button component can be up to 15 times larger than a SimpleButton in terms of bytes in the swf file.  I do not have a comparison for a movieclip approach, but my own experience has been, homemade things are lighter designs.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 09, 2010 Feb 09, 2010

Yes, Ned but as mentioned, this was for use on Existing Buttons.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 09, 2010 Feb 09, 2010

I don't remember that being in the original posting... you only brought that up after asking for alternatives and being told what they are.  Using Buttons is simply inefficient design, and complicating the coding of them only adds to the burden they put on a file.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 09, 2010 Feb 09, 2010
LATEST

Got some reading issues on here today..feel free to re-read the original post:

"Using the Button Class..."

Perhaps I did not make that clear and misused the term 'Button Class'. If so, accept my apologies. If not so, then I challenge you guys to make the provided sample better.

Not by fixing the Gremlin by getting a Ferrari.

Advice taken though that components can increase filesize, just not the topic here.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 09, 2010 Feb 09, 2010

As far as I know and the documentation goes, it is not possible.  You can do it with the SimpleButton class in AS3 with some variables if you want to restore things, but the Button class does not share the "...State" properties the the SimpleButton class has.  The MovieClip approach is the cleanest approach.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines