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.

$(window).load

otherwise, if using swfobject, like

swfobject.addloadevent(function() {    $("#swf_id").get(0).inited(callsomeotherfunction());  }); 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -