A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [RESOLVED] [F8] Radio Buttons for fake poll

Hybrid View

  1. #1
    Junior Member
    Join Date
    Sep 2000
    Posts
    15

    resolved [RESOLVED] [F8] Radio Buttons for fake poll

    I don’t think this is hard, but I’m not finding any tutorials or models I could get coding and syntax from.

    I want to make a fake webpoll, 1 question with five choices on radio buttons and a vote button. If the user chooses radio button 1 or 2, the vote button sends them to a webpage. (radiobutton data is “gogoth”) If they’ve chosen 3, 4, or 5 they are sent to a different webpage. (data is “needhint”)

    I gather I’ll need a listening object but don’t know where or how to set it up.
    I know the data on the radio buttons is important, but I don’t know what it’s called in code, how to “get at it.”
    I know I’ve got a fairly simple if code to make for the vote button. I think I can handle that once I know the rest.

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    open a new file
    drag a RadioButton component into the Library
    add a button - instance name - vote_button
    add this code to the main timeline
    publish and test in the browser

    PHP Code:
    for(var n=1;n!=6;n++){
    objRB = {_x:50 ,_y:n*20+50label:" choice "+ndata:ngroupName:"poll"};
    this.attachMovie("RadioButton""rb"+nnobjRB);
    }

    var 
    rbL:Object = new Object(); 
    rbL.click = function(obj:Object){
    num =  obj.target.selection.data;

    switch(
    num){
    case 
    1choice "gogoth.html"; break;
    case 
    2choice "gogoth.html"; break;
    case 
    3choice "needhint.html"; break;
    case 
    4choice "needhint.html"; break;
    case 
    5choice "needhint.html"; break;
    }
    }; 

    poll.addEventListener("click"rbL); 

    vote_button.onRelease = function(){
    trace(choice);
    getURL(choice"_blank");
    }; 
    hope this helps you on your way

  3. #3
    Junior Member
    Join Date
    Sep 2000
    Posts
    15
    Okay, I almost get it. We're building the radio buttons in the framescript rather than building them on the stage. Works beautifully. So far so good.

    Now can you tell me how I would assign different labels that are whole lines of text?
    e.g. "Political opponents" "Maroni Crime Family" and so on.

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    add labels to an array, and set them to the radiobuttons within the object

    PHP Code:
    aLabels = ["Political opponents""Maroni Crime Family","blah","blah","blah"];

    for(var 
    n=1;n!=6;n++){ 
    objRB = {_x:50 ,_y:n*20+50label:aLabels[n-1], data:ngroupName:"poll"}; 
    this.attachMovie("RadioButton""rb"+nnobjRB); 


  5. #5
    Junior Member
    Join Date
    Sep 2000
    Posts
    15
    You're amazing, AMD. Thank you so much. Hope one day I can return the favor.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center