Load movie when application starts

F-IN-BOX for Delphi / Builder C++ / VCL
andreaarg
Posts: 14
Joined: Tue Aug 26, 2008 11:53 pm

Load movie when application starts

Postby andreaarg » Wed Aug 27, 2008 12:05 am

I successfully loaded flash movies in a Delphi test application by doing the next three steps:
1. Press a button to load the movie (FlashObject.movie = path)
2. Press another button to set some values the flash file needs
3. Press a third button to start the movie, the movie works fine and shows the information according to the values i set in step number 2.

Now, I'm trying to do all that automatically when the delphi application starts, but i get "unspecified errors" when trying to invoke the flash external functions. I guess it's because the flash hasn't fully initializated. I tried: A) initializating external callbcks in the flash movie on the preinitialize event; and B) starting when the OnReadyStateChange event triggers, check the newState parameter and the PercentLoaded movie property
None of those two worked :(

Which is the correct way to do this? how can i be sure that the application has fully initialized?
Thanks in advance.

abb
Posts: 21
Joined: Fri Jan 09, 2009 3:32 pm
Location: Russia

Postby abb » Fri Jan 09, 2009 4:07 pm

Hi, All,

Despite to very old question, I guess it may be still of interest for anybody...

As far as I understand the problem, the solution is in Flash, rather than in the Delphi application. You can't set Flash variables "synchronously", i.e. to wait an "immediate" result after you've set them. This is because Flash Player works with external variables setting in asynchronous mode. It is required to let Flash movie play to get some result. It is impossible to play the movie until your application will be fully initialized. This is because Flash player must receive normal Windows messages to work.

The solution I use in such case is the next. In Flash I use LoadVariables() call with subsequent onEnterFrame handler assignment, which will check f required variable is set or not. This handler kills itself after the variable is set and initiates main movie playback.

We catch OnLoadExternalResource() event at Delphi side, and check the SRC parameter. We respond with the WWWURLEncoded string of variables if we have our LoadVariables call, as SRC.

HTH!


Return to “Delphi / Builder / VCL Edition”

Who is online

Users browsing this forum: No registered users and 24 guests

cron