davidkomer
davidkomer

Reputation: 3078

embed swf in htmlloader with captive runtime

I have a file "test.swf" sitting in the same directory as the air app, and I have the following actionscript...

var htmlLoader:HTMLLoader = HTMLLoader.createRootWindow(true, options,false, new Rectangle(0,0,1024, 768));
htmlLoader.loadString(***STRING****);

Where STRING is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
  <object type="application/x-shockwave-flash" width="1024" height="768"> 
        <param name="movie" value="app:/test.swf" />
        <param name="wmode" value="opaque" />
    </object>
</body>
</html>

Any idea why test.swf doesn't display?!

I also tried <param name="movie" value="test.swf" /> and <param name="movie" value="/test.swf" />

NOTE: <param name="movie" value="http://location.on.web/test.swf" /> does work, but I need this specifically for local playback.

Upvotes: 1

Views: 822

Answers (1)

merv
merv

Reputation: 76730

By default, HTML loaded using the loadString() method is not placed in a sandbox for local storage access. To enable it you need to set the placeLoadStringContentInApplicationSandbox property first:

htmlLoader.placeLoadStringContentInApplicationSandbox = true;

And yes, I do think that is the longest property name in the entire AS3 library.

Upvotes: 2

Related Questions