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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:28:09+00:00 2026-05-20T18:28:09+00:00

I am sending an event when an sql query returns no matches so that

  • 0

I am sending an event when an sql query returns no matches so that I can continue with the addition to the database.. It seems like actionscript is requiring that I attach the listener to something, but I don’t really have any variables that seem like logical candidates at the point where I am in my code.

I just want to listen for the isNewRecord event to be called so that I can then run the insert query; right now it’s saying call to possibly undefined method for addEventListern and for dispatchEvent

public function addBG(BG:Number, datetime:String, batch:Boolean = false):void{
        checkRecord('Gb', datetime, matchRecord);

        addEventListener("isNewRecord", recordExists);

        function recordExists()
        {/*code to execute query*/}

public function matchRecord(result:SQLResult):void {
        var match:String = result.data[0];
        if (match == null) {
            var allClear:Event = new Event("isNewRecord");
            dispatchEvent(allClear);
        }
    }
  • 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-20T18:28:10+00:00Added an answer on May 20, 2026 at 6:28 pm

    Your code is buggy. You have a function within a function.

    Also, is your code extending EventDispatcher class (or any class that extends it, like Sprite, MovieClip, etc.?) Make sure it is.

    Try this:

    public function addBG(BG:Number, datetime:String, batch:Boolean = false):void
    {
            // note, you're adding this event listener EVERY TIME you call the 
            // addBG function, so make sure you remove it OR add it somewhere in the
            // init or complete functions
    
            addEventListener("isNewRecord", recordExists);
            checkRecord('Gb', datetime, matchRecord);    
    }
    public function recordExists():void
    {/*code to execute query*/}
    
    public function matchRecord(result:SQLResult):void {
            var match:String = result.data[0];
            if (match == null) {
                var allClear:Event = new Event("isNewRecord");
                dispatchEvent(allClear);
            }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use Event log like that: if(!EventLog.SourceExists(Service)) EventLog.CreateEventSource(Service,Sending notification email error); EventLog.WriteEntry(Service, System.String.Format(Sending notification
I'm sending a page event: page.sendEvent('click', 650, 430); This clicks a link that dynamically
I am trying to capture the cancel event when sending mail, so I can
I've got a very long query for our SQL Server 2000 database, and I
I am sending an ajax request which is called on change event of a
I sending ajax request from a jQuery file like below, which expects response in
What would be the correct way of receiving and sending an event when a
I'd like to update SQL when a textbox is changed by the user, but
On console, I have this message: backboardd[51] : BKSendGSEvent ERROR sending event type 23:
I have a service which returns an Array of ObjectProxy objects. I would like

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.