Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-06-2007, 08:48 PM   #1
lporiginalg
The Square Root Of Yes
 
lporiginalg's Avatar
 
Join Date: Dec 2003
Location: Canada
Posts: 95
Send a message via MSN to lporiginalg
Question [F8] Using a variable for the label value of a radio button component

Hi guys I am working on a quiz/survey in flash where all the questions, answers and values etc are stored in an external XML file. I thought I could save a bit of time by using radio button components but I'm not sure how I can set the label value of this component to be read as a variable so that it will load the proper 'answer' for the question.

So for example I am declaring my variable using something like this when the XML is read:
Code:
answer1 = xmlDoc_xml.firstChild.firstChild.nextSibling.firstChild.nextSibling.firstChild.nodeValue;
but how do I tell the component to use answer1 as the label so my text will show up next to the radio button properly. If I'm not being clear enough let me know and if you can help me out on this thanks very much.

Lyndon
__________________
My zen master told me to do the opposite of everything he said...so I didn't.
lporiginalg is offline   Reply With Quote
Old 07-06-2007, 09:41 PM   #2
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

you just want to modify the label of a radio button?
not sure i get what your asking... but try:
ActionScript Code:
myradiobutton.label=answer1;
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 07-06-2007, 09:45 PM   #3
lporiginalg
The Square Root Of Yes
 
lporiginalg's Avatar
 
Join Date: Dec 2003
Location: Canada
Posts: 95
Send a message via MSN to lporiginalg
Default

yup exactly what I needed, thanks mate.
__________________
My zen master told me to do the opposite of everything he said...so I didn't.
lporiginalg is offline   Reply With Quote
Old 07-06-2007, 11:03 PM   #4
lporiginalg
The Square Root Of Yes
 
lporiginalg's Avatar
 
Join Date: Dec 2003
Location: Canada
Posts: 95
Send a message via MSN to lporiginalg
Red face radio malfunction

now for some reason tho the radio buttons aren't working properly in that selecting a new answer for groupName 'question1' doesn't deselect the previous answer :S

If anyone wants to take a look and tell me what I'm doing wrong I'm sure we can all have a good laugh at my expense
Attached Files
File Type: zip survey.zip (56.3 KB, 113 views)
__________________
My zen master told me to do the opposite of everything he said...so I didn't.
lporiginalg is offline   Reply With Quote
Old 07-07-2007, 12:38 AM   #5
lporiginalg
The Square Root Of Yes
 
lporiginalg's Avatar
 
Join Date: Dec 2003
Location: Canada
Posts: 95
Send a message via MSN to lporiginalg
Post

well i got it working just by declaring the groupName(s) at the same time as the labels in actionscript.

Code:
        question1_txt.text = question1;
	q1a1.label = q1a1_label; q1a1.data = q1a1_label; q1a1.groupName = question1;
	q1a1_subtext_txt.text = q1a1_subtext;
	q1a2.label = q1a2_label; q1a2.data = q1a2_label; q1a2.groupName = question1;
	q1a2_subtext_txt.text = q1a2_subtext;
        etc etc
__________________
My zen master told me to do the opposite of everything he said...so I didn't.
lporiginalg is offline   Reply With Quote
Old 07-21-2007, 08:20 PM   #6
lporiginalg
The Square Root Of Yes
 
lporiginalg's Avatar
 
Join Date: Dec 2003
Location: Canada
Posts: 95
Send a message via MSN to lporiginalg
Question radio buttons in seperate MCs

ok I have a new problem with this same file now, is there a way to have radio buttons be in the same group without being in the same instance on the stage? I have each radio button in a seperate movie clip container but not sure how to set the groupName paramater so that only one button can be selected at a time. Let me know if I'm not being clear enough, help is very appreciated, thanks.

Lyndon
__________________
My zen master told me to do the opposite of everything he said...so I didn't.
lporiginalg is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Variable thebutterfly ActionScript 2.0 72 01-24-2006 03:12 PM
How to program a button to select a label in a list component once its clicked vick_dini Components 2 09-07-2005 02:35 AM
Radio Button Label Dramas! james@ba ActionScript 2.0 0 08-29-2005 02:06 AM
Help! radio button component. silverlunchbox ActionScript 1.0 (and below) 3 04-30-2003 04:23 AM
Writing to a file (locally only) isleshocky77 ActionScript 1.0 (and below) 13 08-23-2001 02:43 AM


All times are GMT. The time now is 11:38 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.