Page 1 of 1

FlashPlayerForm - can't see anything!

Posted: Mon Dec 12, 2005 4:11 pm
by dave_w
Hi again...

I'm having another issue, this time using the form version, FlashPlayerForm as a splash screen. The way I'm attempting to do this is as follows:

Code: Select all

public class SplashScreen : FlashPlayerControlLibrary.FlashPlayerForm {

   public SplashScreen() {
      if (!FlashPlayerControlLibrary.FlashPlayerForm.IsTransparentModeAvailable()) {
         Console.WriteLine("Transparent mode is not available");
      }

      Stream movieStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("MyAssembly.SplashScreen.swf");
      this.PutMovieFromStream(movieStream);

      this.ShowInTaskbar = false;
      this.Width = 485;
      this.Height = 320;
      this.Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - this.Width / 2;
      this.Top = Screen.PrimaryScreen.WorkingArea.Height / 2 - this.Height / 2;
      this.TopMost = true;
      this.BringToFront();
   }

   public void ShowSplash() {
      start_time = Environment.TickCount;
      this.Show();
      this.FlashMethod_Play();
   }

   public void HideSplash() {
      this.Hide();
   }
}


Then, in the button click handler of a test application's button, I execute the following code:

Code: Select all

public void testButton_Click(object sender, System.EventArgs e) {
     SplashScreen splash = new SplashScreen();
     splash.ShowSplash();
}


... and to my surprise, nothing happens. I can see the splash form as a button in the taskbar if I get rid of "form.ShowInTaskBar = false" which means it's showing. I've tested that the splash movie is being successfully loaded from the resource file. If I use the exact same loading code for the control version, it works fine. I've also tested that the form bounds being passed to the form are ones that would be visible on the screen.

I have also tried a version where the FlashPlayerForm is created and initialised without the use of a SplashScreen subclass, and that doesn't work either.

What am I doing wrong?

As I have incorporated transparency into the splash screen, I can't replace it with a standard windows form containing the FlashPlayerControl - I need to use the FlashPlayerForm.

Kind regards,

Dave.

Posted: Mon Dec 12, 2005 4:38 pm
by Softanics
At the first, please download demo version
http://www.flashplayercontrol.com/downl ... DotNet.zip

and try the project "Sample4_Translucency". All ok?

Posted: Mon Dec 12, 2005 5:02 pm
by dave_w
Yes, the demo application works fine.

Cheers,

Dave.

Posted: Mon Dec 12, 2005 5:31 pm
by Softanics
I see. I found what the problem is. Put the code of the loading not in the constructor, put it in the method ShowSplash():

Code: Select all

public class SplashScreen : FlashPlayerControlLibrary.FlashPlayerForm {

   public SplashScreen() {
      if (!FlashPlayerControlLibrary.FlashPlayerForm.IsTransparentModeAvailable()) {
         Console.WriteLine("Transparent mode is not available");
      }

//      Stream movieStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("MyAssembly.SplashScreen.swf");
//      this.PutMovieFromStream(movieStream);

      this.ShowInTaskbar = false;
      this.Width = 485;
      this.Height = 320;
      this.Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - this.Width / 2;
      this.Top = Screen.PrimaryScreen.WorkingArea.Height / 2 - this.Height / 2;
      this.TopMost = true;
      this.BringToFront();
   }

   public void ShowSplash() {
      start_time = Environment.TickCount;

      Stream movieStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("MyAssembly.SplashScreen.swf");
      this.PutMovieFromStream(movieStream);

      this.Show();
      this.FlashMethod_Play();
   }

   public void HideSplash() {
      this.Hide();
   }
}


I just tested this code and it works fine.

Posted: Mon Dec 12, 2005 5:38 pm
by dave_w
Artem, sorry, I think I have misled you with the test code... I have changed so many things during my tests. I've just ported your VB sample code to C# and it works fine. Unfortunately the test code isn't useful for the splash screen problem, and I'll explain why:

I think the problem I'm having related to the fact that there needs to be a message loop running for the FlashPlayerForm to work.... so your static method that showed the form using ShowDialog() worked fine because ShowDialog sets up its own special message loop (for reasons I won't go into here).

My version, however, called Show() instead, and then went on to do other things (as is the purpose of splash screens :) and only once those things had finished (i.e. creating the main application form and its associated bits and pieces - a time consuming task) did I hide the splash screen and then call Application.Run(myMainForm) ... so the application's message processing loop only started after the splash screen had already been hidden.

So, the new question is this: is there any way of getting the FlashPlayerForm to show without having to load the main form and start it running (which takes a while)? I suppose I could use a hack whereby the main form is a blank, hidden form, which once running loads the rest of the application, but I don't like hacks :) So if there is another cleaner way, I'd prefer that. Any ideas would be appreciated. Thanks!

Kind regards,

Dave.

Posted: Mon Dec 12, 2005 5:40 pm
by dave_w
I wrote that last message before I saw your latest reply, Artem... thank you for finding that problem... do you have any ideas regarding the message loop issue?

Posted: Mon Dec 12, 2005 5:48 pm
by Softanics
dave_w wrote:I wrote that last message before I saw your latest reply, Artem... thank you for finding that problem... do you have any ideas regarding the message loop issue?


For example, you can put your task in a separate thread.

Posted: Tue Jan 10, 2006 10:47 pm
by xsive
Yep a new thread for other forms (especailly about splashes etC) has solved alot of problems for me.

Im having a few hiccups with multiple forms epecially atm. Is there any ideas to support transperancy with the flashplayer control?

The other thing I am wondering about is there going to be any automated handeling of WM messages? ie fro dragging the form but if the user is pressing a button dont drag.

these are all feature requests I realise, but FlashPlayer as it stands ATM is GREAT!!

Good work.

You must have 2 frames in your swf

Posted: Mon Nov 06, 2006 5:31 pm
by jankrod
I thought there was an issue with using ShowDialog but it looks like the FlashPlayerForm can only show swf files that have more than one frame when using ShowDialog.

Both Show and ShowDialog have this issue but with show you can set visible to true, with ShowDialog you can not so you are forced to have 2 frames.

Re: You must have 2 frames in your swf

Posted: Thu Nov 09, 2006 8:32 am
by Softanics
jankrod wrote:I thought there was an issue with using ShowDialog but it looks like the FlashPlayerForm can only show swf files that have more than one frame when using ShowDialog.

Both Show and ShowDialog have this issue but with show you can set visible to true, with ShowDialog you can not so you are forced to have 2 frames.


Could you please try this movie:
http://f-in-box.com/TEMP/SimpleNotepad.swf

It has only one frame and FlashPlayerForm shows it correctly.