开发者

Fullscreen Flash Slideshow

开发者 https://www.devze.com 2023-03-09 20:55 出处:网络
Previously I\'d worked on a flash application that would be embedded into a webpage at 100x20 that loaded a graphic for a button based on XML. When the button was clicked, the application would go ful

Previously I'd worked on a flash application that would be embedded into a webpage at 100x20 that loaded a graphic for a button based on XML. When the button was clicked, the application would go full-screen via AS3.

stage.displayState = StageDisplayState.FULL_SCREEN;

This worked great - the application went full-screen as expected.

Today I need to redevelop the application so that the SWF will launch full-screen via JavaScript (so that they can add the launch functionality to a link and whatnot).

I moved the above code from the _click(e:MouseEvent) function and placed it straight into the constructor of the application document class. However this doesn't work when it's embedded on 开发者_开发问答a web page? When I open the SWF on my PC it works fine (launches into full-screen straight away). Just doesn't wanna happen when it's on a web-page.

Here is the JS that I am using to load my SWF.

// vars
var xml = <?php echo $_GET["xml"]; ?>;

/**
 * Launch fullscreen flash slideshow
 */
function launch()
{
    var object = '<object width="1" height="1"><param name="allowfullscreen" value="true" />';
    object += '<param name="wmode" value="transparent" /><param name="flashvars" value="xmllocation=http%3A%2F%2Fimagetrack.com.au%2Fsc%2Fsc.xml%3Fid%3D' + xml + '" />';
    object += '<embed width="1" height="1" src="application.swf?xmllocation=http%3A%2F%2Fimagetrack.com.au%2Fsc%2Fsc.xml%3Fid%3D' + xml + '" wmode="transparent" allowfullscreen="true" />';
    object += '</object>';

    var e = $(object);
    var p = $("body");

    p.append(e);
}

Which obviously just appends the object to the page. Is there another way I can go about this? Or am I just missing something simple? I'm guessing the reason is that full-screen is blocked unless it's user-initiated.


This is a flash security restriction. You absolutely cannot launch flash into fullscreen without explicitly doing so from a click event.

http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c5d.html

0

精彩评论

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

关注公众号