A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: [F8] ComboBox component: How do I get it to return a getURL string?

  1. #1
    Member
    Join Date
    Mar 2006
    Posts
    41

    [F8] ComboBox component: How do I get it to return a getURL string?

    Hello board,

    I need a combo box that will return me some strings via getURL when I click on the options. I use Flash embedded in Director, and I can get Director scripts to run from Flash by using getURL.

    It's just a simple Combo Box with 3 options. One of them should return getURL ("lingo: go next"), the other should return getURL ("event:alert2"), and the other should return getURL ("event:custom_01").

    Anyway I've been messing around with the combo box component, but my attempts with the data parameter have been fruitless so far and I suspect I need some ActionScripting at a keyframe...

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    ?? I know NOTHING about LINGO, but I dont understand how you want to use the getURL function. And can you clarify by what you mean by: "return"

    DO you want to call the getURL function when one of the entries in the comboBox is clicked?

    I can provide an example if that IS what your after.

  3. #3
    Member
    Join Date
    Mar 2006
    Posts
    41
    Yup, that's it

    Ok, forget about Director. Let's say that I want each value in the combo box to call a URL with the getURL function. That's what I need

  4. #4

  5. #5
    Member
    Join Date
    Mar 2006
    Posts
    41
    Heh, np. Just working on other files in the meantime, and thanks btw!
    Your help the other day really helped me out!

  6. #6
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    What help would that be? (Sorry I dont remember I try to help out whenever I can)

    if I did in fact help you...dont forget to vote for me for president..or moderator or something...LOL...

    anyways-

    make a new movie.
    drag a comboBox component to the stage and give it the INSTANCE name of myCombo_cb.

    then put this code in frame 1:
    Code:
    // Add Items to List.
    myCombo_cb.addItem("First Entry");
    myCombo_cb.addItem("Second Entry");
    myCombo_cb.addItem("Third Entry");
    myCombo_cb.addItem("Fourth Entry");
    myCombo_cb.text = "Please Choose One";
    
    //create listener for selection change
    var comboBoxListener:Object = new Object();
    comboBoxListener.change = function(eventObject:Object) {
        // Your code here.
    	trace("Item Selected was: "+myCombo_cb.value);
    	// Check to see what was selected and launch appropriate getURL() function
    	if (myCombo_cb.value == "First Entry") {
    		getUrl("http://www.nike.com");
    	}
    	if (myCombo_cb.value == "Second Entry") {
    		getUrl("http://www.yahoo.com");
    	}
    	if (myCombo_cb.value == "Third Entry") {
    		getUrl("http://www.google.com");
    	}
    	if (myCombo_cb.value == "Fourth Entry") {
    		getUrl("http://www.digitalbikebuilder.com");
    	}
    };
    myCombo_cb.addEventListener("change", comboBoxListener)

  7. #7
    Member
    Join Date
    Mar 2006
    Posts
    41
    Works like a charm.
    Many thanks!

  8. #8

  9. #9
    Member
    Join Date
    Mar 2006
    Posts
    41
    You helped me out the other day I posted that I needed a script that would make the movie play after Flash had checked that the value in an input field was the one it was expecting. That really helped me out and I've been able to modify it to add more parameters and text fields

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