Flex full screen

Source: Internet
Author: User
This morning, the flex full screen error occurs: securityerror: Error #2152: Full Screen mode is not allowed.
I searched the internet and solved the problem. Reference: http://hi.baidu.com/fanglor/blog/item/068e7bfc3c793b84b801a07a.html
Reprinted as follows:

Mxml:

-----------------------------------------

<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: MX =" Http://www.adobe.com/2006/mxml "Layout =" absolute ">
<Mx: SCRIPT>
<! [CDATA [
Import flash. display .*;

Private function full1 (EVT: mouseevent): void
{
If (this. Stage. displaystate = stagedisplaystate. full_screen)
{
This. Stage. displaystate = stagedisplaystate. normal;
Stage. scalemode = stagescalemode. no_scale;
}
Else
{
This. Stage. displaystate = stagedisplaystate. full_screen;
Stage. scalemode = stagescalemode. no_scale;
}
}
]>
</MX: SCRIPT>
<Mx: button label = "full screen" Click = "full1 (Event) "x =" 28 "Y =" 26 "width =" 61 "Height =" 37 "fontsize =" 12 "/>
</MX: Application>

-----------------------------------------

HTML:

----------------------------------------

<! -- Save from url = (0014) about: Internet -->
<HTML lang = "en">

<! --
Smart developers always view source.

This application was built using Adobe Flex, an open source framework
For building rich Internet applications that get delivered via
Flash Player or to your tops via Adobe AIR.

Learn more about flexHttp://flex.org/
// -->

<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>

<! -- Begin browser history required section -->
<LINK rel = "stylesheet" type = "text/CSS" href = "History/history.css"/>
<! -- End browser history required section -->

<Title> </title>
<SCRIPT src = "ac_oetags.js" Language = "JavaScript"> </SCRIPT>

<! -- Begin browser history required section -->
<SCRIPT src = "History/history. js" Language = "JavaScript"> </SCRIPT>
<! -- End browser history required section -->

<Style>
Body {margin: 0px; overflow: hidden}
</Style>
<Script language = "JavaScript" type = "text/JavaScript">
<! --
//-----------------------------------------------------------------------------
// Globals
// Major version of Flash required
VaR requiredmajorversion = 9;
// Minor version of Flash required
VaR requiredminorversion = 0;
// Minor version of Flash required
VaR requiredrevision = 28;
//-----------------------------------------------------------------------------
// -->
</SCRIPT>
</Head>

<Body scroll = "no">
<Script language = "JavaScript" type = "text/JavaScript">
<! --
// Version check for the flash player that has the ability to start player product install (6.0r65)
VaR hasproductinstall = detectflashver (6, 0, 65 );

// Version check based upon the values defined in globals
VaR hasrequestedversion = detectflashver (requiredmajorversion, requiredminorversion, requiredrevision );

If (hasproductinstall &&! Hasrequestedversion ){
// Do not modify the following four lines
// Location visited after installation is complete if installation is required
VaR mmplayertype = (isie = true )? "ActiveX": "plugin ";
VaR mmredirecturl = Window. location;
Document. Title = Document. Title. Slice (0, 47) + "-Flash Player installation ";
VaR mmdoctitle = Document. title;

Ac_fl_runcontent (
"Src", "playerproductinstall ",
"Flashvars", "mmredirecturl =" + mmredirecturl + '& mmplayertype =' + mmplayertype + '& mmdoctitle =' + mmdoctitle + "",
"Width", "100% ",
"Height", "100% ",
"Align", "Middle ",
"ID", "fullstate ",
"Quality", "high ",
"Bgcolor", "#869ca7 ",
"Name", "fullstate ",
"Allowfullscreen", "true ",
"AllowScriptAccess", "samedomain ",
"Type", "application/X-Shockwave-flash ",
"Pluginspage "," Http://www.adobe.com/go/getflashplayer "
);
} Else if (hasrequestedversion ){
// If we 've detected an acceptable version
// Embed the Flash content SWF when all tests are passed
Ac_fl_runcontent (
"Src", "fullstate ",
"Width", "100% ",
"Height", "100% ",
"Align", "Middle ",
"ID", "fullstate ",
"Quality", "high ",
"Bgcolor", "#869ca7 ",
"Name", "fullstate ",
"Allowfullscreen", "true ",
"AllowScriptAccess", "samedomain ",
"Type", "application/X-Shockwave-flash ",
"Pluginspage "," Http://www.adobe.com/go/getflashplayer "
);
} Else {// flash is too old or we can't detect the plugin
VaR alternatecontent = 'alternate HTML content shoshould be placed here .'
+ 'This content requires the Adobe Flash Player .'
+ '<A href = http://www.adobe.com/go/getflash/> get flash </a> ';
Document. Write (alternatecontent); // insert non-Flash Content
}
// -->
</SCRIPT>
<NoScript>
<Object classid = "CLSID: D27CDB6E-AE6D-11cf-96B8-444553540000"
Id = "fullstate" width = "100%" Height = "100%"
Codebase =" Http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab ">
<Param name = "movie" value = "fullstate.swf"/>
<Param name = "quality" value = "high"/>
<Param name = "bgcolor" value = "#869ca7"/>
<Param name = "allowfullscreen" value = "true"/>
<Param name = "allowScriptAccess" value = "samedomain"/>
<Embed src = "fullstate.swf" Quality = "high" bgcolor = "#869ca7"
Width = "100%" Height = "100%" name = "fullstate" align = "center"
Play = "true"
Loop = "false"
Quality = "high"
Allowfullscreen = "true"
AllowScriptAccess = "samedomain"
Type = "application/X-Shockwave-flash"
Pluginspage =" Http://www.adobe.com/go/getflashplayer ">
</Embed>
</Object>
</NoScript>
</Body>
</Html>

----------------------------------------

Note:

This. Stage. displaystate // The playing status of the current stage

Stagedisplaystate. full_screen // full screen mode

Stagedisplaystate. Normal // Normal Mode

Stagescalemode. no_scale // the internal controls of the stage are not scaled in full screen mode.

The red part must be added to HTML. Otherwise, an error is reported:

Securityerror: Error #2152: Full Screen mode is not allowed.
At flash. display: stage/set displaystate ()

Remember!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.