Solved

Radio Button value to update dynamic text field

Posted on 2008-06-17
10
1,625 Views
Last Modified: 2011-10-19
Hello,

I am hoping this is an easy question for you experts:

I have 3 radio buttons.  I would like to update dynamic text with the value of the radio button selected (A, B or C).  I have tried to add an event listener:

function doSomething() {
            this.mydynamicText.text = a.selection.data;
      
}

myradiobuttongroup.addEventListener("click", doSomething);

This is in frame 1 of my movie.  It seems something is missing as I cannot get the value to appear in the dynamic text box.

Many thanks in advance!

0
Comment
Question by:1Cougar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 12

Accepted Solution

by:
SamuelRostol earned 500 total points
ID: 21801876
Hi there,

You'll have to access the Radio Components directly, not the group. As well, when you target the textfield, you cannot use "this" in the function, as "this" reffers to the radio-buttons themselves.

If I understand you correctly, you wish to assign the Radio-buttons text into the text-field. I'll assume that the Radio Buttons has the instance names "RadioA", "RadioB" and "RadioC". That is done like this:

[code].

Good luck!
Kindly,
Samuel-
function doSomething() {
	mydynamicText.text = this.label;
}
 
RadioA.addEventListener("click", doSomething);
RadioB.addEventListener("click", doSomething);
RadioC.addEventListener("click", doSomething);

Open in new window

0
 

Author Comment

by:1Cougar
ID: 21801887
OK - have gotten further.  This is my code now:

function doSomething() {
      
      RButVal.text = a.getValue();
      //RButVal.text = "this is a joke!";
      
}

a.addEventListener("click", doSomething);


The commented out line works fine.  The other line of code gives me "undefined" value.  I have checked and the data values are assigned to each of the radio buttons in group "a", so I don't know what the problem could be??

Any ideas?  

Cheers!
0
 
LVL 12

Expert Comment

by:SamuelRostol
ID: 21801905
Any comments on my solution? I can upload a sample if you need it, but it's created in Flash CS3...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:1Cougar
ID: 21802009
Hi and thanks for your comments.

Here is what I've done based on what you suggested.  I would like to get the value of the radio button group (ie which one is selected) to put in the text box, and I am planning on passing this value to a database--the text box will be hidden eventually.  Make any sense to you?  The reason I am doing this is I am doing a test and using the same radio buttons over and over, but must take the value selected to store in database.  Thanks again!

Cheers!


function doSomething() {
      
      RButVal.text = a.data;
      //RButVal.text = "this is a joke!";
      
}

a.addEventListener("click", doSomething);
b.addEventListener("click", doSomething);
b.addEventListener("click", doSomething);

0
 

Author Comment

by:1Cougar
ID: 21802013
To add that my result is only "A", no matter which button is selected.


0
 
LVL 12

Expert Comment

by:SamuelRostol
ID: 21802052
you are using the phraze 'a.data' - what is 'a'? Is that the radio-component? If so - change it to "this" :)
0
 
LVL 12

Expert Comment

by:SamuelRostol
ID: 21802107
Perhaps  it will help if I upload my source.. You can download a 30-day copy of Flash CS3 at www.adobe.com, just register an Adobe Account (free) :)
RadioSelection.zip
0
 

Author Comment

by:1Cougar
ID: 21802133
Hi,

a=name of the radio button group.  I have changed it to "this" and still, I only see "A" in my text box no matter which button is selected...

I have checked and each radio button is group : a, data A, B or C, label a, b or c...

Also, changed this.data to this.label and no matter what, only "a" appears.  Maybe the code is not in the correct frame?  I have it in frame 1 of the movie, which is a 1 frame movie.

Thanks again for your thoughts~
0
 

Author Comment

by:1Cougar
ID: 21802164
Hi again,

It now works!  I had to change the group name from "a" to something else as I think it was confused as there was also an instance name "a".

Thanks again!


0
 
LVL 12

Expert Comment

by:SamuelRostol
ID: 21802359
Aah, there you go :) Happy to help you :D
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Where to download Adobe Flash Player 11.9.900.170 5 1,424
System Center Configuration Manager 2012R2 7 100
Shockwave Flash Object within PowerPoint 2013 2 180
Flash ActionScript 6 77
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question