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

HTML 5 Canvas Combo Box

New Here ,
Sep 14, 2018 Sep 14, 2018

Copy link to clipboard

Copied

Hi,

I need to create a simple drop down menu that when a certain option is selected it takes you to a certain frame.

So for example when Location 1 is selected from the drop down menu it goes and stops at frame 21.

I have the code in AS3 but it needs to work in HTML5 Canvas and I have very little experience working with JS.

Is someone able to help ??

Here is my AS3 code:

stop();

combobox.addItem( { label: "Please choose a location" } );

combobox.addItem( { label: "Location1" } );

combobox.addItem( { label: "Location2" } );

combobox.addItem( { label: "Location3" } );

combobox.addItem( { label: "Location4" } );

combobox.addEventListener (Event.CHANGE, changelocation);

  function changelocation (event:Event) :void{

  if (combobox.selectedItem.label == "Location1") gotoAndStop (21);

  if (combobox.selectedItem.label == "Location2") gotoAndStop (22);

  if (combobox.selectedItem.label == "Location3") gotoAndStop (23);

  if (combobox.selectedItem.label == "Location4") gotoAndStop (24);

  }

Views

1.6K

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

Community Expert , Sep 14, 2018 Sep 14, 2018

click window>code snippets>html5>components>combobox to see:

if(!this.cb_change_cbk) {  // where this.cb is your combobox

function cb_change(evt) {

// Start your custom code

console.log(evt.target.value);  // use switch/case or multiple if-statments

// End your custom code

}

$("#dom_overlay_container").on("change", "#cb", cb_change.bind(this));

this.cb_change_cbk = true;

}

if that isn't enough info to answer this (and many more questions), repost.

Votes

Translate

Translate
Community Expert ,
Sep 14, 2018 Sep 14, 2018

Copy link to clipboard

Copied

click window>code snippets>html5>components>combobox to see:

if(!this.cb_change_cbk) {  // where this.cb is your combobox

function cb_change(evt) {

// Start your custom code

console.log(evt.target.value);  // use switch/case or multiple if-statments

// End your custom code

}

$("#dom_overlay_container").on("change", "#cb", cb_change.bind(this));

this.cb_change_cbk = true;

}

if that isn't enough info to answer this (and many more questions), repost.

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
New Here ,
Apr 02, 2021 Apr 02, 2021

Copy link to clipboard

Copied

balasan pekok kglad itu.itu ms newbie bertanya,pelit amat

 

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
Community Expert ,
Apr 02, 2021 Apr 02, 2021

Copy link to clipboard

Copied

if you have a question, you'll need to explain it more clearly (or maybe find someone that can read your text without using a translation tool).

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
Community Beginner ,
Feb 26, 2024 Feb 26, 2024

Copy link to clipboard

Copied

Hello Kglad,

About your combobox component code, Can you be more specific PLEASE by an example ? I mean that the code you are writing is the automatic code of adobe animate cc combobox component. But what should i write exactly to the "custom code area (Start your custom code / End your custom code)" in order to go to a certain frame when i select a specific location in the combobox? 

For a example can you give me the specific custom code to add when i select "label01" location in the combobox and gotoANDstop to the frame 5 ?

Thank you so much in advance for your reply !!!

Num

 

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
Community Expert ,
Feb 27, 2024 Feb 27, 2024

Copy link to clipboard

Copied

@num35709394gbfu 

 

use the value property, not the label of the combobox:

 

 

if(!this.cb_change_cbk) {  // where this.cb is your combobox

function cb_change(evt) {

if(evt.target.value=="data01"){

this.gotoAndStop(5)

}  

}

$("#dom_overlay_container").on("change", "#cb", cb_change.bind(this));

this.cb_change_cbk = true;

}

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
Community Beginner ,
Feb 27, 2024 Feb 27, 2024

Copy link to clipboard

Copied

Thank you so much Kglad !!! It works !

I'm afraid that I will ask you again for the other components also !
Thanks again!!
Num

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
Community Expert ,
Feb 27, 2024 Feb 27, 2024

Copy link to clipboard

Copied

LATEST

@num35709394gbfu 

 

you're welcome.

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