Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
xeek #1
setting radiobuttongroup id thru actionscript
Hi,
I am trying to create a RadioButtonGroup with 5 RadioButtons using
actionscript. However, I cannot set the id attribute of the RadioButtonGroup.
There is compile error when I try to do the followings:
var radiogroup1:mx.controls.RadioButtonGroup = new
mx.controls.RadioButtonGroup();
radiogroup1.id = "abc";
The compile error is : There is no property with the name 'id'
From the Macromedia online documentation on RadioButtonGroup, 'id' is an
required attribute for MXML syntax. If I cannot set the 'id' of the
RadioButtonGroup, then I wouldn't be able to assign the value of 'id' as the
groupName for the RadioButtons in this group.
Thanks,
Andrew
xeek Guest
-
Problem creating radioButton in a radioButtongroup withAS
Hi, i try to generate a form dynamically using a XML configuration file. I have a big problem with radio button and radioButton group, since i... -
I's possible to use a RadioButtonGroup cellrenderer???
Hello, i'm trying to use a radiobutton in a datagrid and i don't know if this is possible by using a cellrenderer, if someone can help me i'll... -
UDF and actionscript
I have learnt to use cfsavecontent for some basic actionscript, thanks to you. However, I would like to create some UDF using <CFFunction> but not... -
actionscript/PHP
Ok I have a problem and with my limited knowledge of PHP/MySQL i do not know the solution. Here is my problem: if fields are empty throw this... -
Help with actionscript
I am making a short animation. I want to control the playback with a simple button that once clicked will play to a certain frame. For this I will... -
Jason R. Weiss #2
Re: setting radiobuttongroup id thru actionscript
xeek wrote:
Does it work if you use createClassObject instead, like this:> Hi,
>
> I am trying to create a RadioButtonGroup with 5 RadioButtons using
> actionscript. However, I cannot set the id attribute of the RadioButtonGroup.
> There is compile error when I try to do the followings:
>
> var radiogroup1:mx.controls.RadioButtonGroup = new
> mx.controls.RadioButtonGroup();
> radiogroup1.id = "abc";
> The compile error is : There is no property with the name 'id'
>
> From the Macromedia online documentation on RadioButtonGroup, 'id' is an
> required attribute for MXML syntax. If I cannot set the 'id' of the
> RadioButtonGroup, then I wouldn't be able to assign the value of 'id' as the
> groupName for the RadioButtons in this group.
>
> Thanks,
> Andrew
>
var rbGroup : MovieClip;
var initObj = new Object();
rbGroup = createClassObject(RadioButtonGroup, "rbGroup", 1, obj);
This is speculation, but it would give you access to the instance name
of "rbGroup" for use in your radiobutton groupName attributes.
HTH,
Jason
--
Jason Weiss
Cynergy Systems, Inc.
Macromedia Flex Alliance Partner
[url]http://www.cynergysystems.com[/url]
Email: [email]jason.weiss@cynergysystems.com[/email]
Office: 866-CYNERGY
Mobile: 1.832.444.2246
Jason R. Weiss Guest
-
xeek #3
Re: setting radiobuttongroup id thru actionscript
Hi,
I assume the last parameter to createClassObject is initObj instead of obj.
I have tried your example but it doesn't work, I am not able to get the id
attribute from rbGroup.
I have also tried the following example but it doesn't work either:
var groupA = createClassObject(mx.controls.RadioButtonGroup,"gr oupA",1,{});
trace("Radio Group id=" + groupA.id);
=> Radio Group id=undefined
Thanks,
Andrew
xeek Guest
-
Jason R. Weiss #4
Re: setting radiobuttongroup id thru actionscript
xeek wrote:
There is no such thing as the "id" property on any of the core> Hi,
>
> I assume the last parameter to createClassObject is initObj instead of obj.
> I have tried your example but it doesn't work, I am not able to get the id
> attribute from rbGroup.
>
> I have also tried the following example but it doesn't work either:
>
> var groupA = createClassObject(mx.controls.RadioButtonGroup,"gr oupA",1,{});
> trace("Radio Group id=" + groupA.id);
> => Radio Group id=undefined
>
> Thanks,
> Andrew
>
ActionScript clases, so you're wasting your time trying to code things
like groupA.id
It's like declaring a variable
var myFirstName: String = "Jason"
There is no "id" on myFirstName- I just reference it in my code using
myFirstName. Same thing goes with tags- an id="something" attribute on
a tag is translated at compile time to the equivalent of myFirstName--
an identifier.
For the life of me I can't figure out why you need to programmatically
access the NAME of an identifier, but since you have your heart set on this:
There is a __id (there are TWO underscores there!).
It is a private member.
You have to willfully through encapsulation out the door and rape your
object to get access to this value- something I think is a terrible way
to write code, but here you go:
<mx:Button id="test" label="Click Me" click="var myObj =
test;mx.controls.Alert.show(myObj.__id)"/>
var myObj = test is responsible for casting the Button instance to a
generic object. Since I am now the object, private is out the window so
I can access __id.
This example displays "test" in the alert box, the ID assigned to the
object in MXML.
Jason
--
Jason Weiss
Cynergy Systems, Inc.
Macromedia Flex Alliance Partner
[url]http://www.cynergysystems.com[/url]
Email: [email]jason.weiss@cynergysystems.com[/email]
Office: 866-CYNERGY
Mobile: 1.832.444.2246
Jason R. Weiss Guest
-
xeek #5
Re: setting radiobuttongroup id thru actionscript
Hi Jason,
Thank you for your help.
Andrew
xeek Guest
-
Unregistered #6
Re: setting radiobuttongroup id thru actionscript
This isn't quite right! You CAN set id's of objects:
var b:Button = new Button();
b.id = myButton;
but with radioButtonGroup, this is impossible. RadioButtonGroup is NOT a visual component, it's just an event dispatcher. You could do this:
var rbg:RadioButtonGroup = new RadioButtonGroup();
var rb:RadioButton = new RadioButton();
rb.group = rbg;
DanyUnregistered Guest



Reply With Quote

