FlashPlayerForm - can't see anything!

.NET Edition of the F-IN-BOX
dave_w
Posts: 6
Joined: Mon Dec 12, 2005 6:03 am

FlashPlayerForm - can't see anything!

Postby dave_w » Mon Dec 12, 2005 4:11 pm

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.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Dec 12, 2005 4:38 pm

At the first, please download demo version
http://www.flashplayercontrol.com/downl ... DotNet.zip

and try the project "Sample4_Translucency". All ok?
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

dave_w
Posts: 6
Joined: Mon Dec 12, 2005 6:03 am

Postby dave_w » Mon Dec 12, 2005 5:02 pm

Yes, the demo application works fine.

Cheers,

Dave.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Dec 12, 2005 5:31 pm

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.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

dave_w
Posts: 6
Joined: Mon Dec 12, 2005 6:03 am

Postby dave_w » Mon Dec 12, 2005 5:38 pm

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.

dave_w
Posts: 6
Joined: Mon Dec 12, 2005 6:03 am

Postby dave_w » Mon Dec 12, 2005 5:40 pm

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?

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Dec 12, 2005 5:48 pm

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.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

xsive
Posts: 2
Joined: Tue Jan 10, 2006 12:16 pm

Postby xsive » Tue Jan 10, 2006 10:47 pm

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.

jankrod
Posts: 8
Joined: Wed Jul 19, 2006 5:12 pm

You must have 2 frames in your swf

Postby jankrod » Mon Nov 06, 2006 5:31 pm

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.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Re: You must have 2 frames in your swf

Postby Softanics » Thu Nov 09, 2006 8:32 am

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.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html


Return to “.NET Edition”

Who is online

Users browsing this forum: No registered users and 18 guests

cron