• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

dropdownlist issues

Guest
Feb 10, 2011 Feb 10, 2011

Copy link to clipboard

Copied

Ok, so I am making a script that creates a handheld camera. I want to make it where the user can choose between two different cameras. (one shakes more than the other)  I am doing this via a dropdownlist, but I can't get it to work. Did I mention I am new to this?

Here's the peice of the code.....

ddList = new Array("Camera 1", "Camera 2");

dropdownlistOne = myPanel.add("dropdownlist", [21,134,126,159], ddList);
    if(dropdownlistOne.selection ==0){
    buttonOne.onClick = makeCam;
    }else{
        buttonOne.onClick = makeCam2;
    }

Any ideas? Thanks in advance.

-Tyler

TOPICS
Scripting

Views

537

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Feb 11, 2011 Feb 11, 2011

It's difficult to be specific without having the whole code to test, but generally I'd suggest you just have one onClick function, then when that is called, check the pulldown selection from inside that function. So something like:

buttonOne.onClick = onButtonOneClick;

function onButtonOneClick() {

     if (myPalette.dropdownlistOne.selection.index == 0) {

          // do this

     } else {

          // do this instead

     }

}

But depending on the rest of your code, it may just be that you're checking d

...

Votes

Translate

Translate
Enthusiast ,
Feb 11, 2011 Feb 11, 2011

Copy link to clipboard

Copied

It's difficult to be specific without having the whole code to test, but generally I'd suggest you just have one onClick function, then when that is called, check the pulldown selection from inside that function. So something like:

buttonOne.onClick = onButtonOneClick;

function onButtonOneClick() {

     if (myPalette.dropdownlistOne.selection.index == 0) {

          // do this

     } else {

          // do this instead

     }

}

But depending on the rest of your code, it may just be that you're checking dropdown.selection when maybe you should be checking dropdown.selection.index.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 12, 2011 Feb 12, 2011

Copy link to clipboard

Copied

LATEST

YES! Thanks Paul!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines