flex - Javascript: Flash callback method produces error UNLESS alert() first? -
ok have flex app , adding callback method this:
private function init():void { externalinterface.addcallback( "playvideo", playvideo ); } private function playvideo(videosource:string):boolean { videodisplay.source = videosource; return true; }
i calling javascript this:
function showvideo(video) { document.getelementbyid("video_overlay").style.display = "block"; //alert('no error'); document.getelementbyid("minimacvideopreview").playvideo('https://www.kranichs.com/instore/minimac/videos/'+video); }
i javascript error:
object not support property or method.
however if uncomment , run alert first. no error , works perfectly.
my first thought alert buying time until script execute, tried run script inside settimeout() did not work.
any ideas?
thanks!
i try placing code in jquery's $(window).load
function. have feeling right. time close alert, dom , contents finished loading , can make externalinterface callback method.
otherwise, if using swfobject, like
swfobject.addloadevent(function() { $("#swf_id").get(0).inited(callsomeotherfunction()); });
Comments
Post a Comment