Page 1 of 1
question about loadmovie method and OnLoadExternalResource
Posted: Tue Nov 18, 2008 5:18 am
by coolshadow
OnLoadExternalResource event will be called when the flashplayercontrol begin to load a resource.
But I find that, if you call loadmovie method, OnLoadExternalResource will not be called.
How can I to make this?
OnLoadExternalResource will be called after we call loadmovie method?
Posted: Tue Nov 18, 2008 5:28 am
by coolshadow
sometimes the _url of mainswf will be checked by flash, so if we can't use loadmovie method to load the mainswf, problem happens.
Posted: Tue Nov 18, 2008 7:41 pm
by Softanics
Thank you for your question.
Do you mean that Flash checks an URL and OnLoadExternalResource is not called? Could you please show me an example?
Thank you.
Posted: Wed Nov 19, 2008 3:36 am
by coolshadow
I've send you a email with a sample swf file.
And I describe the question in the email.
Thanks.
Posted: Thu Nov 20, 2008 9:49 am
by Softanics
The task is the following.
For example, a flash movie contains the code:
Code: Select all
if(this._url=="WWW.AAA.COM")
{
gotoAndStop(3);
}else{
gotoAndStop(2);
}
If we load such movie using LoadMovieFromStream, gotoAndStop(2); is executed. But how to make the movie thinking that this._url is really "WWW.AAA.COM"?
The solution.
Use a global handler to provide content of the movie:
Code: Select all
FlashPlayerControl.SetGlobalOnLoadExternalResourceHandler(ContentProvider);
FlashPlayerControl1.Movie := 'http://WWW.AAA.COM';
...
procedure TMainForm.ContentProvider(const URL: WideString; Stream: TStream);
begin
if URL = 'http://WWW.AAA.COM' then
begin
// For example, copy data from TResourceStream to Stream
end;
end;
Thank you.