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

  • Home
  • SEARCH
  • 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 8410589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:13:03+00:00 2026-06-10T00:13:03+00:00

I have an interval that runs every 3 seconds to check for new data.

  • 0

I have an interval that runs every 3 seconds to check for new data. If it finds new data it broadcasts a dataChange event and my item renderer is updated.

I need to test a comparison for when two times match exactly…for one time only. Meaning, the data comes back is a meeting. The meeting starts at 3pm. When the match is run, the meeting turns blue and users can enter.

I broadcast a dataChange event for when the compared times match but I don’t want to keep broadcasting it over and over, i.e.

private static const NOW_OFFSET_TIME:Number = 1000 * 60 * 15;

    private function shouldShowNow(start:Date, end:Date):Boolean
    {
        var now:Date = new Date;

        var stime:Number = start.time - NOW_OFFSET_TIME;
        var etime:Number = end.time;

        return ((now.time >= stime) && (now.time <= etime));
    }

In the code above, the condition will always return true once

now.time >= stime

…and the dataChange event gets run over and over and over.

But my interval runs only 3 seconds so it won’t trap an exact match. Heck, I even switched my interval to every 500 ms and it won’t trap it.

What are my other options?

Thanks for any helpful input.

UPDATE: I could do this (but I’d have to run my interval every second):

private static const NOW_OFFSET_TIME:Number = 1000 * 60 * 15;

    private function shouldShowNow(start:Date, end:Date):Boolean
    {
        var now:Date = new Date;
        var match:Boolean;

        if( now.hours == start.hours && now.minutes == ( start.minutes - 15 ) && now.seconds == start.seconds ){
            match = true;
        }else{
            match = false;
        }

        return match;
    }

And here is the handler for the interval in full:

/*
                            We want to compare the current upcomingCalendarList collection 
                            against the collection returned; if they are different, update the UI.
                        */
                        var meetingsData:ArrayCollection = new ArrayCollection();
                        meetingsData = getArrayCollectionFromXML( event.result.response.participantMeetingList.meeting );

                        var cachedColl:ArrayCollection = com.fmr.transporter.model.GeneralInfoModel.getInstance().upcomingMeetingList;
                        var returnedColl:ArrayCollection = meetingsData;
                        var updates:Boolean = false; // our flag to let us know if there are changes in the meeting list

                        if( returnedColl != null )
                        {
                            // Meetings have been added/removed
                            if( cachedColl.length != returnedColl.length ){
                                updates = true;
                            }
                            // Look for meeting  updates
                            else
                            {
                                for( var i:int=0;i<cachedColl.length;i++ ){
                                    var currMeeting:MeetingVO = cachedColl[i] as MeetingVO;

                                    for( var j:int=0;j<returnedColl.length;j++ ){
                                        var returnedMtg:ObjectProxy = returnedColl[j];
                                        /*
                                            We want to ensure we're comparing the same meeting (meetingID) for
                                            any changes.
                                        */
                                        if( currMeeting.meetingID == returnedMtg.meetingId )
                                        {
                                            var startTime_GMT:Date = converServerUTCTimeStampToLocalDate( returnedMtg.startTime );
                                            var endTime_GMT:Date = converServerUTCTimeStampToLocalDate( returnedMtg.endTime );

                                            if( ObjectUtil.dateCompare( currMeeting.startTime, startTime_GMT ) != 0 )
                                                updates = true;
                                            else if( ObjectUtil.dateCompare( currMeeting.endTime, endTime_GMT ) != 0 )
                                                updates = true;
                                            else if( currMeeting.meetingName != returnedMtg.meetingName )
                                                updates = true;
                                            else if( this.shouldShowNow( startTime_GMT, endTime_GMT ) )
                                                updates = true;
                                        }
                                    }
                                }
                            }
                            // If there are no updates, leave the cached collections alone. 
                            if( !updates ){
                                return;
                            }
                        }
  • 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-10T00:13:04+00:00Added an answer on June 10, 2026 at 12:13 am

    It looks like it would be best for you to add a property to your MeetingVO class to track whether you’ve shown it already. something like public var hasBeenShown:Boolean = false

    Then, in you else if where you call shouldShowNow, update it to this:

    else if (!currMeeting.hasBeenShown && this.shouldShowNow(startTime_GMT, endTime_GMT, currMeeting))
    

    Then in your shouldshowNow function, update it to this:

    private function shouldShowNow(start:Date, end:Date, meeting:MeetingVO):Boolean
    {
        var now:Date = new Date;
    
        var stime:Number = start.time - NOW_OFFSET_TIME;
        var etime:Number = end.time;
    
        if((now.time >= stime) && (now.time <= etime)){
            meeting.hasBeenShown = true;
            return true;
        }
    
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a WCF method that runs an infinite loop, polling every 5
I have a Node.js process (setInterval) that runs every 100ms. I have certain actions
I have a time interval that spans years and I want all the time
I have a loop that fades between images, with an interval set by the
Possible Duplicate: Run a code in given time interval I have a method that
I have a CFC method that I would like to run at an interval
I would like run a PHP script that runs every second to update a
I have an application that is a data poller/updater and there are tons of
I have a program that runs in Python 2 and Python 3, but there
I have a small if statement that runs when a function is run. 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.