Skip to main content
Participating Frequently
July 22, 2025
Question

(HTML5) One toggle is nonfunctional, but other toggles work

  • July 22, 2025
  • 1 reply
  • 116 views

I am working on a toggle system where if one toggle is selected, a series of labels will appear. All three toggles should function the same. The toggles for showing labels for muscles and nerves work, but the vessel toggle does not. Is there a way to fix this?

 

I have double-checked for typos.

 

 

 

root.ToggleMuscle.on("click", function(e)
{
	root.ListLateralPterygoid.gotoAndStop(0)
	root.ListBuccinator.gotoAndStop(0)
	
	if (e.currentTarget.currentFrame === 6)
		root.decoy.visible = false
		root.ListInfraorbitalNerve.visible = false
		root.ListLingualNerve.visible = false
		root.ListInferiorAlveolarNerve.visible = false
		root.ListSupraorbitalNerve.visible = false

		root.LabelSupraorbitalNerve.gotoAndStop(0)
		root.LabelInfraorbitalNerve.gotoAndStop(0)
		root.LabelLingualNerve.gotoAndStop(0)
		root.LabelInferiorAlveolarNerve.gotoAndStop(0)

		root.ButtonSupraorbitalNerve.gotoAndStop(0)
		root.ButtonInfraorbitalNerve.gotoAndStop(0)
		root.ButtonLingualNerve.gotoAndStop(0)
		root.ButtonInferiorAlveolarNerve.gotoAndStop(0)

		root.ToggleNerve.gotoAndStop(0)
	
	if (e.currentTarget.currentFrame === 6)
		root.ListLateralPterygoid.visible = false
	else
		root.ListLateralPterygoid.visible = true
	if (e.currentTarget.currentFrame === 6)
		root.ListBuccinator.visible = false
	else
		root.ListBuccinator.visible = true
});

root.ToggleNerve.on("click", function(e)
{
	root.ListSupraorbitalNerve.gotoAndStop(0)
	root.ListInfraorbitalNerve.gotoAndStop(0)
	root.ListLingualNerve.gotoAndStop(0)
	root.ListInferiorAlveolarNerve.gotoAndStop(0)
	
	if (e.currentTarget.currentFrame === 6)
		root.decoy.visible = false
		root.ListBuccinator.visible = false
		root.ListLateralPterygoid.visible = false
	
		root.LabelLateralPterygoid.gotoAndStop(0)
		root.LabelBuccinator.gotoAndStop(0)
	
		root.ButtonLateralPterygoidUpper.gotoAndStop(0)
		root.ButtonLateralPterygoidLower.gotoAndStop(0)
		root.ButtonBuccinator.gotoAndStop(0)
	
		root.ToggleMuscle.gotoAndStop(0)
	
	if (e.currentTarget.currentFrame === 6)
		root.ListSupraorbitalNerve.visible = false
	else
		root.ListSupraorbitalNerve.visible = true
	if (e.currentTarget.currentFrame === 6)
		root.ListInfraorbitalNerve.visible = false
	else
		root.ListInfraorbitalNerve.visible = true
	if (e.currentTarget.currentFrame === 6)
		root.ListLingualNerve.visible = false
	else
		root.ListLingualNerve.visible = true
	if (e.currentTarget.currentFrame === 6)
		root.ListInferiorAlveolarNerve.visible = false
	else
		root.ListInferiorAlveolarNerve.visible = true
});

root.ToggleVessel.on("click", function(e)
{
	root.ListSupraorbitalArtery.gotoAndStop(0)
	root.ListInfraorbitalArtery.gotoAndStop(0)
	root.ListAngularArtery.gotoAndStop(0)
	root.ListFacialArtery.gotoAndStop(0)
	root.ListInferiorAlveolarArtery.gotoAndStop(0)

	if (e.currentTarget.currentFrame === 6)
		root.ListSupraorbitalArtery.visible = false
	else
		root.ListSupraorbitalArtery.visible = true
	if (e.currentTarget.currentFrame === 6)
		root.ListInfraorbitalArtery.visible = false
	else
		root.ListInfraorbitalArtery.visible = true
	if (e.currentTarget.currentFrame === 6)
		root.ListAngularArtery.visible = false
	else
		root.ListAngularArtery.visible = true
	if (e.currentTarget.currentFrame === 6)
		root.ListFacialArtery.visible = false
	else
		root.ListFacialArtery.visible = true
	if (e.currentTarget.currentFrame === 6)
		root.ListInferiorAlveolarArtery.visible = false
	else
		root.ListInferiorAlveolarArtery.visible = true
});

 

    1 reply

    kglad
    Community Expert
    Community Expert
    July 22, 2025

    to start, use console.log() to see if the listener function is being called.

    Participating Frequently
    July 22, 2025
    root.ToggleVessel.on("click", function(e)
    {
    	console.log("Toggle Vessel");
    	
    	root.ListSupraorbitalArtery.gotoAndStop(0)
    	root.ListInfraorbitalArtery.gotoAndStop(0)
    	root.ListAngularArtery.gotoAndStop(0)
    	root.ListFacialArtery.gotoAndStop(0)
    	root.ListInferiorAlveolarArtery.gotoAndStop(0)
    
    	if (e.currentTarget.currentFrame === 6)
    		root.ListSupraorbitalArtery.visible = false
    	else
    		root.ListSupraorbitalArtery.visible = true
    	if (e.currentTarget.currentFrame === 6)
    		root.ListInfraorbitalArtery.visible = false
    	else
    		root.ListInfraorbitalArtery.visible = true
    	if (e.currentTarget.currentFrame === 6)
    		root.ListAngularArtery.visible = false
    	else
    		root.ListAngularArtery.visible = true
    	if (e.currentTarget.currentFrame === 6)
    		root.ListFacialArtery.visible = false
    	else
    		root.ListFacialArtery.visible = true
    	if (e.currentTarget.currentFrame === 6)
    		root.ListInferiorAlveolarArtery.visible = false
    	else
    		root.ListInferiorAlveolarArtery.visible = true
    });

     

    It doesn't look like anything appeared in the console. Nothing appeared in the functions that worked, so I might be putting the console.log() in the wrong place. Or I could be looking in the wrong console.

     

    kglad
    Community Expert
    Community Expert
    July 22, 2025

    the output panel is not your browser's console.  google it.