That definitely should work. I personally added an onLoad handler to the swf object.
On Thu, Dec 2, 2010 at 9:17 AM, stratboy <[email protected]> wrote: > I think that's the problem. I was just going to post the solution I > just found, and it seems related to what you are saying here. > > Basically, I let flash start the comunication, so I'm sure that it is > there. > > AS > > import flash.external.ExternalInterface > > function js_callable(){ > test_txt.text = 'ok--'; > } > > ExternalInterface.addCallback('swf_action',js_callable); > ExternalInterface.call('js_function'); > > JS > > var js_function; > > window.addEvent('domready',function(){ > var swfobj = new Swiff('files/swf/italy.swf',{ > id:'italy', > container:'italy-flash', > width:280, > height:323, > params:{ > bgcolor:'#ffffff', > wmode:'opaque', > allowScriptAccess:'always' > } > }); > > js_function = function(){ > $('italy').swf_action(); > } > }); > > This warks for me. Tested mac/pc ie7/8 ff safari. > > Bye! > > > > On 2 Dic, 17:45, Sean McArthur <[email protected]> wrote: > > When I was using ExternalInterface earlier this year, I noticed that you > > can't access any exposed method until the swift has finished loading. > > > > Sean McArthur > > On Dec 2, 2010 8:38 AM, "stratboy" <[email protected]> wrote: > > > > > Some of my code: > > > > > AS > > > stop(); > > > import flash.external.ExternalInterface > > > > > function js_callable(){ > > > test_txt.text = 'ok'; > > > } > > > > > ExternalInterface.addCallback('swf_action',js_callable); > > > > > JS > > > > > window.addEvent('domready',function(){ > > > > > var swfobj = new Swiff('files/swf/italy.swf',{ > > > id:'italy', > > > container:'italy-flash', > > > width:280, > > > height:323, > > > params:{ > > > bgcolor:'#ffffff', > > > wmode:'opaque', > > > allowScriptAccess:'always' > > > } > > > }); > > > > > Swiff.remote(swfobj,'swf_action'); //__flash__argumentsToXML is not > > > defined > > > > > console.log($('italy')); //ok > > > $('italy').swf_action(); //$("italy").swf_action is not a function > > > > > }); >
