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 6382219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:29:41+00:00 2026-05-25T02:29:41+00:00

I am trying to write a smooth transition piece and I don’t know what

  • 0

I am trying to write a smooth transition piece and I don’t know what is happening.
I left it last night and it was working, I think, now its not.

here it is.

function btnclick(event:Event):void
{   
    if(event.target == load1 || load2)
    { 
        trace("working");
    } 
    else 
    {
        trace("not ");
    }
}

on my stage, I have 3 buttons,

load1.addEventListener(MouseEvent.CLICK, btnclick);
load2.addEventListener(MouseEvent.CLICK, btnclick);
load3.addEventListener(MouseEvent.CLICK, btnclick);

the 3 buttons instances are

load1, load2 and load3.

When i click buttons load1 or load2, I get the trace “working”, but when I press button load3, i am still getting “working” when its supposed to say “not”

just to check i changed it to this:

function btnclick(event:Event):void
{
    if(event.target == load1 || load2) 
    {
            trace("working");
    } 
    else if (event.target == load3)
    {
            trace("not ");
    }
}

and the same problem, they all say “working”

Any ideas what it is that I am missing?

  • 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-05-25T02:29:41+00:00Added an answer on May 25, 2026 at 2:29 am

    Try this:

    function btnclick(event:Event):void{
    
    
        if(event.target == load1 || event.target == load2) {
               trace("working");
              } else {
                   trace("not ");
               }
    
    }
    

    But I recommend you to use currentTarget instead of target:

    function btnclick(event:Event):void{
    
    
        if(event.currentTarget == load1 || event.currentTarget == load2) {
               trace("working");
              } else {
                   trace("not ");
               }
    
    }
    

    The problem with you code was in event.target == load1 || load2. And it is equivalent of (event.target == load1) || (load2) where Boolean(load2) is true if load2 isn’t null. So event.target == load1 || load2 is always true in your case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to write a byte[] to a file, which i think is working correctly
I'm trying write a query to find records which don't have a matching record
Trying to write out syslog entries containing strings but they don't register. // person.name
Trying to write a piece of code to compare two strings. If either are
I am trying write a function that generates simulated data but if the simulated
Trying to write a PowerShell cmdlet that will mute the sound at start, unless
Trying to write a couple of functions that will encrypt or decrypt a file
Trying to write a chat, like on facebook, I wondered if two clients can
Trying to write a function to see how often an object exists and give
Trying to write a code at the moment that basically tests to see if

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.