Well, for images I have added an onerror event handler to the img tag,
and that works if I add an src value that is not an image.
For Flash, apparently there is an OnReadyStateChange event that I
could hook into. I thought I could somehow leverage that to do what I
need. However, I have no idea how to add a handler for this event in
Javascript. I am attempting to use external interfaces (new to me).
Then I want to attach an event handler for the OnReadyStateChange to
the external interface. I have gotten as far as getting a reference to
the external interface, but now I don't know what the next step is.
Will this approach work, and if so, how do I attach an event handler
here?
Here are the relevant code snippets -
var params = {allowScriptAccess: "always"};
var atts = {id: "ExternalInterfaceExample", name:
"ExternalInterfaceExample"};
swfobject.embedSWF(murl, "c_fl", width, height, "8", null, null,
params, atts, embedSWFCallback);
...
function embedSWFCallback(e) {
var media = document.getElementById('c_fl');
var swf = document.getElementById('ExternalInterfaceExample');
if (e.success) {
swf.addEventListener("onReadyStateChange", "swf_statechange");
}
}
function swf_statechange(state) {
alert(state);
}
Thx.
On Sep 30, 11:35 am, Aran Rhee <[email protected]> wrote:
> Unfortunately, there is no in built way on the client-side of catching if an
> image,Flash, or any other file is not available. You can use PHP etc to
> check in advance:
>
> function image_exists($url)
> {
>
> $info = @getimagesize(urlencode($url));
>
> return((bool) $info);
>
> }
>
> In regards to Flash video, well that is loaded by the swf, not the browser,
> not your error checking would need to be inside Flash (it does have the
> ability to catch errors on load etc)
>
> It is up to the developer to ensure all the assets referenced on the page
> are valid. If you do not control the assets on your page (ie you are loading
> them off some remote domain), then you are out of luck if only relying on
> the client afaik.
>
> Aran
>
>
>
> On Thu, Sep 30, 2010 at 7:05 AM, Peppi <[email protected]> wrote:
> > Hi,
>
> > How can I handle the case where the URL provided to embedSWF does not
> > exist? For example, the SWF file may have been moved or renamed on the
> > hosting server. The call to embedSWF will complete successfully. Even
> > playing the Flash video does not seem to throw any errors, so not sure
> > where the best place to handle this case would be.
>
> > Thx.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "SWFObject" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<swfobject%2bunsubscr...@googlegroups
> > .com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/swfobject?hl=en.
--
You received this message because you are subscribed to the Google Groups
"SWFObject" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/swfobject?hl=en.