The radio button is changing state after the clip event fires.  Because of
this:

When you first click "High", nothing has been set yet.  After the event is
done, the "High" radio button gets set on.

The next time you check, the "High" radio button is on when the clip event
is fired and this is reported, regardless of which you clicked on.  After
the clip event is done firing, the new state gets set.

And so on.  

If you're not committed to adding the script to the container movie clip,
you can try the following (based on the docs here:
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.ht
m?href=Part4_ASLR2.html )



Name the movie clip containing your buttons (eg: mcSpeedbuttons).
Alternatively, this clip isn't necessary and the buttons can be put on the
main timeline w/o a container.

I changed the data parameter on the buttons from "speed" to "High" and
"Low", respectively.

I named the empty top layer in your flash app "actions" and added the
following actionscript to the first frame of the timeline in that layer:

speedButtonListener = new Object();
speedButtonListener.click = function (evt) {
        trace("You selected " + evt.target.selection.data);
        dyntext.text = evt.target.selection.data;
}

mcSpeedbuttons.buttonGroup.addEventListener("click",speedButtonListener);

Testing the app, it seems to work like this.

- phaedrus

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Randal
Sent: Tuesday, August 01, 2006 4:30 PM
To: Flashcoders mailing list
Subject: [Flashcoders] Strange Radio Button Behavior Problem

I have come across what looks like a bug to me in the behavior of the
radiobutton component in Flash 8 Pro.

I have posted a movie at:

http://huntingdesign.com/radioproblem/radioproblem.html

And the source FLA at:

http://huntingdesign.com/radioproblem/radioproblem.fla


Here is the code applied to the movieclip that contains the radio buttons:

onClipEvent (mouseDown) {
  if(hitTest(_root._xmouse, _root._ymouse, false)) {
    for (item in this) {
      rButton = this[item];
      if (rButton.getState()) {
                trace ("You selected "+rButton.getLabel());
        _root.dyntext.text = rButton.getLabel();
        
      }
    }
  }
}

This is taken pretty much straight from the Macromedia docs on radio
buttons. The behavior I see is that with one click nothing happens. With
another click the selected button get darkened, but no label is reported to
the dynamic text area or to the trace. Then with a click on the other radio
button the PREVIOUSLY SELECTED button now is reported. After that point
always the previously selected button is always reported, so if you click on
a button multiple times it reports the other button first then itself. 

All I am trying to do here is create a simple interface to toggle between
two states in a movie, which I thought would be a logical use for radio
buttons -- but this is really frustrating. 


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to