views:

216

answers:

1

I have the following js. If the flv url doesn't exist the onError function is called which is great.

However currently it displays the alert and then proceeds to display an unfriendly error message. How can i override this message with something more user friendly.

$f(videoid, "/swf/flowplayer-3.1.5.swf", { 

    playlist: list1, 
    wmode: 'opaque', 
    plugins: { 
        gatracker: { 
            url: "/swf/flowplayer.analytics-3.1.5.swf", 
            trackingMode: "Bridge", 
            debug: false 
        } 
    }, 
    onError: function(err) { 
    alert('Error Code: ' + err);  
  } 

}); 
A: 

Not really sure what you had in mind but you could do something like this.

Place this where you want your error message to show

<div id="errorbox"></div>

Paste this in your CSS

#errorbox{
    color: #D8000C;
    border: 2px solid #D8000C;
    background-color: #FFBABA;
}

And change the javascript to this

$f(videoid, "/swf/flowplayer-3.1.5.swf", { 
    playlist: list1, 
    wmode: 'opaque', 
    plugins: { 
        gatracker: { 
            url: "/swf/flowplayer.analytics-3.1.5.swf", 
            trackingMode: "Bridge", 
            debug: false 
        } 
    }, 
    onError: function(err) { 
        $('#errorbox').text('Your error message.... '+ err).fadeIn('fast');
  } 
});

What this will do is make an error message show up where ever you pasted that HTML in a nice user friendly way. Hope this helps, but it's hard to know exactly what you mean.

Ben Shelock