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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:29:01+00:00 2026-06-09T22:29:01+00:00

I have a C# progranm that is using a Flash control to play a

  • 0

I have a C# progranm that is using a Flash control to play a movie. The problem I’m having is when I try to send a message to Actionscript before the movie has completely loaded I receive an error. To resolve the problem I set a timer to wait 1 second before continuing. That in turn created a different problem because I’m now running on a different thread. To resolve that problem I’ve tried using Invoke in the timer event handler but it doesn’t seem to actually invoke the method for some reason. I can see that 50% of the cpu is being used by the process but it never comes back from the Invoke statement. I have looked at a number of questions and I have tried 4 or 5 of different ways to use the Invoke and BegainInvoke methods. The design of my applications is that I have a main class that instantiates the form. The constructor of the form loads and starts to play the movie. The main class sets the timer and the tries to show the form, which is where the problem occurrs.

    public MyClass()
    {
        demoForm = new DemoForm();

        timer.Elapsed += new ElapsedEventHandler(engine);

        timer.Interval = 1000;
        timer.Enabled = true;

        for (int i = 0; ; i++)
            counter++;
    }

    private void engine(Object source, ElapsedEventArgs e)
    {

        timer.Enabled = false;

        if (demoForm.InvokeRequired)
        {
            demoForm.BeginInvoke(new MethodInvoker(sendNextMessage));
        }
        else
        {
            sendNextMessage();
        }

    }

    private void sendNextMessage()
    {
        // It never gets here!!!
    }
  • 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-09T22:29:03+00:00Added an answer on June 9, 2026 at 10:29 pm

    This is an infinite busy loop:

      for (int i = 0; ; i++)
            counter++;
    

    The construction of your object will never complete, and you are probably blocking the GUI thread which will prevent any messages from being handled, including the Invoke.

    You are probably seeing 50% CPU usage because you have a dual core processor. One of the cores is sitting in the busy loop repeatedly incrementing the counter. The other core is idle.

    You say that you were using the loop to prevent the application from terminating, but this is not the correct way to do it. You should call Application.Run from the main method. Visual Studio adds this code automatically for you when you create a new Windows Forms project.

    Suggestion

    Create two forms. Put the Flash control in its own form and show that form first. When that form is closed, you can then open the second form to show the rest of your application.

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

Sidebar

Related Questions

Greeting, I have a problem with flash media live encoder CS5 that when I
I have a small task in Flash, that I'm having a little trouble with.
I have a program that draws some vector graphics using System.Drawing and the Graphics
I have a program that gets a JSON from the server using getJSON and
I have a program that loads an image from a file with DirectX using
I have a Java program that opens a file using the RandomAccessFile class. I'd
I have a Java program that connects to a webserver using SSL/TLS, and sends
I have a calendar program that I am trying to convert to iPad (using
I have a C program that stores some object in java store using JNI.
I have a c program that is trying to read in a file. Using

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.