I have got the following code

function tts() {
        var videoElement = document.createElement('video');
        videoElement.setAttribute('src','anim1.ogg');


        videoElement.observe("loadeddata",
                function() {
                        $('response').innerHTML="";
                        $('response').appendChild(videoElement);
                }, true);

        videoElement.observe("ended",
                function() {
                        $('response').innerHTML =
                                "<img src=\"electric_sheep.jpg\" alt=\"avatar\" 
/>"
                }, true);

        videoElement.play();
}

Works fine in FF but i got the annoying error on IE "Object doesn't
support the property or method" on the
videoElement.observe,videoElement.observe, and videoElement.play()
lines.

I have read that the solution is passing the element trought $. i have
tried it, but seems i am doing somethig bad. if i change the the code
to:


function tts() {
        var videoElement = document.createElement('video');
        videoElement.setAttribute('src','anim1.ogg');
    videoElement.setAttribute('id', 'mivideo');
    //alert(videoElement.id);


        $('mivideo').observe("loadeddata",
                function() {
                        $('response').innerHTML="";
                        $('response').appendChild(videoElement);
                }, true);

        $('mivideo').observe("ended",
                function() {
                        $('response').innerHTML =
                                "<img src=\"electric_sheep.jpg\" alt=\"avatar\" 
/>"
                }, true);

        $('mivideo').play();
}


then i get the following error:  $("mivideo") is null, on the first $
('mivideo').observe line, and this time i got it on FF.


Suggestions?

Thanks for your help :)

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to