Problem Finding an object
Hi,
I have a function that creates a custom flash media player object. Once it has been created, I'm trying to call its "PlayVideo" method. However, the DOM doesn't recognize the object unless I do an "alert" in front of it (then it works fine). How or what can I use to find the element? Below is the code:
[code]
$('.media-player .thumbnails .thumbnail').click(function(){
playerInfo = $(this).attr('id').split('-');
displayMediaItem(playerInfo[1],playerInfo[2]);
});
displayMediaItem = function(playerID, thumbID) {
output = '<div id="video-' + ns.CurrentVideoID + '"></div>';
$('#media-player-' + playerID + ' .media-item').html(output);
swfobject.embedSWF // etc...
// This works when I put an alert in front. If I remove the alert, it does not work
alert('hmmm');
if ($('#video-' + CurrentVideoID)[0].PlayVideo != null) {
$('#video-' + CurrentVideoID)[0].PlayVideo();
}
};
[/code]
Thanks
James