<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>SnippetRepoBrowser</title>
    <link>http://snippet.gnstudio.com/snippetrepobrowser/index</link>    
    <description>RSS Feed of SnippetRepoBrowser (Global RSS)</description>    
    <language>en-us</language>
    <pubDate>Thu, 09 Feb 2012 21:17:55 +0100</pubDate>
    <docs>SnippetRepoBrowser/index</docs>
    <generator>SnippetRepoBrowser Feed Generator</generator>
    <item>
      <title><![CDATA[FullScreen in Flash CS4 / AS3]]></title>
      <link>http://snippet.gnstudio.com/viewtopic/2</link>
      <description><![CDATA[If you want enable fullscreen modality in Flash CS 4 and ActionScript 3.0 you need to following steps:<br />1)    Modify the displayState property to <span style="font-style:italic">StageDisplayState.FULL_SCREEN</span> costant to enable it, and to <span style="font-style:italic">StageDisplayState.NORMAL</span> to come back to &#39;normal&#39; modality<br />2)    Enable the &#39;<span style="font-style:italic">allowfullscreen</span>&#39; attribute in your html code (see below)<br /><span style="font-weight:bold"></span><br />...<br />&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;...<br />and<br />&lt;embed src=&quot;index.swf&quot; allowfullscreen=&quot;true&quot;&gt;&lt;/embed&gt;<br /><a href="http://www.fabiobiondi.com/blog/wp-content/uploads/2009/08/fullscreenflcs4.swf" target="_blank"></a><br /><span style="font-weight:bold"><br />HOW CREATE A FULLSCREEN BUTTON in AS3<br /></span><br />The script is quite simple and is fullCommented.<br />You just need to create a Flash CS3/4 ActionScript 3.0 file and link the document Class to the <span style="text-decoration:underline"><span style="font-style:italic">FullScreenMain.as</span></span> class.<br />We add to the display list a Button Flash Component, so we need to import its assets to the .fla dragging it from the Component panel to the library.<br />]]><![CDATA[<div class="divcode"><pre lang="actionscript">package {<br />	<br />	import flash.display.MovieClip;<br />	import flash.display.Stage;<br />	import flash.display.StageAlign;<br />	import flash.display.StageScaleMode;<br />	import flash.display.StageDisplayState<br />	<br />	import fl.controls.Button;<br />	import flash.events.Event;<br />	import flash.events.MouseEvent;<br />	import flash.events.FullScreenEvent;<br /><br /><br />	public class FullScreenMain extends MovieClip {<br />		<br />		// The FullScreen Button<br />		private var fullScreen_btn:Button;<br />		<br />		// Save the fullScreen status<br />		private var fullScreenStatus:Boolean;		<br />		<br />		<br />		/**<br />		* Constructor<br />		*/<br />		public function FullScreenMain() {<br /><br />			// Create the FullScreen Button (add to the .fla library the button component assets)<br />			fullScreen_btn = new Button();<br />			fullScreen_btn.label = &quot;Enable FULL_SCREEN&quot;;<br />			fullScreen_btn.width = 150;<br />			fullScreen_btn.x = 120;<br />			fullScreen_btn.y = 50;<br />			addChild(fullScreen_btn)<br /><br /><br />			// Set NO_SCALE because we don&#39;t want that when fullscreen is enable movieclips are scaled too<br />			var swfStage:Stage = this.stage;<br />			swfStage.scaleMode = StageScaleMode.NO_SCALE;<br />			swfStage.align = StageAlign.TOP_LEFT;<br />			<br />			// Registriamo un listener per la modalitÃƒÆ’Ã†â€™Ãƒâ€ Ã¢â‚¬â„¢ÃƒÆ’Ã¢â‚¬Â ÃƒÂ¢Ã¢â€šÂ¬Ã¢â€žÂ¢ÃƒÆ’Ã†â€™ÃƒÂ¢Ã¢â€šÂ¬ ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â‚¬Å¡Ã‚Â¬ÃƒÂ¢Ã¢â‚¬Å¾Ã‚Â¢ÃƒÆ’Ã†â€™Ãƒâ€ Ã¢â‚¬â„¢ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â‚¬Å¡Ã‚Â¬ ÃƒÆ’Ã†â€™Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â€šÂ¬Ã…Â¡Ãƒâ€šÃ‚Â¬ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â€šÂ¬Ã…Â¾Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã†â€™Ãƒâ€ Ã¢â‚<br /><br />¬â„¢ÃƒÆ’Ã¢â‚¬Â ÃƒÂ¢Ã¢â€šÂ¬Ã¢â€žÂ¢ÃƒÆ’Ã†â€™Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â€šÂ¬Ã…Â¡Ãƒâ€šÃ‚Â¬ ÃƒÆ’Ã†â€™Ãƒâ€ Ã¢â‚¬â„¢ÃƒÆ’Ã¢â‚¬Å¡Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã†â€™Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â‚¬Å¡Ã‚Â¬Ãƒâ€¦Ã‚Â¡ÃƒÆ’Ã¢â‚<br /><br />¬Å¡Ãƒâ€šÃ‚Â¬ÃƒÆ’Ã†â€™Ãƒâ€šÃ‚Â¢ÃƒÆ’Ã‚Â¢ÃƒÂ¢Ã¢â‚¬Å¡Ã‚Â¬Ãƒâ€¦Ã‚Â¾ÃƒÆ’Ã¢â‚¬Å¡Ãƒâ€šÃ‚Â¢  FULLSCREEN:<br /><br />			// Listener for FullScreen Button<br />			fullScreen_btn.addEventListener(MouseEvent.CLICK, changefullScreenStatus)<br /><br /><br />			// Listener for FullScreen event. It&#39;s invoked every time the &#39;displayState&#39; property change<br />			fullScreen_btn.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenRedraw);<br />			<br /><br />		}<br /><br /><br /><br />	<br />	<br />		/**<br />		* Check the fullScreenStatus and Enabled / Disable the FullScreen<br />		*/<br />		private function changefullScreenStatus(e:MouseEvent):void <br />		{<br />			// Disable FullScreen if enabled, and viceversa<br />			if(fullScreenStatus)<br />				fullScreen_btn.stage.displayState = StageDisplayState.NORMAL;<br />			else<br />				fullScreen_btn.stage.displayState = StageDisplayState.FULL_SCREEN;<br />				<br />		<br />		}<br />		<br />		/*<br />		* Invoked at every &#39;displayState&#39; property change<br />		*/<br />		function fullScreenRedraw(event:FullScreenEvent):void<br />		{<br />			// Check if fullScreen is enabled and uptades properties<br />			if (event.fullScreen)<br />			{<br />				fullScreen_btn.label = &quot;Disable FULL_SCREEN&quot;;<br />				fullScreenStatus = true;<br />			}<br />			else<br />			{<br />				fullScreen_btn.label = &quot;Enable FULL_SCREEN&quot;;<br />				fullScreenStatus = false;<br />			}<br />		<br />		}<br />		<br />	<br />	}<br />}<br /><br /></pre></div><br /><br />]]></description>
      <author>flagers</author>
      <pubDate>Mon, 31 Aug 2009 22:27:49 +0200</pubDate>
      <category>ActionScript</category>
      <guid>http://snippet.gnstudio.com/viewtopic/2</guid>
   </item>
  </channel>
</rss>
