Loading a new swf from stream

F-IN-BOX for Delphi / Builder C++ / VCL
pixelthis
Posts: 8
Joined: Wed Aug 27, 2008 4:07 am

Loading a new swf from stream

Postby pixelthis » Thu Aug 28, 2008 2:06 am

Hi,

I load a swf file into the player (part0.swf) using:

Code: Select all

flashPlayer.PutMovieFromStream(fSWFPart1);


After this has run for a while, I try to play a differnt swf:

Code: Select all

flashPlayer.stopPlay;
flashPlayer.PutMovieFromStream(fSWFPart2);
flashPlayer.play;


However, the fist movie (fSWFPart1) seems to still be there, and starts playing again from the start instead of fSWFPart2.

Any ideas?

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

Postby Softanics » Thu Aug 28, 2008 8:41 am

Thank you for your question.

What if to try the following:

Code: Select all

flashPlayer.stopPlay;

flashPlayer.Movie := 'http://EMPTY';

flashPlayer.PutMovieFromStream(fSWFPart2);
flashPlayer.play;


?

Thank you.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

pixelthis
Posts: 8
Joined: Wed Aug 27, 2008 4:07 am

Postby pixelthis » Sat Aug 30, 2008 11:11 am

No, still the same result. The first swf is still loaded.

Any other ideas? Or any chance of a bug fix?

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

Postby Softanics » Sat Aug 30, 2008 1:25 pm

Could you please read this topic:
http://www.f-in-box.com/forum/viewtopic.php?t=461

A customer did find working solution to reset flash control. Please try this method.

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

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

pixelthis
Posts: 8
Joined: Wed Aug 27, 2008 4:07 am

Postby pixelthis » Mon Sep 01, 2008 11:05 pm

Hi,

This method still does not work. My code:

Code: Select all

flashPlayer.stopPlay;
flashPlayer.Movie := 'http://__';
Application.ProcessMessages;

flashPlayer.PutMovieFromStream(fSWFPart2);
flashPlayer.play;


After this code, fSWFPart1 is still playing.

What the 'Application.ProcessMessages' does in the customers case is clear the display, however the old swf file is also probably still loaded :(

It seems I am not able to clear a currently loaded swf and start playing another.

I am hesitant to create the flashPlayer in code, and then free it and create a new instance because of the memory leaks.

Regards,
Peter

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

Postby Softanics » Tue Sep 02, 2008 9:50 am

What about the idea: load some empty movie, and then load new movie?

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

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

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

Postby Softanics » Tue Sep 02, 2008 9:52 am

Also one small test: if you load fSWFPart2 (don't load fSWFPart1 at all), does it play well? May be something wrong with fSWFPart2...

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

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

pixelthis
Posts: 8
Joined: Wed Aug 27, 2008 4:07 am

Postby pixelthis » Tue Sep 02, 2008 10:23 am

Thanks for your continued suggestions. Appreciated.

Yes, fSWFPart2 works on its own (if called first), so that is not the problem.

BUT I am well on my way to finding the solution!

If I remove all calls to externalInterface out of the first swf, then the second swf loads fine!

I will continue to experiment to find out exactly why the bug occurs, and follow this post up.
Last edited by pixelthis on Tue Sep 02, 2008 10:35 am, edited 1 time in total.

pixelthis
Posts: 8
Joined: Wed Aug 27, 2008 4:07 am

Postby pixelthis » Tue Sep 02, 2008 10:34 am

SOLUTION (phew!)

I was calling an external function in Delphi from within Flash when a button in the flash was pressed:

Code: Select all

// Actionscript
on (release){
  flash.external.ExternalInterface.call('exButtonPressed');
}

This then in turn tries to load the next swf file:

Code: Select all

// Delphi
procedure TMainForm.exButtonPressed;
begin
  flashPlayer.PutMovieFromStream(fSWFPart2);
end;

Which results in fSWFPart2 actually not loading.

Thinking about this in hindsight it is very obvious that the swf is awaiting the result of the external interface call, and can therefore not unload itself.

I have not got the exact solution yet, but I may have to set a flag within Delphi, and then check this on a timer or in a thread to load the new movie once Delphi has finshed Flash's external request.

Any suggestions on how to handle this are welome!


Return to “Delphi / Builder / VCL Edition”

Who is online

Users browsing this forum: No registered users and 10 guests