<?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>CODEISPOETRY &#187; snippet</title>
	<atom:link href="http://www.alexmil.de/category/snippet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alexmil.de</link>
	<description></description>
	<lastBuildDate>Fri, 10 Jun 2011 13:10:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Logging Php to Firebug</title>
		<link>http://www.alexmil.de/logging-php-to-firebug/</link>
		<comments>http://www.alexmil.de/logging-php-to-firebug/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 10:53:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[browser]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=829</guid>
		<description><![CDATA[Ever wanted to log php to firebug? There are a lot of reasons to do this. E.g. working  on apps for a thrd party plattform like myspace.
The logger is a singleton. you can push any date type in it. the coolest part: it encodes the php class as json object.

i wrapped it in a simple [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wanted to log php to firebug? There are a lot of reasons to do this. E.g. working  on apps for a thrd party plattform like myspace.</p>
<p>The logger is a singleton. you can push any date type in it. the coolest part: it encodes the php class as json object.</p>
<p><img class="alignnone size-full wp-image-831" title="logging_firebug" src="http://www.alexmil.de/wp-content/logging_firebug.png" alt="logging_firebug" width="336" height="216" /></p>
<p>i wrapped it in a simple dummy project with some &#8220;oop&#8221; javascript in it. give it a try and tell me what you think.</p>
<p>and yes, i know firephp ;)</p>
<p><a href="http://www.alexmil.de/wp-content/PhpLogging.zip">PhpLogging</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/logging-php-to-firebug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optimized edge detection algorithm.</title>
		<link>http://www.alexmil.de/optimized-edge-detection-algorithm/</link>
		<comments>http://www.alexmil.de/optimized-edge-detection-algorithm/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 13:35:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[computervision]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=436</guid>
		<description><![CDATA[I optimized the edge detection (sobel) algorithm found here a little. Still there is a lot potential for optimizing things. You can find tipps in joa&#8217;s wiki
Here is my code

private function detectEdges&#40;bmd : BitmapData&#41; : void
&#123;
&#160;
 var myGausianFilter : ConvolutionFilter =
 new ConvolutionFilter&#40;5, 5, 
 &#91;2,4,5,4,2,4,9,12,9,4,5,12,15,12,5,4,9,12,9,4,2,4,5,4,2&#93;,
 115&#41;;
&#160;
 // Edge Data
 findEdges&#40;&#41;;
&#160;
 function findEdges&#40;&#41; : void
 [...]]]></description>
			<content:encoded><![CDATA[<p>I optimized the edge detection (sobel) algorithm found <a href="http://lukewalsh.co.uk/blog/2008/06/sobel-edge-detection-in-flash.html" target="_blank">here</a> a little. Still there is a lot potential for optimizing things. You can find tipps in <a href="http://wiki.joa-ebert.de/index.php/Main_Page" target="_blank">joa&#8217;s wiki</a></p>
<p>Here is my code</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> detectEdges<span style="color: #66cc66;">&#40;</span>bmd : BitmapData<span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">var</span> myGausianFilter : ConvolutionFilter =
 <span style="color: #000000; font-weight: bold;">new</span> ConvolutionFilter<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">5</span>, 
 <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">9</span>,<span style="color: #cc66cc;">12</span>,<span style="color: #cc66cc;">9</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">12</span>,<span style="color: #cc66cc;">15</span>,<span style="color: #cc66cc;">12</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">9</span>,<span style="color: #cc66cc;">12</span>,<span style="color: #cc66cc;">9</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span>,
 <span style="color: #cc66cc;">115</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
 <span style="color: #808080; font-style: italic;">// Edge Data</span>
 findEdges<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
 <span style="color: #000000; font-weight: bold;">function</span> findEdges<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span>
 <span style="color: #66cc66;">&#123;</span>	
  <span style="color: #808080; font-style: italic;">//Apply Smoothing Filter</span>
  bmd.<span style="color: #006600;">lock</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  bmd.<span style="color: #006600;">applyFilter</span><span style="color: #66cc66;">&#40;</span>bmd, bmd.<span style="color: #006600;">rect</span>, <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>, myGausianFilter<span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <span style="color: #808080; font-style: italic;">//Create New Bitmap to hold edge data</span>
  ourEdgeData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #0066CC;">width</span>, bmd.<span style="color: #0066CC;">height</span>, <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <span style="color: #000000; font-weight: bold;">var</span> gx : <span style="color: #0066CC;">int</span>;;
  <span style="color: #000000; font-weight: bold;">var</span> gy : <span style="color: #0066CC;">int</span>;
  <span style="color: #000000; font-weight: bold;">var</span> gray : uint;
&nbsp;
  <span style="color: #808080; font-style: italic;">//Loop through original data and calculate edges</span>
  <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> w : <span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>;w <span style="color: #66cc66;">&amp;</span>lt; bmd.<span style="color: #0066CC;">width</span>; w++<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#123;</span>
   <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> h : <span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>;h <span style="color: #66cc66;">&amp;</span>lt; bmd.<span style="color: #0066CC;">height</span>; h++<span style="color: #66cc66;">&#41;</span>
   <span style="color: #66cc66;">&#123;</span>
    pV0 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w, h - <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
    pV45 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w + <span style="color: #cc66cc;">1</span>, h - <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
    pV90 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w + <span style="color: #cc66cc;">1</span>, h<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
    pV35 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w + <span style="color: #cc66cc;">1</span>, h + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
    pV80 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w, h + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
    pV225 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w - <span style="color: #cc66cc;">1</span>, h + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;
    pV270 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w - <span style="color: #cc66cc;">1</span>, h<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;			
    pV315 = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span>bmd.<span style="color: #006600;">getPixel</span><span style="color: #66cc66;">&#40;</span>w - <span style="color: #cc66cc;">1</span>, h - <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span> uint<span style="color: #66cc66;">&#40;</span>0xffffff<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>;	 
&nbsp;
    gx = <span style="color: #66cc66;">&#40;</span>pV45+<span style="color: #66cc66;">&#40;</span>pV90<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>+pV35<span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&#40;</span>pV315+<span style="color: #66cc66;">&#40;</span>pV270<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>+pV225<span style="color: #66cc66;">&#41;</span>;
    gy = <span style="color: #66cc66;">&#40;</span>pV315+<span style="color: #66cc66;">&#40;</span>pV0<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>+pV45<span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&#40;</span>pV225+<span style="color: #66cc66;">&#40;</span>pV80<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>+pV35<span style="color: #66cc66;">&#41;</span>;
    gray = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">abs</span><span style="color: #66cc66;">&#40;</span>gx<span style="color: #66cc66;">&#41;</span> + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">abs</span><span style="color: #66cc66;">&#40;</span>gy<span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Check to see if values aren't our of bounds</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>gray <span style="color: #66cc66;">&amp;</span>gt; <span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span>
     gray = <span style="color: #cc66cc;">255</span>;
&nbsp;
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>gray <span style="color: #66cc66;">&amp;</span>lt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
	  gray = <span style="color: #cc66cc;">0</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Build New Pixel</span>
    newPixelValue = <span style="color: #66cc66;">&#40;</span>gray <span style="color: #66cc66;">&amp;</span>lt;<span style="color: #66cc66;">&amp;</span>lt; <span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #66cc66;">&#40;</span>gray <span style="color: #66cc66;">&amp;</span>lt;<span style="color: #66cc66;">&amp;</span>lt; <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #66cc66;">&#40;</span>gray<span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Copy New Pixel Into Edge Data Bitmap</span>
    ourEdgeData.<span style="color: #006600;">setPixel</span><span style="color: #66cc66;">&#40;</span>w, h, newPixelValue<span style="color: #66cc66;">&#41;</span>;	
   <span style="color: #66cc66;">&#125;</span>	
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  bmd.<span style="color: #006600;">unlock</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
 <span style="color: #66cc66;">&#125;</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">function</span> getGray<span style="color: #66cc66;">&#40;</span>pixelValue : uint<span style="color: #66cc66;">&#41;</span> : uint
 <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">var</span> red : uint = <span style="color: #66cc66;">&#40;</span>pixelValue <span style="color: #66cc66;">&amp;</span>gt;<span style="color: #66cc66;">&amp;</span>gt; <span style="color: #cc66cc;">16</span> <span style="color: #66cc66;">&amp;</span>amp; 0xFF<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.30</span>;
  <span style="color: #000000; font-weight: bold;">var</span> green : uint = <span style="color: #66cc66;">&#40;</span>pixelValue <span style="color: #66cc66;">&amp;</span>gt;<span style="color: #66cc66;">&amp;</span>gt; <span style="color: #cc66cc;">8</span> <span style="color: #66cc66;">&amp;</span>amp; 0xFF<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.59</span>;
  <span style="color: #000000; font-weight: bold;">var</span> blue : uint = <span style="color: #66cc66;">&#40;</span>pixelValue <span style="color: #66cc66;">&amp;</span>amp; 0xFF<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.11</span>;
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span>red + green + blue<span style="color: #66cc66;">&#41;</span>;
 <span style="color: #66cc66;">&#125;</span>
&nbsp;
 _bmp3.<span style="color: #006600;">bitmapData</span> = ourEdgeData;
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/optimized-edge-detection-algorithm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FDT compile ant on shortcut</title>
		<link>http://www.alexmil.de/fdt-compile-ant-on-shortcut/</link>
		<comments>http://www.alexmil.de/fdt-compile-ant-on-shortcut/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 15:55:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=356</guid>
		<description><![CDATA[What i missed in fdt was compling the last build on shortcut. As you might imagine i&#8217;m not a friend of reading eclipse preferences. So i asked a nic guy from powerflasher yesterday ;)

eclipse -&#62; preferences -&#62; general -&#62; keys -&#62; run last launched external tool
]]></description>
			<content:encoded><![CDATA[<p>What i missed in fdt was compling the last build on shortcut. As you might imagine i&#8217;m not a friend of reading eclipse preferences. So i asked a nic guy from powerflasher yesterday ;)</p>
<p><img class="alignnone size-full wp-image-357" title="fdt_ant_compile_1" src="http://www.alexmil.de/wp-content/fdt_ant_compile_1.png" alt="" width="488" height="345" /></p>
<p>eclipse -&gt; preferences -&gt; general -&gt; keys -&gt; run last launched external tool</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/fdt-compile-ant-on-shortcut/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>duplicate movieclip in as3</title>
		<link>http://www.alexmil.de/duplicate-movieclip-in-as3/</link>
		<comments>http://www.alexmil.de/duplicate-movieclip-in-as3/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 17:34:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=330</guid>
		<description><![CDATA[well this snippet won&#8217;t work for every case, but you can do it like this:

import flash.display.Sprite;
&#160;
public class ExClip extends Sprite
&#123;
	private var _param : String;
&#160;
	public function ExClip&#40;param : String&#41;
	&#123;
		_param = param;
	&#125;
&#160;
	public function clone&#40;&#41; : ExClip
	&#123;
		var ret : ExClip = new ExClip&#40;_param&#41;;
&#160;
		return ret;
	&#125;
&#160;
&#125;
&#160;
// call
var tmp1 : ExClip = new ExClip&#40;&#34;param1&#34;&#41;;
var tmp2 : ExClip = tmp1.clone&#40;&#41;;

Works fine for [...]]]></description>
			<content:encoded><![CDATA[<p>well this snippet won&#8217;t work for every case, but you can do it like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
&nbsp;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExClip <span style="color: #0066CC;">extends</span> Sprite
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _param : <span style="color: #0066CC;">String</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ExClip<span style="color: #66cc66;">&#40;</span>param : <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		_param = param;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> clone<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : ExClip
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> ret : ExClip = <span style="color: #000000; font-weight: bold;">new</span> ExClip<span style="color: #66cc66;">&#40;</span>_param<span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #b1b100;">return</span> ret;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// call</span>
<span style="color: #000000; font-weight: bold;">var</span> tmp1 : ExClip = <span style="color: #000000; font-weight: bold;">new</span> ExClip<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;param1&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> tmp2 : ExClip = tmp1.<span style="color: #006600;">clone</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Works fine for me.<br />
So long</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/duplicate-movieclip-in-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash flv metadata error #1069</title>
		<link>http://www.alexmil.de/flash-flv-metadata-error-1069/</link>
		<comments>http://www.alexmil.de/flash-flv-metadata-error-1069/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 14:36:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bugfix]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=327</guid>
		<description><![CDATA[Working with flvs I got that error
&#8220;Error #1069 onMetaData for flash.net.NetStream not found&#8221;
Here&#8217;s the fix.

var nc : NetConnection = new NetConnection&#40;&#41;;
nc.connect&#40;null&#41;;
var ns : NetStream = new NetStream&#40;nc&#41;;
var vid : Video = new Video&#40;&#41;;
&#160;
var listener : Object = new Object&#40;&#41;;
&#160;
// this is optional
//
listener.onMetaData = function&#40;infoObject : Object&#41;:void
&#123;
	trace&#40;&#34;onMetaData&#34;&#41;;
	var key : String;
	for &#40;key in infoObject&#41;
	&#123;
		trace&#40;key + &#34;: &#34; [...]]]></description>
			<content:encoded><![CDATA[<p>Working with flvs I got that error<strong></p>
<p>&#8220;Error #1069 onMetaData for flash.net.NetStream not found&#8221;</strong></p>
<p>Here&#8217;s the fix.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> nc : <span style="color: #0066CC;">NetConnection</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">NetConnection</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
nc.<span style="color: #0066CC;">connect</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> ns : <span style="color: #0066CC;">NetStream</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">NetStream</span><span style="color: #66cc66;">&#40;</span>nc<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> vid : <span style="color: #0066CC;">Video</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Video</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> listener : <span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// this is optional</span>
<span style="color: #808080; font-style: italic;">//</span>
listener.<span style="color: #006600;">onMetaData</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>infoObject : <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;onMetaData&quot;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">key</span> : <span style="color: #0066CC;">String</span>;
	<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">key</span> <span style="color: #b1b100;">in</span> infoObject<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">key</span> + <span style="color: #ff0000;">&quot;: &quot;</span> + infoObject<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">key</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// this is optional</span>
<span style="color: #808080; font-style: italic;">//</span>
listener.<span style="color: #006600;">onCuePoint</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>infoObject : <span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;onCuePoint&quot;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">key</span> : <span style="color: #0066CC;">String</span>;
	<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">key</span> <span style="color: #b1b100;">in</span> infoObject<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">key</span> + <span style="color: #ff0000;">&quot;: &quot;</span> + infoObject<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">key</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// this is &quot;the magic&quot;</span>
<span style="color: #808080; font-style: italic;">//</span>
ns.<span style="color: #006600;">client</span> = listener;
ns.<span style="color: #0066CC;">play</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;videos/vid2.flv&quot;</span><span style="color: #66cc66;">&#41;</span>;
vid.<span style="color: #006600;">attachNetStream</span><span style="color: #66cc66;">&#40;</span>ns<span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>vid<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>So long</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/flash-flv-metadata-error-1069/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bitmapsmoothing &#8211; glätten via AS3</title>
		<link>http://www.alexmil.de/bitmapsmoothing-glatten-via-as3/</link>
		<comments>http://www.alexmil.de/bitmapsmoothing-glatten-via-as3/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 15:03:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=321</guid>
		<description><![CDATA[When you work with embed smoothing (glätten) images works with this snippet:

&#91;Embed&#40;source=&#34;pathto/image.png&#34;&#41;&#93;
private var _imgName : Class;
&#160;
...
&#160;
var tmpSpr : Sprite = new Sprite&#40;&#41;;
var tmpBmp : Bitmap = new _imgName as Bitmap;
&#160;
tmpBmp.smoothing = true;
&#160;
tmpSpr.addChild&#40;tmpBmp&#41;;

]]></description>
			<content:encoded><![CDATA[<p>When you work with embed smoothing (glätten) images works with this snippet:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">&quot;pathto/image.png&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _imgName : <span style="color: #000000; font-weight: bold;">Class</span>;
&nbsp;
...
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> tmpSpr : Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> tmpBmp : Bitmap = <span style="color: #000000; font-weight: bold;">new</span> _imgName as Bitmap;
&nbsp;
tmpBmp.<span style="color: #0066CC;">smoothing</span> = <span style="color: #000000; font-weight: bold;">true</span>;
&nbsp;
tmpSpr.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>tmpBmp<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/bitmapsmoothing-glatten-via-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flashtip : Zoom in a clip to a specific point</title>
		<link>http://www.alexmil.de/flashtip-zoom-in-a-clip-to-a-specific-point/</link>
		<comments>http://www.alexmil.de/flashtip-zoom-in-a-clip-to-a-specific-point/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 13:31:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.alexmil.de/?p=308</guid>
		<description><![CDATA[Imagine you have to zoom in a mc on a specific point.
This math snippet works fine for me (I used TweenLite in my Code):

var tmpEndX : Number = &#40;&#40;spr.width&#41;-&#40;width*scaleFact&#41;&#41;/2;
var tmpEndY : Number = &#40;&#40;spr.height&#41;-&#40;spr.height*scaleFact&#41;&#41;/2;
&#160;
var tmpXShift : Number = &#40;mouseX-&#40;width/2&#41;&#41;*scaleFact;
var tmpYShift : Number = &#40;mouseY-&#40;spr.height/2&#41;&#41;*scaleFact;
&#160;
TweenMax.to&#40;this, 0.5,&#123;scaleX : scaleFact&#125;&#41;;
TweenMax.to&#40;this, 0.5,&#123;scaleY : scaleFact&#125;&#41;;
TweenMax.to&#40;this, 0.5,&#123;x : tmpEndX - tmpXShift&#125;&#41;;
TweenMax.to&#40;this, [...]]]></description>
			<content:encoded><![CDATA[<p>Imagine you have to zoom in a mc on a specific point.<br />
This math snippet works fine for me (I used TweenLite in my Code):</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> tmpEndX : <span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>spr.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span><span style="color: #66cc66;">*</span>scaleFact<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>;
<span style="color: #000000; font-weight: bold;">var</span> tmpEndY : <span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>spr.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>-<span style="color: #66cc66;">&#40;</span>spr.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">*</span>scaleFact<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> tmpXShift : <span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span>mouseX-<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span>scaleFact;
<span style="color: #000000; font-weight: bold;">var</span> tmpYShift : <span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span>mouseY-<span style="color: #66cc66;">&#40;</span>spr.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span>scaleFact;
&nbsp;
TweenMax.<span style="color: #006600;">to</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #cc66cc;">0.5</span>,<span style="color: #66cc66;">&#123;</span>scaleX : scaleFact<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
TweenMax.<span style="color: #006600;">to</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #cc66cc;">0.5</span>,<span style="color: #66cc66;">&#123;</span>scaleY : scaleFact<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
TweenMax.<span style="color: #006600;">to</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #cc66cc;">0.5</span>,<span style="color: #66cc66;">&#123;</span>x : tmpEndX - tmpXShift<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
TweenMax.<span style="color: #006600;">to</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, <span style="color: #cc66cc;">0.5</span>,<span style="color: #66cc66;">&#123;</span>y : tmpEndY - tmpYShift<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Demo and full Class <a href="http://www.alexmil.de/index.php/zoom-in-a-clip-to-a-specific-point/">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexmil.de/flashtip-zoom-in-a-clip-to-a-specific-point/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

