<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ActionScript Scraps &#187; html</title>
	<atom:link href="http://blog.sitedaniel.com/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sitedaniel.com</link>
	<description>Flash, Flex and AIR development</description>
	<lastBuildDate>Wed, 28 Jul 2010 11:15:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Centering a Flash movie using HTML tables</title>
		<link>http://blog.sitedaniel.com/2009/11/centering-a-flash-movie-using-html-tables/</link>
		<comments>http://blog.sitedaniel.com/2009/11/centering-a-flash-movie-using-html-tables/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 10:56:12 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=429</guid>
		<description><![CDATA[The easiest way I have found to center a SWF both vertically and horizontally in HTML is using tables. &#160; &#38;lt;table width=&#34;100%&#34; height=&#34;100%&#34; border=&#34;0&#34;&#62; &#38;lt;tr&#62; &#38;lt;td valign=&#34;middle&#34; align=&#34;center&#34;&#62; &#160; ... &#160; &#38;lt;/td&#62; &#38;lt;/tr&#62; &#38;lt;/table&#62; &#160;]]></description>
			<content:encoded><![CDATA[<p>The easiest way I have found to center a SWF both vertically and horizontally in HTML is using tables.</p>
<pre class="actionscript">&nbsp;
&amp;lt;table <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">border</span>=<span style="color: #ff0000;">&quot;0&quot;</span>&gt;
    &amp;lt;tr&gt;
        &amp;lt;td valign=<span style="color: #ff0000;">&quot;middle&quot;</span> <span style="color: #0066CC;">align</span>=<span style="color: #ff0000;">&quot;center&quot;</span>&gt;
&nbsp;</pre>
<p>...</p>
<pre class="actionscript">&nbsp;
        &amp;lt;/td&gt;
    &amp;lt;/tr&gt;
&amp;lt;/table&gt;
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2009/11/centering-a-flash-movie-using-html-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using an &#8216;onclick&#8217; event to dynamically load a SWF</title>
		<link>http://blog.sitedaniel.com/2009/10/using-an-onclick-event-to-dynamically-load-a-swf/</link>
		<comments>http://blog.sitedaniel.com/2009/10/using-an-onclick-event-to-dynamically-load-a-swf/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 13:31:09 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[swfobject]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=398</guid>
		<description><![CDATA[Here is an excellent post about how to use an 'onclick' event to dynamically load a SWF. The great thing about this example is that the javascript will dynamically add or remove the required DIV tag needed to embed the SWF. link]]></description>
			<content:encoded><![CDATA[<p><a href="http://pipwerks.com/lab/swfobject/load-onclick/2.0/index.html">Here is an excellent post</a> about how to use an 'onclick' event to dynamically load a SWF. The great thing about this example is that the javascript will dynamically add or remove the required DIV tag needed to embed the SWF. </p>
<p><a href="http://pipwerks.com/lab/swfobject/load-onclick/2.0/index.html">link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2009/10/using-an-onclick-event-to-dynamically-load-a-swf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove padding around 100% width/height Flash content</title>
		<link>http://blog.sitedaniel.com/2009/09/remove-padding-around-100-widthheight-flash-content/</link>
		<comments>http://blog.sitedaniel.com/2009/09/remove-padding-around-100-widthheight-flash-content/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 14:15:23 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=387</guid>
		<description><![CDATA[Some browsers put in padding around flash content that is scaled to fit 100% height and width. This is a quick CSS / HTML fix to make your full-screen flash movie fit the full height and width of the browser. Just put this in the top of your HTML inside your CSS declaration * {margin:0px;padding:0px;}]]></description>
			<content:encoded><![CDATA[<p>Some browsers put in padding around flash content that is scaled to fit 100% height and width. This is a quick CSS / HTML fix to make your full-screen flash movie fit the full height and width of the browser.<br />
Just put this in the top of your HTML inside your CSS declaration</p>
<pre>
* {margin:0px;padding:0px;}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2009/09/remove-padding-around-100-widthheight-flash-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlashVars AS3 &#8211; getting values from the URL string</title>
		<link>http://blog.sitedaniel.com/2008/12/flashvars-as3-getting-values-from-the-url-string/</link>
		<comments>http://blog.sitedaniel.com/2008/12/flashvars-as3-getting-values-from-the-url-string/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 12:03:11 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[as3.0]]></category>
		<category><![CDATA[flashvars]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.sitedaniel.com/?p=123</guid>
		<description><![CDATA[Getting values from the URL string in AS3 isn't very complicated. First you need to set up your html to pass these into the SWF using a javascript function: &#160; &#60;script language=&#34;javascript&#34;&#62; function gup&#40;name&#41;&#123; name = name.replace&#40;/&#91;\&#91;&#93;/,&#34;\\\[&#34;&#41;.replace&#40;/&#91;\&#93;&#93;/,&#34;\\\]&#34;&#41;; var regexS = &#34;[\\?&#38;]&#34;+name+&#34;=([^&#38;#]*)&#34;; var regex = new RegExp&#40; regexS &#41;; var results = regex.exec&#40; window.location.href &#41;; if&#40; [...]]]></description>
			<content:encoded><![CDATA[<p>Getting values from the URL string in AS3 isn't very complicated. First you need to set up your html to pass these into the SWF using a javascript function:</p>
<pre class="javascript">&nbsp;
&lt;script language=<span style="color: #3366CC;">&quot;javascript&quot;</span>&gt;
<span style="color: #003366; font-weight: bold;">function</span> gup<span style="color: #66cc66;">&#40;</span><span style="color: #000066;">name</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #000066;">name</span> = <span style="color: #000066;">name</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/<span style="color: #66cc66;">&#91;</span>\<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>/</span>,<span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\[</span>&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/<span style="color: #66cc66;">&#91;</span>\<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>/</span>,<span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\]</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #003366; font-weight: bold;">var</span> regexS = <span style="color: #3366CC;">&quot;[<span style="color: #000099; font-weight: bold;">\\</span>?&amp;]&quot;</span>+<span style="color: #000066;">name</span>+<span style="color: #3366CC;">&quot;=([^&amp;#]*)&quot;</span>;
    <span style="color: #003366; font-weight: bold;">var</span> regex = <span style="color: #003366; font-weight: bold;">new</span> RegExp<span style="color: #66cc66;">&#40;</span> regexS <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #003366; font-weight: bold;">var</span> results = regex.<span style="color: #006600;">exec</span><span style="color: #66cc66;">&#40;</span> window.<span style="color: #006600;">location</span>.<span style="color: #006600;">href</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> results == <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">&quot;&quot;</span>;
    <span style="color: #66cc66;">&#125;</span>  <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> results<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #66cc66;">&#93;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&lt;/script&gt;
&nbsp;</pre>
<p>Place this inside your html.<br />
Then if you are using the default HTML publishing you need to set up your SWF to take the variable. In this example I'm looking for a variable called 'transition'</p>
<pre class="javascript">&nbsp;
&lt;script language=<span style="color: #3366CC;">&quot;javascript&quot;</span>&gt;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>AC_FL_RunContent == <span style="color: #CC0000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;This page requires AC_RunActiveContent.js.&quot;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #66cc66;">&#123;</span>
		AC_FL_RunContent<span style="color: #66cc66;">&#40;</span>
			<span style="color: #3366CC;">'codebase'</span>, <span style="color: #3366CC;">'http://download.macromedia.com...
			'</span>width<span style="color: #3366CC;">', '</span><span style="color: #CC0000;">100</span>%<span style="color: #3366CC;">',
			'</span>height<span style="color: #3366CC;">', '</span><span style="color: #CC0000;">100</span>%<span style="color: #3366CC;">',
			'</span>src<span style="color: #3366CC;">', '</span>main<span style="color: #3366CC;">',
			'</span>quality<span style="color: #3366CC;">', '</span>high<span style="color: #3366CC;">',
			'</span>pluginspage<span style="color: #3366CC;">', '</span>http:<span style="color: #009900; font-style: italic;">//www.macromedia.c...</span>
			<span style="color: #3366CC;">'align'</span>, <span style="color: #3366CC;">'middle'</span>,
			<span style="color: #3366CC;">'play'</span>, <span style="color: #3366CC;">'true'</span>,
			<span style="color: #3366CC;">'loop'</span>, <span style="color: #3366CC;">'true'</span>,
			<span style="color: #3366CC;">'scale'</span>, <span style="color: #3366CC;">'exactfit'</span>,
			<span style="color: #3366CC;">'wmode'</span>, <span style="color: #3366CC;">'window'</span>,
			<span style="color: #3366CC;">'devicefont'</span>, <span style="color: #3366CC;">'false'</span>,
			<span style="color: #3366CC;">'id'</span>, <span style="color: #3366CC;">'main'</span>,
			<span style="color: #3366CC;">'bgcolor'</span>, <span style="color: #3366CC;">'#ffffff'</span>,
			<span style="color: #3366CC;">'name'</span>, <span style="color: #3366CC;">'main'</span>,
			<span style="color: #3366CC;">'menu'</span>, <span style="color: #3366CC;">'true'</span>,
			<span style="color: #3366CC;">'FlashVars'</span>, <span style="color: #3366CC;">'transition='</span>+gup<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;transition&quot;</span><span style="color: #66cc66;">&#41;</span>,
			<span style="color: #3366CC;">'allowFullScreen'</span>, <span style="color: #3366CC;">'true'</span>,
			<span style="color: #3366CC;">'allowScriptAccess'</span>,<span style="color: #3366CC;">'sameDomain'</span>,
			<span style="color: #3366CC;">'movie'</span>, <span style="color: #3366CC;">'main'</span>,
			<span style="color: #3366CC;">'salign'</span>, <span style="color: #3366CC;">''</span>
			<span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">//end AC code</span>
	<span style="color: #66cc66;">&#125;</span>
&lt;/script&gt;
&nbsp;
...
&lt;param <span style="color: #000066;">name</span>=<span style="color: #3366CC;">&quot;scale&quot;</span> value=<span style="color: #3366CC;">&quot;exactfit&quot;</span> /&gt;
&lt;param <span style="color: #000066;">name</span>=<span style="color: #3366CC;">&quot;bgcolor&quot;</span> value=<span style="color: #3366CC;">&quot;#ffffff&quot;</span> /&gt;
&lt;param <span style="color: #000066;">name</span>=<span style="color: #3366CC;">&quot;FlashVars&quot;</span> value=<span style="color: #3366CC;">&quot;transition=&quot;</span>+gup<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;transition&quot;</span><span style="color: #66cc66;">&#41;</span> /&gt;
&lt;embed src=<span style="color: #3366CC;">&quot;main.swf&quot;</span> quality=<span style="color: #3366CC;">&quot;high&quot;</span> scale=<span style="color: #3366CC;">&quot;exactfit&quot;</span> ... /&gt;
...
&nbsp;</pre>
<p>The important lines are:</p>
<p><strong>'FlashVars', 'transition='+gup("transition"),</strong><br />
and<br />
<strong>param name="FlashVars" value="transition="+gup("transition")</strong></p>
<p>Here we are calling the javascript function to return the value that matches 'transition'. Then this gets passed to the SWF.</p>
<p>Inside the flash this can be accessed with:</p>
<pre class="actionscript">&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> sTrans:<span style="color: #0066CC;">String</span> = <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>.<span style="color: #006600;">loaderInfo</span>.<span style="color: #006600;">parameters</span>.<span style="color: #006600;">transition</span><span style="color: #66cc66;">&#41;</span>
&nbsp;</pre>
<p>Then you can get variables from the URL string:<br />
<strong></p>
<p>http://www.sitedaniel.com/index.html?transition=myvalue</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sitedaniel.com/2008/12/flashvars-as3-getting-values-from-the-url-string/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
