Home Tutorials Forums Articles Blogs Movies Library Employment Press

 ActionScript.org Forums [AS3] Mysteriously Switching Radio Buttons
 Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

 06-06-2012, 10:04 PM #1 superdenverdoug King o' The Newbs   Join Date: Jun 2012 Posts: 2 [AS3] Mysteriously Switching Radio Buttons This is my first post here, so hello! I'm an intermediate coder looking for a bit of help, and I would appreciate it if someone could help me figure out where I can improve. I'm coding in AS3 and have some script that I'm using to calculate a minimum credit card payment for different types of credit cards. I have a space for a user to enter in their balance (bal_text), three radio buttons (named sig, plat, and ret) to select the card type, and a submit button (calculate_btn). I've used Math.round to round out my payments to whole dollar amounts. If the minimum payment due is less than \$35, the payment will display as \$35. I have a dynamic text field, min_text, that displays the payment due. Here's my script: ActionScript Code: ```import flash.events.MouseEvent; stop (); calculate_btn.addEventListener(MouseEvent.CLICK, calcMinDue); function calcMinDue(e:MouseEvent):void {     var minDue : Number;     if(sig.selected = true) {         minDue = Number(bal_text.text) * .1;         minDue = Math.round(minDue);         if (minDue < 35) {             minDue = 35;         }         min_text.text = "\$" + String(minDue);     }     else if(plat.selected = true) {         minDue = Number(bal_text.text) * .05;         minDue = Math.round(minDue);         if (minDue < 35) {             minDue = 35;         }         min_text.text = "\$" + String(minDue);     }     else if(ret.selected = true) {         minDue = Number(bal_text.text) * .05;         minDue = Math.round(minDue);         if (minDue < 35) {             minDue = 35;         }         min_text.text = "\$" + String(minDue);     } }``` The math side of things is working fine (which, for me, is a big win). All the payments calculate and work the way I expect them to. The problem is that if I select any radio button other than "sig," Flash changes my selection to the "sig" radio button and performs the proper calculation when I press my calculate_btn. Any thoughts on what's going on here? Last edited by superdenverdoug; 06-06-2012 at 10:08 PM. Reason: wrong starting place for AS tag
 06-07-2012, 12:42 AM #2 Sonny Senior Member   Join Date: Aug 2010 Location: Sydney,Australia Posts: 132 There is nothing so mysterious about it change ActionScript Code: `if(sig.selected = true)` to ActionScript Code: `if(sig.selected == true)` or ActionScript Code: `if(sig.selected)` and do the same for all the if statements Last edited by Sonny; 06-07-2012 at 12:46 AM.
 06-07-2012, 02:28 PM #3 superdenverdoug King o' The Newbs   Join Date: Jun 2012 Posts: 2 Ah, overlooking the obvious. My specialty. Thanks!

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home ActionScript Forums Group     ActionScript 3.0     ActionScript 2.0     ActionScript 1.0 (and below)     Simple Stuff (Newbies) Flash General Questions     Flash 10 General Questions     Flash 9 General Questions     Flash 8 General Questions     Other Flash General Questions Flex     Flex 2, 3 & 4     Flex 1 Extensions and Plugins     Components     JSFL - Extending Flash Desktop, Mobile and non-browser Environments     AIR (Apollo)     FlashLite / Portable Devices Development     Projectors and CDs Supporting Technologies     HTML and JavaScript     haXe     Server-Side Scripting     Flash Remoting     Flash Media Server General     Best Practices     Gaming and Game Development     Animation and Effects     Flashants Support Forum Community Boards     General Chat     Just for Kicks Challenges     Detention Flash In Action     Site Check     Cool Sites     Widgets Decommissioned     Projects and Positions CMS Forums     Announcements Board     Content Postings / Updates     Product Review Requests     CMS Technical Questions     Process Questions     Collaboration & Suggested Articles

All times are GMT. The time now is 02:49 PM.

///