开发者

Embedding a SWF Video in an AIR 2 HTML App

开发者 https://www.devze.com 2023-01-15 05:12 出处:网络
I\'ve been through the forums for awhile and I can verify that my issue doesn\'t have to do with transparency or chrome.I have an IFRAME which is in the application sandbox, giving it access to files

I've been through the forums for awhile and I can verify that my issue doesn't have to do with transparency or chrome. I have an IFRAME which is in the application sandbox, giving it access to files in app-storage. Dynamic images are loading fine, but my dynamically generated <OBJECT> code that is placed in the DOM is not loading the SWF video. I can see the object placeholder, but no video.

Are there any requirements to embedding a SWF file, perhaps size requirements (both height and width required)? Given the fact that my content is dynamic and I don't know the dimensions of the SWF file, I currently have two options for embedding:

  1. Calculate the height and width of the parent element, and assign those values to the OBJECT params.
  2. Use 100% width and height on the OBJECT

This might pose problems with the proportions of the SWF file, which I'm hoping can be fixed by the scale PARAM 开发者_如何转开发( http://kb2.adobe.com/cps/127/tn_12701.html ).

Please help, I haven't been able to find any helpful guides yet. I have already followed the documentation for embedding from here to no avail:

http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS4B441C24-BAE3-4110-91FD-A4E5EEFB2467.html


For the hell of it, here is an extensive SWFObject I generated which is working (although overkill):

var SWFObject = document.createElement("object");
SWFObject.setAttribute("type", "application/x-shockwave-flash");
SWFObject.setAttribute("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");
SWFObject.setAttribute("width", "100%");
SWFObject.setAttribute("height", "100%");
SWFObject.setAttribute("id", "movie");

var param1 = document.createElement("param");
param1.setAttribute("name", "movie");
param1.setAttribute("value", 'app-storage:' + filename);

var param2 = document.createElement("param");
param2.setAttribute("wmode", "opaque");

var param3 = document.createElement("param");
param3.setAttribute("bgcolor", "#FFFFFF");

var param4 = document.createElement("param");
param4.setAttribute("allowscriptaccess", "always");

var param5 = document.createElement("param");
param5.setAttribute("quality", "high");

var param6 = document.createElement("param");
param6.setAttribute("flashvars", "wmode=opaque");

var param7 = document.createElement("param");
param7.setAttribute("scale", "ShowAll");

var param8 = document.createElement("param");
param8.setAttribute("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");

SWFObject.appendChild(param1);
SWFObject.appendChild(param2);
SWFObject.appendChild(param3);
SWFObject.appendChild(param4);
SWFObject.appendChild(param5);
SWFObject.appendChild(param6);
SWFObject.appendChild(param7);
SWFObject.appendChild(param8);
0

精彩评论

暂无评论...
验证码 换一张
取 消