A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] ComboBox + AS ... problem

  1. #1
    Junior Member
    Join Date
    Dec 2007
    Posts
    25

    resolved [RESOLVED] ComboBox + AS ... problem

    i have a ComboBox (flash 8) and this is my AS code in section 'onchange'. The problem is that if i select the first (v=='1') i view the window with the values of javascript, but if i select other (vv='2' etc...) not open the javascript window.
    what can i do?

    thank you for yours attention.






    var v = _root.combobox1.getValue();

    if (v=='1'){
    getURL("javascript:NewWindow=window.open('http://localhost/xalshop/UplSponsor1.asp','newWin','width=570,height=300,le ft=10 0,top=50,toolbar=No,location=No,scrollbars=no,stat us=No,resizable=no,fullscreen=no'); NewWindow.focus();void(0);");
    } else if (v=='2'){
    getURL("javascript:NewWindow=window.open('http://localhost/xalshop/UplSponsor2.asp','newWin','width=570,height=300,le ft=10 0,top=50,toolbar=No,location=No,scrollbars=no,stat us=No,resizable=no,fullscreen=no'); NewWindow.focus();void(0);");
    } else if (v=='3'){
    getURL("javascript:NewWindow=window.open('http://localhost/xalshop/UplSponsor3.asp','newWin','width=570,height=300,le ft=10 0,top=50,toolbar=No,location=No,scrollbars=no,stat us=No,resizable=no,fullscreen=no'); NewWindow.focus();void(0);");
    } else if (v=='4'){
    getURL("javascript:NewWindow=window.open('http://localhost/xalshop/UplSponsor4.asp','newWin','width=570,height=300,le ft=10 0,top=50,toolbar=No,location=No,scrollbars=no,stat us=No,resizable=no,fullscreen=no'); NewWindow.focus();void(0);");
    } else if (v=='5'){
    getURL("javascript:NewWindow=window.open('http://localhost/xalshop/UplSponsor5.asp','newWin','width=570,height=300,le ft=10 0,top=50,toolbar=No,location=No,scrollbars=no,stat us=No,resizable=no,fullscreen=no'); NewWindow.focus();void(0);");
    }

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Not sure why it's not working but for starters let's simplify it, this might make it easier to figure out what's wrong.

    Firstly if you when you are in the onChange event for the combobox you don't have to refer to it by name you can and should use "this."

    Then In the combobox you can set a value for each item so rather than a load of if and else if statements set the value of each choice to the "http://localhost/xalshop/...." Then your onChange looks like this.
    Also I think you need to escape the single quotes as shown.
    I did not test this but might get you in the right direction.

    Code:
    onChange = function(v){
          getUrl("javascript:NewWindow=window.open(\'"+v+"\',\'newWin\',\'width=570,height=300,le ft=10 0,top=50,toolbar=No,location=No,scrollbars=no,stat us=No,resizable=no,fullscreen=no\'); NewWindow.focus();void(0);"
    }

  3. #3
    Junior Member
    Join Date
    Dec 2007
    Posts
    25

    resolved

    Very good Blanius,
    with your help i have resolved. The problem was that i must use "this".

    Good job

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