I have an object/embed on my page:
<object type="application/x-shockwave-flash" width="100%" height="{$height}" id="chat_shell"
data="js/8wayrun/irc/lightIRC.swf?host={$server}{$params}{$extras}{$styles}">
<param name="movie" value="js/8wayrun/irc/lightIRC.swf" />
<param name="allowfullscreen" value="true" />
<param name="wmode" value="transparent" />
<param name="flashvars" value="host={$server}{$params}{$extras}{$styles}" />
</object>
When I click a button, it activates some jQuery scripting…
$('#chat_shell').animate({ height: $('#chat_shell').height() + slideHeight }, slideSpeed);
But instead, when I click the button, I get the following error:
Uncaught TypeError: Cannot read property ‘0’ of undefined
Why is this happening and how do I fix it? I know a possible solution is to wrap the object/embed into a DIV, set the height to 100% and then edit the height of the DIV; but that is an inelegant solution and often has compatibility problems as height should really never be set to 100%.
Have you tried checking that
$('#chat_shell').height()works on it’s own?I tried out your code on a flash element on my site and it worked fine, so it would lead me to believe the issue is arising from elsewhere.
Have you checked the event handler for your button fires properly?
Have you checked that JQuery is initializing properly?
Have you tried other browsers?