Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7728265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:40:33+00:00 2026-06-01T05:40:33+00:00

Im building a sample pad type instrument for a project, i have four channels

  • 0

Im building a sample pad type instrument for a project, i have four channels for four different instruments the interface has four buttons to select the instrument, when the button is selected the image should be green but when another instrument is selected it should go to the second frame of the movie clip which is a red button to signal them instrument is off.

Line 23 i added a conditional statment for the variable associated with the channels it doesnt spit out any errors but also doesnt change the image when i click another button anyone know where im going wrong

//import flash stuff

import flash.events.MouseEvent;
import flash.display.MovieClip;

stop();

//event listener for the power button

poweroff.addEventListener(MouseEvent.CLICK, mouseClick1);

function mouseClick1(event:MouseEvent):void{
gotoAndStop(1);
}

//select which samples to use with event listener,
//changes var selector bellow, so input listens for
//different samples

drumSelector.addEventListener(MouseEvent.CLICK, drumClick);
function drumClick(event:MouseEvent):void{
selector = drums;
if (selector == drums) 
{
drumSelector.gotoAndStop(1);
}else{
drumSelector.gotoAndStop(2);
}

}

bassSelector.addEventListener(MouseEvent.CLICK, bassClick);
function bassClick(event:MouseEvent):void{
selector = bass;
}

synthSelector.addEventListener(MouseEvent.CLICK, synthClick);
function synthClick(event:MouseEvent):void{
selector = synth;
}

beatSelector.addEventListener(MouseEvent.CLICK, beatClick);
function beatClick(event:MouseEvent):void{
selector = beat;
}

//selects which movieclip samples to use for input

var selector:MovieClip = drums;


//listen for events on display keyboard
//make movieclips visible so they can play samples

key1.addEventListener(MouseEvent.CLICK, key1Click);
function key1Click(evt:MouseEvent):void
{
selector.i1.visible=true;
}

key2.addEventListener(MouseEvent.CLICK, key2Click);
function key2Click(evt:MouseEvent):void
{
selector.i2.visible=true;
}

key3.addEventListener(MouseEvent.CLICK, key3Click);
function key3Click(evt:MouseEvent):void
{
selector.i3.visible=true;
}

key4.addEventListener(MouseEvent.CLICK, key4Click);
function key4Click(evt:MouseEvent):void
{
selector.i4.visible=true;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:40:34+00:00Added an answer on June 1, 2026 at 5:40 am

    Create a new function for conditional like:

    function updateSelector(){
    
      if (selector == drums) 
      {
          drumSelector.gotoAndStop(1);
      }else{
          drumSelector.gotoAndStop(2);
      }
    }
    

    Then in each button handler:

    bassSelector.addEventListener(MouseEvent.CLICK, bassClick);
    
    function bassClick(event:MouseEvent):void{
        selector = bass;
        updateSelector();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a UserControl that has four ListBoxes on it that I have
i'm building a wpf control based on the outlook calender sample in code project,
I am building a query on a generic table Sample and I have several
I have a problem building a regex. this is a sample of the text:
I have a sample I'm building, that's using the Northwind database. I have a
I am learning Spring and building a sample app. I am getting the error:
Building a sample ASP.NET MVC app. Using the Membership API for authentication. For whatever
I've been building my sample asp.net application using VWD2008 and the development virtual server
I'm currently building a program which needs to interface with the d-bus. I'm using
I am building a sample site to familiarize myself with RoR. I followed the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.