A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Radiobuttons - AS3

  1. #1
    Junior Member
    Join Date
    Jan 2007
    Blue Mountains, Australia

    Radiobuttons - AS3

    Need a little help with this one ...
    I want to use radiobuttons in a project but I don't
    understand how to get the thing to work.

    I'm using the example that's shipped with Km and working
    out what this means in the comments ...
    // ... and a radiobutton image embedded in the
    // swf movie with classname 'radiobutton' assigned to
    // it.

    I have a dynamic textfield on the stage and a button
    that I converted to a movieclip.

    I then added this movieclip to the symbol library, left the symbol name as default
    and gave it a classname of "radiobutton".

    When I run the script I get a blank black screen.

    Do I need to create a swf of a button with states and import it in? or
    what are the steps involved to get this script working?

    (I'm using the latest version of Koolmoves)


    This is the script:

    // this example assumes a dynamic textfield on stage
    // named txt1 and a radiobutton image embedded in the
    // swf movie with classname 'radiobutton' assigned to
    // it.

    import km.core.*;
    import km.components.*;

    var rg:RadioGroup = new RadioGroup();

    rg.selected = rg.addRadioButton(0,0,'Item 1');
    rg.addRadioButton(0,20,'Item 2');
    rg.addRadioButton(0,40,'Item 3');

    rg.onChange = function(){
    txt1.text = this.selected.text + ' selected';

    rg.x = 340; rg.y = 50;

    Thanks for assisting !


  2. #2
    Senior Member
    Join Date
    Dec 2002
    The image you embed needs to be a bitmap with the three button states drawn below each other.
    If you can live with a simple look, you can use the ScriptedSkin class to set a skin. That way you don't need to create an image yourself.

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