Actionscript 3 :: RadioButtonGroup With Each RadioButton Added In Components?

May 25, 2010

Working in Flex 3, I have a series of components being rendered on a canvas, each of which should represent a single potential selection, ideally in a RadioButtonGroup. So in my parent canvas I am defining the RadioButtonGroup, and each component provides a single RadioButton. However, this doesn't seem to work.

[Code]...

So my guess was that at this point if, say, four of these components were added, the radio buttons would behave in mutually exclusive fashion and I'd be able to access myRadioButtonGroup.selectedValue to get the current selection. However, it doesn't seem to work that way. Is what I'm trying to do even possible, or have I maybe just missed something?

View 1 Replies


Similar Posts:


ActionScript3 :: Flex : Programmatically Associate A RadioButton With A RadioButtonGroup?

Jul 27, 2009

I have a UI component that, for various reasons, I have to construct programatically. The component is a table of radio buttons grouped by column.Right now, I'm constructing the column groups like so:

private function createGroupsForItemList(items: XMLList): void {
for each (var item: XML in items) {
var rbGroup: RadioButtonGroup = new RadioButtonGroup();
groups[item.@level.toString()] = rbGroup;
}
}

I'm trying to associate the RadioButton instances with the column groups like so:

private function createValueControl(item: XML): UIComponent {
var control: RadioButton = new RadioButton();
control.label = "";

[code]...

I can see in the debugger that the control has an association to the group:

control.group == groups[item.@level.toString()]

However, I can see equally that the group does not know anything about the control:

group.radioButtons.length == 0

I imagine that this is because the setter for group in RadioButton is a dumb setter; all it does is copy to the variable, which doesn't do the magic that groupName does. However, I can't seem to find the value I should use to set the RadioButton.groupName property correctly.So, in short, I'm stumped on how to get these bits to talk to each other. How do I do this?

-- EDIT -- It turns out that I can have the groups created and associated simply by setting the groupName property, but I can't get at the group to set up a selection listener; the group is NULL immediately after the setting process, which means that the second line below throws the Flex equivalent of an NPE:

control.groupName = groupNameForLevel(item);
control.group.addEventListener(Event.SELECT, updateSelection);

View 2 Replies

Flash :: Flex Dynamically Created Components Added To Custom Components

Sep 8, 2009

I am created a dynamically adding a VBox, that contains two images. Into a Custom Component that is derived from UIComponent. The problem is the Vbox that contains the two image is only a really tiny size. I would like the VBox stretch to the size of the two images. This is how I am creating the Vbox....

[Code]...

View 1 Replies

AS3 :: RadioButton Label Changes Visibly When Added To Display List?

Sep 14, 2010

I'm instantiating a group of RadioButton components into a Sprite and then later adding it to the display list. When the latter occurs, I can visibly see the font of the RadioButtons' labels changing from a serif to sansserif—but I have NO code to that effect anywhere. This occurs long after the components are actually instantiated, when they (via their parents) are added to the displaylist.

In Question_UI.answersContainer.answer:

answerUI = new RadioButton();
answerUI.group = rbg;
answerUI.label = text;

[Code]....

I've triple-checked the obvious, but there's NO code regarding the font of the label at all. It seems to only have to do with being added to the displaylist.

View 2 Replies

ActionScript 3.0 :: Assign A Value To A Radiobutton And Trace Out When Radiobutton Is Clicked?

Feb 18, 2009

How do I assign a value to a radiobutton when it's in a for loop to then trace out the value when radiobutton is clicked? I got this now, but it just sets all the radiobutton values to 10..

View 8 Replies

Actionscript 3 :: Flash Radiobutton: Get The Selected Radiobutton?

Apr 3, 2011

I have a few radiobuttons I drag and drop within same group. In main.as I added click event listener.

How do I get the selected radiobutton ? handler target argument doesn't contain any reference to it.

View 1 Replies

Actionscript :: Datagrid Doesn't Scroll Down After Added 2 Text Components In Datagridcolumn

Nov 18, 2009

I have a DataGrid[code]The datagrid does not scroll down after i've added 2 text components in a datagridcolumn.The scrollbar scrolls back up on pulling it down.

View 2 Replies

Possible To Add RadioButtonGroup?

May 9, 2011

I put 2 RadioButton on stage and specify them as belonging to the same group. However, when I export them as a symbol and try to use it in AS3, I can't access that group, only individual buttons? How can I get the group into my symbol too?

View 2 Replies

ActionScript 3.0 :: RadioButtonGroup - Can Select All Buttons

Apr 8, 2009

My code is supposed to read an XML file, and present a question with 4 possible answers to the user. I am outputting my data fine, and even outputting corresponding radioButtons for my multiple choice question. I must be handling my radioButtonGroup incorrectly as when I test my movie, I can select 1, 2, or even all of my buttons. My trace statements outputs each button with the same group name.

[Code]...

View 1 Replies

ActionScript 3.0 :: Adding A RadioButtonGroup To A Sprite?

Sep 8, 2009

I'm making a simple quiz.  I dynamically create Sprites and on these Sprites I add dynamically created TextFields which take text from an XML file. The TextFields contain the questions.  Now I want to add a RadioButtonGroup to each Sprite but every time I try to addChild I get the message telling me I cant coerce the RadioButtonGroup into a display object.

[Code]...

View 2 Replies

Flex :: Datagrid With RadioButtonGroup Itemrenderer

Aug 12, 2009

I have an AC with several questions and assoicated answers. These must be shown in a DG, and the idea is that the rows and colums of the DG are bound to the AC. For example, if the answer to question1 is Yes, the Yes-button must be true, and both the others must be false (as in normal radiobuttongroup behaviour). But when I change a button by clicking it, the actions datafield of the AC should change accordingly. Am I clear enough here?

It is ment for dynamic questionnaires.

<?xml version = "1.0"?>
<mx:Application xmlns:mx = "http://www.adobe.com/2006/mxml">
<mx:Script>

[Code].....

View 2 Replies

Flex :: Validator On RadioButtonGroup Of 2 Radios

Oct 29, 2010

I have a Validator on a RadioButtonGroup of 2 Radios. There's a checkbox above the RadioButtonGroup whereby if checkbox.Selected, then the Radios are enabled. So the Validator is required if the checkbox.Selected. So far so good. The problem is once a radio gets selected, the RadioButtonGroup selectedValue gets set. When I uncheck the checkbox I set the radios to not selected, but the selectedValue on the RadioButtonGroup doesn't get reset -- it hold the previous value. I tried setting it to null but no luck.

Therefore if I check the checkbox again and submit, the Validator see a selectedValue on the RadioButtonGroup. Even though none of the radios are selected, validation passes. How can I reset the RadioButtonGroup to its initial state when I uncheck the CheckBox? I looked at the underlying code for RadioButtonGroup.selectedValue = null, and what it does is look for a radio in the with the parameter value. If it doesn't find it nothing gets set.

View 1 Replies

ActionScript 3.0 :: Do A Line Break When Using RadioButtonGroup

Jan 14, 2009

EDIT2: Ok Both problems solved since I just found out how to randomize the array It took me three days to solve these problems lol At the third day I posted here but I got with the solutions by myself EDIT: lol ok Silly me.. I've just found out how to do that... Just adding a n in the answer texts solves this issue... I feel silly now =P ... However, I got another doubt, since I need to randomize the questions... Let's say I'd need 20 questions in total (with its respective answers). From those, I only need 10 to show... Ok, no problem here. The thing is, from those 20 possible questions, I need any 10 to appear randomly. I still can't found out how to randomize the items inside an array.

[Code]...

View 0 Replies

Actionscript 3 :: Change Order Of Radiobuttons From Radiobuttongroup?

Apr 5, 2012

I am using RadioButtons within a radiobuttongroup. i want to change the order sequence of the radiobuttons of the group based on the end user's input.i have searched a lot, but all fell into vain.

I want to know whether it is possible to change the order of the radiobuttons?

View 1 Replies

Flex :: Dynamically Adding Radiobuttongroup In Application

Jan 13, 2010

I'm trying to make a quiz in flex and am loading data from an xml file. For each question I want to create a radiobuttongroup so I can associate radio buttons to it. How can I accomplish that with actionscript? I can see that addChild method works for DisplayObjects and I presume that radiobuttongroup is not one because I'm receiving errors. How can I dynamically add radiobuttongroup with actionscript in flex application?

View 2 Replies

Actionscript 3 :: Why RadioButtonGroup Doesn't Set Its NumRadioButons Instantaneously

Aug 19, 2010

Here is my code:

var x : int = 50;
var group : RadioButtonGroup = new RadioButtonGroup();
for (var i : int = 0; i < 5; i++) {

[Code].....

when i run the application, it shows me "0". Why this?

View 1 Replies

Actionscript 3 :: Mx:RadioButtonGroup Not Working Under Mx:GridItem In Flex?

Dec 15, 2011

I had tried to use the radioButtonGroup under the GridItem in flex4. but it is not working[code]...It is not working. If any one knows how to assign values to radioButtonGroup to call the showSetting() function.

View 1 Replies

ActionScript 2.0 :: New Shipping Charge Is Added To The Buyers Total For Every Item Added?

Jan 21, 2011

I am using a Flash AS2 template for a PayPal shopping cart on my site. As the code is now, a new shipping charge is added to the buyers total for every item added. I would like it to have only 1 shipping charge, no matter how many items are added!

Actionscript Code:
import caurina.transitions.Tweener;cartItems = new Array();itemNr = -1;itemQty = 1;cartin = false;ctrl_mc.cart_mc.onRelease = showCart;attachMovie("cart","cart_mc",15000,

[code].....

View 1 Replies

Flex :: Components - Components - Any Component With The Functionality Such As Horizontally Collapsible Window Or Panel

Aug 22, 2010

Do you know any flex component with the functionality such as horizontally collapsible window or panel I found arc90, but it folds vertically.

View 1 Replies

Is It Bad Design To Nest Components Inside Components Using Flex 4

Sep 15, 2010

Is it bad practice/design to nest components inside components using Flex 4? Should I simply be creating components and inserting them into my main application as below, or doesn't it matter?

<com:MyComp1>
<com:MyComp2>
<com:MyComp3>

[code]....

View 1 Replies

Actionscript :: Use Components Code In Mmxl Components

May 8, 2011

how i can use actionscript component code in mmxl components,as in actionscript components we use classes ,but in mmxl component we can not use classes function, so how i can use actionscript component code in mmxl component

[Code]...

but i cant use this code in mmxl components how i can use public class DialogTitle extends HBox implements IBindingClient in mmxl component code,what are the way to use it,sorry i am newbie if it is silly question

View 1 Replies

Create A Simple Radiobutton?

Nov 17, 2009

I want to have 4 radio buttons Then which ever radiobutton the user has chosen I want Flash to use it later on.

[URL]

however I receive the following errors why?

**Error** Scene=Scene 1, layer=action, frame=1:Line 4: The class or interface 'fl.controls.RadioButtonGroup' could not be loaded.
var myradioGroup:RadioButtonGroup=new RadioButtonGroup("Group 1");
**Error** Scene=Scene 1, layer=action, frame=1:Line 13: The class or interface 'MouseEvent' could not be loaded.
function showResult(event:MouseEvent):void {
Total ActionScript Errors: 2 Reported Errors: 2

View 10 Replies

ActionScript 3.0 :: Any Way To Disable RadioButton?

Jan 4, 2010

i was wondering if there is a way to disable radio button selection after a choice has been made?I tried radioButtonGroup.selected = false, didnt work, nor did radioButtonGroup.enabled = false.For example, when i initialize my radiobuttongroup in the setup.enabled radio button in the setup, so user can select choice.radiobuttongroup.enabled = true.After which, i have a checkAnswer button to check that regardless of choice radiobutton group.enabled = false. that way, the user will not be able to choose choice 1, after which, blah, i am going to choose choice 2/3/4/5/...Or is it, tough luck bum, if u want to do it that way, comboBox/the other button are the only way to go?

View 3 Replies

ActionScript 3.0 :: Changing The Skin Of Radiobutton?

Jan 23, 2009

I want to change the skin of a radiobutton with images which are called dynamically. I know how to modify radiobutton's sking but I want to call particular images for over, selected icons. Can it be possible in Actionscript 3?

View 1 Replies

ActionScript 3.0 :: Creating Group For RadioButton?

Jan 15, 2010

I have a code:

import fl.controls.RadioButtonGroup;
rb1.label="C++";
rb2.label="ActionScript 3.0";

[Code]......

View 3 Replies

ActionScript 1/2 :: Set The TabIndex For The RadioButton Of A Same Group?

Oct 11, 2011

how to set the tabIndex for the RadioButton of a same group.

View 5 Replies

Flex :: Add Radiobutton Child To VBox?

Feb 2, 2010

I am having troubles adding a radiobutton to a VBox in actionscript.

var radioButton:RadioButton = new RadioButton();
radioButton.groupName = "source";
radioButton.label = "label";

[Code].....

I first created these radiobuttons in mxml and it worked fine, but now that the radiobuttons need to be dynamically generated in actionscript it doesnt work.

When stepping through in the debugger I get to a binding error (1009) when trying to execute the addchild statement and nothing shows up in the VBox.

View 1 Replies

Flex :: Increase The Size Of RadioButton?

Feb 25, 2010

Recently i worked in a project where i used 5 radio button to select a page number. Now the clients wants a big radio button. how can i increase the size of radio button in flex?

View 1 Replies

Flash :: Get The Value Of RadioButton Inside A FormItem?

May 13, 2010

I'm working on Flash Builder with latest flex SDK. I have a problem getting the value radioButton of the selceted radio button inside a form:

<mx:Form id="form_new_contribution">
<mx:FormItem label="Contribution type" includeIn="project_contributions">
<mx:RadioButtonGroup id="myG" enabled="true" />
<mx:RadioButton id="subtitle" label="subtitle" groupName="{myG}" value="subtitle"/>
<mx:RadioButton id="note" label="notes / chapters" groupName="{myG}" value="note"/>
</mx:FormItem>

[Code]...

View 2 Replies

Flex :: Show A Warning Before A Radiobutton Changes?

Aug 30, 2010

In my flex app I have some radio buttons. When a user clicks the radio button, I want to popup an Alert, and if the user clicks ok the radio button will change, otherwise their change will be discarded.

How do I accomplish that? I tried event.preventDefault(); while handling the click event, but that didn't do anything.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved