I've two php-scripts: the first makes ajax call to the second, which开发者_开发知识库 returns javascript code and div for swfobject. I'm calling the second file twice: after loading page(it works ok and I can see swfobjects) and after users' clicking on button(it not works and div just goes blank). I suggest that embedSWF works ONLY after pages' loading, because my ajax calling is correct. But a way must be found! Any ideas?
Yes, swfobject.embedSWF
is designed to work after page load -- it has a built-in domload event handler.
If you don't want swfobject to automatically embed when the page is loaded, use swfobject.createSWF
instead. The official documentation explains how swfobject.createSWF
works.
EDIT:
After re-reading your post, I see you want to embed a SWF after the page has already loaded. swfobject.embedSWF
can be used in both cases. Here's a tutorial and an example.
精彩评论