<?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>Tenegri's blog</title>
	<atom:link href="http://blog.tengerstudio.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tengerstudio.com</link>
	<description>Problems, questions and discoveries related to my daily development work</description>
	<lastBuildDate>Sat, 19 Dec 2009 03:29:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Switching back to 2D from 3D</title>
		<link>http://blog.tengerstudio.com/2009/09/13/switching-back-to-2d-from-3d/</link>
		<comments>http://blog.tengerstudio.com/2009/09/13/switching-back-to-2d-from-3d/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 17:48:00 +0000</pubDate>
		<dc:creator>tenegri</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://blog.tengerstudio.com/?p=15</guid>
		<description><![CDATA[In Flash 10 display objects can be transformed in the 3D space. That&#8217;s very nice, but due to the implementation the appearence of an objects can become a little bit different (blurry) after transforming it in 3D (changing its z, rotationX/Y/Z property, etc.), even if the object is reverted exactly in the same position as [...]]]></description>
			<content:encoded><![CDATA[<p>In Flash 10 display objects can be transformed in the 3D space. That&#8217;s very nice, but due to the implementation the appearence of an objects can become a little bit different (blurry) after transforming it in 3D (changing its z, rotationX/Y/Z property, etc.), even if the object is reverted exactly in the same position as it was before the 3D transformation. Actually when an object is transformed in 3D space Flash takes a bitmap snapshot of its content and this bitmap is what transformed and displayed in real. In order to raise the bitmap&#8217;s quality a smoothing is applied to it, and this smoothing causes the difference and the blur. It is noticable especially on textfields.<br />
<span id="more-15"></span><br />
Here is a demonstration:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> caurina.<span style="color: #006600;">transitions</span>.<span style="color: #66cc66;">*</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> box1: TextBox = <span style="color: #000000; font-weight: bold;">new</span> TextBox<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// TextBox is a symbol in the library</span>
box1.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">30</span>;
box1.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">35</span>;
addChild<span style="color: #66cc66;">&#40;</span>box1<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> box2: TextBox = <span style="color: #000000; font-weight: bold;">new</span> TextBox<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
box2.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">270</span>;
box2.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">35</span>;
addChild<span style="color: #66cc66;">&#40;</span>box2<span style="color: #66cc66;">&#41;</span>;
&nbsp;
box1.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, click<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> click<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>: MouseEvent<span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
  Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>box1, <span style="color: #66cc66;">&#123;</span>z: <span style="color: #cc66cc;">200</span>, <span style="color: #0066CC;">time</span>: <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
  Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>box1, <span style="color: #66cc66;">&#123;</span>z: <span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">time</span>: <span style="color: #cc66cc;">1</span>, delay: <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>


<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_3d2d_177824880"
			class="flashmovie"
			width="450"
			height="200">
	<param name="movie" value="http://blog.tengerstudio.com/public/3d2d.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://blog.tengerstudio.com/public/3d2d.swf"
			name="fm_3d2d_177824880"
			width="450"
			height="200">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>When you click the left text box it will move back and forth to its original position, but after the animation (after using 3D transformation) the text becomes blurry (compare to the text on the right).</p>
<p>When a DisplayObject is started to be transformed in 3D, then its transform.matrix3D property is used instead of transform.matrix, which is used for 2D transformations. If we could switch back to using transform.matrix, the smoothing and its effect would be disappear. After starting to transform an object in 3D it will not switch back automatically to 2D/transform.matrix at any time, so we have to do it manually. When transform.matrix3D is in use, the value of transform.matrix is null, and vice versa if transform.matrix is in use, the value of transform.matrix3D is null. If we nullify any of these properties manually, Flash automatically switches to using the other one (with a default identity matrix). The same effect if we assign a value (a Matrix or Matrix3D reference) to the currently unused property. So the only thing what we need to do is saving the original transform.matrix value before starting 3D transformations and restoring it when we want to switch back to 2D. The example below extends the previous one. It saves the Matrix stored in transform.matrix before starting the 3D animation, and assigns it again when the animation is complete.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> caurina.<span style="color: #006600;">transitions</span>.<span style="color: #66cc66;">*</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> box1: TextBox = <span style="color: #000000; font-weight: bold;">new</span> TextBox<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// TextBox is a symbol in the library</span>
box1.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">20</span>;
box1.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">35</span>;
addChild<span style="color: #66cc66;">&#40;</span>box1<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> box2: TextBox = <span style="color: #000000; font-weight: bold;">new</span> TextBox<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
box2.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">230</span>;
box2.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">35</span>;
addChild<span style="color: #66cc66;">&#40;</span>box2<span style="color: #66cc66;">&#41;</span>;
&nbsp;
box1.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, click<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> oldMatrix: Matrix;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> click<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>: MouseEvent<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;">// if no tween in progress</span>
  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>Tweener.<span style="color: #006600;">isTweening</span><span style="color: #66cc66;">&#40;</span>box1<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    oldMatrix = box1.<span style="color: #006600;">transform</span>.<span style="color: #006600;">matrix</span>;
    Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>box1, <span style="color: #66cc66;">&#123;</span>z: <span style="color: #cc66cc;">200</span>, <span style="color: #0066CC;">time</span>: <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
    Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span>box1, <span style="color: #66cc66;">&#123;</span>z: <span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">time</span>: <span style="color: #cc66cc;">1</span>, delay: <span style="color: #cc66cc;">1</span>, onComplete: tweenComplete<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> tweenComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
  box1.<span style="color: #006600;">transform</span>.<span style="color: #006600;">matrix</span> = oldMatrix;
<span style="color: #66cc66;">&#125;</span></pre></div></div>


<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_3d2d_2_1462692904"
			class="flashmovie"
			width="450"
			height="200">
	<param name="movie" value="http://blog.tengerstudio.com/public/3d2d_2.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://blog.tengerstudio.com/public/3d2d_2.swf"
			name="fm_3d2d_2_1462692904"
			width="450"
			height="200">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>We could omit the saving of the old matrix, of course, since assigning null to transform.matrix3D also switches back to 2D, but in this case a new identity matrix will be stored in transform.matrix, so we have to take care of transforming our object to the desired position.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tengerstudio.com/2009/09/13/switching-back-to-2d-from-3d/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Multi-column text</title>
		<link>http://blog.tengerstudio.com/2009/06/07/multi-column-text/</link>
		<comments>http://blog.tengerstudio.com/2009/06/07/multi-column-text/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 17:14:43 +0000</pubDate>
		<dc:creator>tenegri</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[ActionScrip 2]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[multi-column]]></category>

		<guid isPermaLink="false">http://blog.tengerstudio.com/?p=14</guid>
		<description><![CDATA[Recently somebody asked about creating multi-column text flow in ActionScript 2. I have suggested ActionScript 3 since it offers relatively simple solution, but after few minutes of thinking also figured out a solution for ActionScript 2. I know that AS2 is quite obsolete now and I personally don&#8217;t use it, only when it is unescapable, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently somebody asked about creating multi-column text flow in ActionScript 2. I have suggested ActionScript 3 since it offers relatively simple solution, but after few minutes of thinking also figured out a solution for ActionScript 2. I know that AS2 is quite obsolete now and I personally don&#8217;t use it, only when it is unescapable, but probably there are still many people using it on daily basis for different reasons (legacy projects, target player version limitations, etc.), so even an AS2 solution may be useful.<br />
<span id="more-14"></span><br />
So, how to do that in AS2? Since there is no built-in support for formatting a text field&#8217;s content into multiple columns, we have to create it from scratch. Placing text fields beside each other and filling them with text chunks, which exactly fit into them seems to be what we need. The only problem is splitting the text to be displayed into chunks according to columns. Basically we need to know where is the end of the text that fits into a text field (= column) in order to determine the beggining of the text to be placed into the next text field or column. In AS2 there is no way to know which is the last visible character in a text field, but we have information on the vertical scroll position of the last line and it will be quite enough for us. We will not split the text into parts, instead we place the same text into each column (= text field) and set their vertical scrolling position based on the last visible line of the previous column. The scrolling position of the first visible line can be set by the <code>scroll</code> property of the TextField class, and the scroll position of the last line is in the <code>bottomScroll</code> property. The last column requires a little bit more attention, since its visible content probably will not fill the entire column, but a text field&#8217;s last line can be displayed at the bottom only. In order to avoid this we will add some blank lines to the content of the last column.</p>
<p>Here is the proof of concept script, which takes a string and creates as many text fields (= columns) as many required to display the whole text. The script can be placed directly on a frame of an empty .fla and it will work. This script is a proof of concept only, it could be wrapped into a nice class for general use, but this work should be done by somebody else <img src='http://blog.tengerstudio.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (or by me, if I will need it in a real project, but that&#8217;s not the case at the moment).</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// the text to be displayed in multiple columns</span>
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">text</span>: <span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;Lorem ipsum dolor sit amet...&quot;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// the width of a column in pixels</span>
<span style="color: #000000; font-weight: bold;">var</span> columnWidth: <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">200</span>;
<span style="color: #808080; font-style: italic;">// the height of a column in pixels</span>
<span style="color: #000000; font-weight: bold;">var</span> columnHeight: <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">300</span>;
<span style="color: #808080; font-style: italic;">// the space betweeb columns in pixels</span>
<span style="color: #000000; font-weight: bold;">var</span> columnSpacing: <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// the format of the text in the columns</span>
<span style="color: #000000; font-weight: bold;">var</span> tf: <span style="color: #0066CC;">TextFormat</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextFormat</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
tf.<span style="color: #0066CC;">font</span> = <span style="color: #ff0000;">&quot;Arial&quot;</span>;
tf.<span style="color: #0066CC;">size</span> = <span style="color: #cc66cc;">12</span>;
tf.<span style="color: #0066CC;">align</span> = <span style="color: #ff0000;">&quot;left&quot;</span>;
tf.<span style="color: #0066CC;">color</span> = 0x000000;
&nbsp;
<span style="color: #808080; font-style: italic;">// the index of the column currently processed</span>
<span style="color: #000000; font-weight: bold;">var</span> colIndex: <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>;
<span style="color: #808080; font-style: italic;">// the index of the previous column</span>
<span style="color: #000000; font-weight: bold;">var</span> prevColumn: <span style="color: #0066CC;">TextField</span>;
<span style="color: #808080; font-style: italic;">// true, if we have placed the last column and can quit the loop</span>
<span style="color: #000000; font-weight: bold;">var</span> done: <span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">false</span>;
&nbsp;
<span style="color: #b1b100;">do</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #808080; font-style: italic;">// create a text field for the current column</span>
<span style="color: #000000; font-weight: bold;">var</span> column: <span style="color: #0066CC;">TextField</span> = <span style="color: #0066CC;">createTextField</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;column&quot;</span> + colIndex, <span style="color: #0066CC;">getNextHighestDepth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, colIndex <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span>columnWidth + columnSpacing<span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">0</span>, columnWidth, columnHeight<span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// set some properties of the text field</span>
column.<span style="color: #0066CC;">border</span> = <span style="color: #000000; font-weight: bold;">true</span>;
column.<span style="color: #0066CC;">multiline</span> = <span style="color: #000000; font-weight: bold;">true</span>;
column.<span style="color: #0066CC;">wordWrap</span> = <span style="color: #000000; font-weight: bold;">true</span>;
<span style="color: #808080; font-style: italic;">// selectable should be false, otherwise the text field's content will be scrollable,</span>
<span style="color: #808080; font-style: italic;">// and that can mess our precisely positioned text columns</span>
column.<span style="color: #0066CC;">selectable</span> = <span style="color: #000000; font-weight: bold;">false</span>;
column.<span style="color: #0066CC;">setNewTextFormat</span><span style="color: #66cc66;">&#40;</span>tf<span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// place the whole text into each column</span>
column.<span style="color: #0066CC;">text</span> = <span style="color: #0066CC;">text</span>;
<span style="color: #808080; font-style: italic;">// if it is not the first column...</span>
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>prevColumn <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #808080; font-style: italic;">// check whether the last visible line is beyond the last scrollable line, so did we reach</span>
<span style="color: #808080; font-style: italic;">// the last text chunk and the last column or not</span>
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>prevColumn.<span style="color: #0066CC;">bottomScroll</span> <span style="color: #66cc66;">&amp;</span>gt; prevColumn.<span style="color: #0066CC;">maxscroll</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #808080; font-style: italic;">// calculate how many lines are missing from the last chunk to form a whole column</span>
<span style="color: #000000; font-weight: bold;">var</span> missingLines: <span style="color: #0066CC;">Number</span> = prevColumn.<span style="color: #0066CC;">bottomScroll</span> - prevColumn.<span style="color: #0066CC;">maxscroll</span> + colIndex;
<span style="color: #808080; font-style: italic;">// append so many lines to the content of the last column</span>
<span style="color: #000000; font-weight: bold;">var</span> s: <span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;&quot;</span>;
<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i: <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&amp;</span>lt; missingLines; i++<span style="color: #66cc66;">&#41;</span>
s += <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
column.<span style="color: #0066CC;">text</span> += s;
<span style="color: #808080; font-style: italic;">// and quit at the end of the loop, since we reached the last column</span>
done = <span style="color: #000000; font-weight: bold;">true</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #808080; font-style: italic;">// scroll to the line following the last visible line of the previous column</span>
column.<span style="color: #0066CC;">scroll</span> = prevColumn.<span style="color: #0066CC;">bottomScroll</span> + <span style="color: #cc66cc;">1</span>;
<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #808080; font-style: italic;">// in the case of the first column check whether we have the text</span>
<span style="color: #808080; font-style: italic;">// long enough for displaying at least one more column (is the text field scrollable)</span>
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>column.<span style="color: #0066CC;">maxscroll</span> <span style="color: #66cc66;">&amp;</span>lt;= <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
done = <span style="color: #000000; font-weight: bold;">true</span>
<span style="color: #66cc66;">&#125;</span>
prevColumn = column;
colIndex++;
<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>done<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>That&#8217;s all &#8211; enjoy <img src='http://blog.tengerstudio.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Update: I corrected the script according to Mau&#8217;s observation. Thank you Mau for catching the bug!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tengerstudio.com/2009/06/07/multi-column-text/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Some videos on Flash CS4</title>
		<link>http://blog.tengerstudio.com/2008/06/03/some-videos-on-flash-cs4/</link>
		<comments>http://blog.tengerstudio.com/2008/06/03/some-videos-on-flash-cs4/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 21:10:08 +0000</pubDate>
		<dc:creator>tenegri</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[CS4]]></category>

		<guid isPermaLink="false">http://blog.tengerstudio.com/?p=12</guid>
		<description><![CDATA[New tween engine
Inverse kinematics engine
3D tools
Design time video playing &#038; inverse kinematics
New tween engine &#038; 3D &#038; inverse kinematics
Thanks to Reider for the links  
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.youtube.com/watch?v=8_wRMswNLiU">New tween engine</a><br />
<a href="http://www.youtube.com/watch?v=wDjewbDF4bo">Inverse kinematics engine</a><br />
<a href="http://www.youtube.com/watch?v=0GAbMRj0IV0">3D tools</a><br />
<a href="http://www.youtube.com/watch?v=vqMI480D668">Design time video playing &#038; inverse kinematics</a><br />
<a href="http://www.youtube.com/watch?v=AnJKimyTIjo">New tween engine &#038; 3D &#038; inverse kinematics</a></p>
<p>Thanks to Reider for the links <img src='http://blog.tengerstudio.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tengerstudio.com/2008/06/03/some-videos-on-flash-cs4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Useful resources for Flash 10</title>
		<link>http://blog.tengerstudio.com/2008/05/19/useful-resources-for-flash-10/</link>
		<comments>http://blog.tengerstudio.com/2008/05/19/useful-resources-for-flash-10/#comments</comments>
		<pubDate>Mon, 19 May 2008 20:28:35 +0000</pubDate>
		<dc:creator>tenegri</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flash 10]]></category>

		<guid isPermaLink="false">http://blog.tengerstudio.com/?p=11</guid>
		<description><![CDATA[In this post I collected some useful resources related to Flash 10, which I found up to now. I&#8217;m going to keep this list up to date and extend it as I obtain more interesting links.
Targeting Flash Player 10 beta and development tools
1. Targeting Flash Player 10 Beta with Flex SDK 3.0.x
2. Flex 3 SDK [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I collected some useful resources related to Flash 10, which I found up to now. I&#8217;m going to keep this list up to date and extend it as I obtain more interesting links.</p>
<p><strong>Targeting Flash Player 10 beta and development tools</strong><br />
1. <a href="http://opensource.adobe.com/wiki/display/flexsdk/Targeting+Flash+Player+10+Beta+with+Flex+SDK+3.0.x" target="_blank">Targeting Flash Player 10 Beta with Flex SDK 3.0.x</a><br />
2. <a href="http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+3" target="_blank">Flex 3 SDK Downloads &#8211; The latest Flex SDK, which is capable of compiling Flash 10 targeted movies. Also includes a stand-alone debug player (version 10)</a><br />
3. <a href="http://www.flashdevelop.org/community/viewtopic.php?t=3039" target="_blank">Flash Player 10 support in FlashDevelop</a><br />
4. <a href="http://www.gotoandlearn.com/player.php?id=73" target="_blank">How to get started with creating content for Flash Player 10 (video tutorial)</a></p>
<p><strong>3D, the new Drawing API, GPU acceleration</strong><br />
1. <a href="http://www.senocular.com/flash/tutorials/flash10drawingapi" target="_blank">Senocular: Flash Player 10 Drawing API</a><br />
2. <a href="http://www.kaourantin.net/2008/05/what-does-gpu-acceleration-mean.html" target="_blank">Tinic Uro: What does GPU acceleration mean?</a><br />
3. <a href="http://www.gotoandlearn.com/player.php?id=74" target="_blank">How to take ordinary display objects into the third dimension in Astro (video tutorial)</a><br />
4. <a href="http://blogs.adobe.com/penguin.swf/2008/05/flash_uses_the_gpu.html" target="_blank">Mike Melanson: Flash Uses The GPU</a></p>
<p><strong>Creating dynamic sounds</strong><br />
1. <a href="http://www.kaourantin.net/2008/05/adobe-is-making-some-noise-part-1.html" target="_blank">Tinic Uro: Adobe is making some noise. Part 1</a><br />
2. <a href="http://www.kaourantin.net/2008/05/adobe-is-making-some-noise-part-2.html" target="_blank">Tinic Uro: Adobe is making some noise. Part 2</a><br />
3. <a href="http://www.kaourantin.net/2008/05/adobe-is-making-some-noise-part-3.html" target="_blank">Tinic Uro: Adobe is making some noise. Part 3</a><br />
4. <a href="http://www.bit-101.com/blog/?p=1264" target="_blank">Keith Peters: Astro dynamic sound!</a><br />
5. <a href="http://www.gotoandlearn.com/player.php?id=75" target="_blank">How to dynamically create sounds using the new features in Astro (video tutorial)</a><br />
6. <a href="http://www.blixtsystems.com/2008/05/random-thoughts-on-vectors-and-samplescallbackdata/" target="_blank">Leo Bergman: Random thoughts on Vectors and samplesCallbackData</a></p>
<p><strong>Advanced text rendering</strong><br />
1. <a href="http://www.flashmagazine.com/news/detail/flash_player_10_feature_new_text_engine/" target="_blank">New text engine</a></p>
<p><strong>Loading and saving files without server (FileReference)</strong><br />
1. <a href="http://www.flashmagazine.com/news/detail/flash_player_10_new_feature_load_and_save_files_using_filereference/" target="_blank">Load and save files using FileReference</a><br />
2. <a href="http://www.gotoandlearn.com/player.php?id=76" target="_blank">How to read and write local files using the new methods of the FileReference class (video tutorial)</a></p>
<p><strong>Streaming, peer-to-peer audio and video</strong><br />
1. <a href="http://www.flashcomguru.com/index.cfm/2008/5/15/player-10-beta-speex-p2p-rtmfp" target="_blank">Peer to peer, Speex and UDP now in Flash Player 1</a><br />
2. <a href="http://justin.everett-church.com/index.php/2008/05/16/rtmfp-in-flash-player-10-beta/" target="_blank">Justin Everett-Church: RTMFP in Flash Player 10 beta</a><br />
3. <a href="http://justin.everett-church.com/index.php/2008/05/23/astrop2p/" target="_blank">Justin Everett-Church: Peer to Peer (P2P) in Flash Player 10 beta</a></p>
<p><strong>Other topics</strong><br />
1. <a href="http://www.blixtsystems.com/2008/05/random-thoughts-on-vectors-and-samplescallbackdata/" target="_blank">Leo Bergman: Random thoughts on Vectors and samplesCallbackData</a></p>
<p><strong>Documentation</strong><br />
1. <a href="http://dev.dschini.org/astro/api/" target="_blank">Flash Player 10 (Astro) API (new additions only)</a><br />
2. <a href="http://download.macromedia.com/pub/labs/flashplayer10/flashplayer10_as3langref_052008.zip" target="_blank">Flash Player 10 Language Reference (official Adobe documentation)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tengerstudio.com/2008/05/19/useful-resources-for-flash-10/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flash Player 10 Class Browser</title>
		<link>http://blog.tengerstudio.com/2008/05/16/flash-player-10-class-browser/</link>
		<comments>http://blog.tengerstudio.com/2008/05/16/flash-player-10-class-browser/#comments</comments>
		<pubDate>Fri, 16 May 2008 09:01:08 +0000</pubDate>
		<dc:creator>tenegri</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Astro]]></category>
		<category><![CDATA[Flash 10]]></category>

		<guid isPermaLink="false">http://blog.tengerstudio.com/?p=10</guid>
		<description><![CDATA[Since there is no public documentation for the new Flash Player 10 API I have created a small Flex application which makes easier to discover the properties and methods of the new classes. I also extracted the list of classes defined in the Flash 10&#8217;s playerglobal.swc (it is accessible in the latest build of Flex [...]]]></description>
			<content:encoded><![CDATA[<p>Since there is no public documentation for the new Flash Player 10 API I have created a small Flex application which makes easier to discover the properties and methods of the new classes. I also extracted the list of classes defined in the Flash 10&#8217;s playerglobal.swc (it is accessible in the latest build of Flex SDK) and placed into the class browser. So, now you can pick a class name from this list or enter a class name of your choice, click on the Describe button and see the result.</p>
<p>The class browser is on-line <a href="http://www.tengerstudio.com/public/flash10/class_browser" target="_blank">here</a>.</p>
<p>Maybe I will post the results of my (and other&#8217;s) discoveries later with examples <img src='http://blog.tengerstudio.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Some keywords till then (beyond the features mentioned on Adobe&#8217;s site):</p>
<ul>
<li>run-time sound generation</li>
<li>accessing local files through FileReference without uploading to a server</li>
<li>new Vector class with generics</li>
<li>etc.</li>
</ul>
<p>[Update]<br />
Some people reported that the class browser doesn&#8217;t worksand the version detection script prevents it from running (claiming a new player installation). I don&#8217;t know what does cause the problem, yet, but I provide here a direct link to the SWF itself until I solve the issue:<br />
<a href="http://tengerstudio.com/public/flash10/class_browser/ClassBrowser.swf" target="_blank">http://tengerstudio.com/public/flash10/class_browser/ClassBrowser.swf</a></p>
<p>[Update 2]<br />
I made a minor addition, and the class browser now displays also the class&#8217; constructor among the methods.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tengerstudio.com/2008/05/16/flash-player-10-class-browser/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Flash Player 10 beta released</title>
		<link>http://blog.tengerstudio.com/2008/05/16/flash-player-10-beta-released/</link>
		<comments>http://blog.tengerstudio.com/2008/05/16/flash-player-10-beta-released/#comments</comments>
		<pubDate>Thu, 15 May 2008 23:13:42 +0000</pubDate>
		<dc:creator>tenegri</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Astro]]></category>
		<category><![CDATA[Flash 10]]></category>

		<guid isPermaLink="false">http://blog.tengerstudio.com/?p=9</guid>
		<description><![CDATA[Adobe released the beta version of the next Flash Player 10 (codename Astro). Further details, downloads, examples and videos are here:
http://labs.adobe.com/technologies/flashplayer10/
The development tools are not published yet, but you can configure Flex SDK to compile to Flash Player 10. Here is the how to.
If somebody is not familiar with Flex, it is possible to use [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe released the beta version of the next Flash Player 10 (codename Astro). Further details, downloads, examples and videos are here:</p>
<p><a title="http://labs.adobe.com/technologies/flashplayer10/" href="http://labs.adobe.com/technologies/flashplayer10/" target="_blank">http://labs.adobe.com/technologies/flashplayer10/</a></p>
<p>The development tools are not published yet, but you can configure Flex SDK to compile to Flash Player 10. <a href="http://opensource.adobe.com/wiki/display/flexsdk/Targeting+Flash+Player+10+Beta+with+Flex+SDK+3.0.x" target="_blank">Here</a> is the how to.</p>
<p>If somebody is not familiar with Flex, it is possible to use Flash CS3 for the same purpose by utilizing some minor hacks. Just follow these steps:<br />
<span id="more-9"></span><br />
1. Create your Flash movie and write ActionScript with the current development tool (Flash CS3).</p>
<p>2. While writing your ActionScript code take into consideration that the new identifiers, methods and properties will not be recognized by the compiler, so use square brackets where necessary, so instead myObject.propertyName use myObject["propertyName"], and instead myObject.methodName() use myObject["methodName"]().</p>
<p>3. Compile the sources into a SWF file.</p>
<p>4. (This step seems to be optional.) Up to now my SWFs compiled for player 9 were running in Flash Player 10 without any change, and I could use the new features. However it seems possible that setting the target version to 10 is required in some cases, so if you meet such case just change the 4th byte of the SWF file to hexadecimal value 0A (decimal 10 &#8211; this byte indicates the target player version) using a hexa editor (e.g.: <a title="XVI32" href="http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm" target="_blank">XVI32</a>).</p>
<p>5. Create an HTML document for embedding your Flash movie. I used <a title="http://code.google.com/p/swfobject/" href="http://code.google.com/p/swfobject/" target="_blabk">SWFObject 2</a>, which is compatible with Flash Player 10, and the embedding HTML looks like this one:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&amp;lt; !DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&amp;gt;
&nbsp;
		&lt;script src=&quot;http://blog.tengerstudio.com/wp-admin/swfobject.js&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:0--&gt;&lt;/script&gt;
		&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--mce:1--&gt;&lt;/script&gt;
&lt;div id=&quot;myContent&quot;&gt;
&lt;h1&gt;Alternative content&lt;/h1&gt;
&lt;a href=&quot;http://www.adobe.com/go/getflashplayer&quot;&gt;&lt;img src=&quot;http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif&quot; alt=&quot;Get Adobe Flash player&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</pre></div></div>

<p>Replace the parameter values of the embedSWF() method and let&#8217;s go. Don&#8217;t forget to place swfobject.js into the same directory as the HTML document, and of course install Flash Player 10 <img src='http://blog.tengerstudio.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here is a small sample script which uses the new 3D features for creating a rotating object:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> ns: Namespace = <span style="color: #000000; font-weight: bold;">new</span> Namespace<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;http://www.adobe.com/2008/actionscript/Flash10/&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> minZ: <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>;
<span style="color: #000000; font-weight: bold;">var</span> maxZ: <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">1000</span>;
<span style="color: #000000; font-weight: bold;">var</span> zStep: <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> enterFrame<span style="color: #66cc66;">&#40;</span>aEvent: Event<span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
	logo.<span style="color: #006600;">ns</span>::rotationY += <span style="color: #cc66cc;">1</span>;
	logo.<span style="color: #006600;">ns</span>::rotationZ += <span style="color: #cc66cc;">1</span>;
	logo.<span style="color: #006600;">ns</span>::z += zStep;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>logo.<span style="color: #006600;">ns</span>::z <span style="color: #66cc66;">&amp;</span>lt; minZ <span style="color: #66cc66;">||</span> logo.<span style="color: #006600;">ns</span>::z <span style="color: #66cc66;">&amp;</span>gt; maxZ<span style="color: #66cc66;">&#41;</span>
		zStep = -zStep;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
addEventListener<span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, enterFrame<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>You can see this sample on-line <a href="http://tengerstudio.com/public/flash10/3d_test1">here</a>. Don&#8217;t forget to install Flash Playar 10 to see it in action.</p>
<p>The API documentation of the new player is not available at the moment, so discovering the new features is a must <img src='http://blog.tengerstudio.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tengerstudio.com/2008/05/16/flash-player-10-beta-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Are there real int and uint types?</title>
		<link>http://blog.tengerstudio.com/2008/05/03/are-there-real-int-and-uint-types/</link>
		<comments>http://blog.tengerstudio.com/2008/05/03/are-there-real-int-and-uint-types/#comments</comments>
		<pubDate>Sat, 03 May 2008 15:19:29 +0000</pubDate>
		<dc:creator>tenegri</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://blog.tengerstudio.com/?p=8</guid>
		<description><![CDATA[In Actionscript 3 all types, even the primitive types are considered as classes, so String, Number, Boolean, int are such ones, too. By invoking getQualifiedClassName() we can get the fully qualified class name of an object:

1
2
3
4
5
var n_num: Number;
trace&#40;getQualifiedClassName&#40;n_num&#41;&#41;; // Number
&#160;
var n_int: int;
trace&#40;getQualifiedClassName&#40;n_int&#41;&#41;; // int

This outputs the result as expected: Number and int. The uint however [...]]]></description>
			<content:encoded><![CDATA[<p>In Actionscript 3 all types, even the primitive types are considered as classes, so String, Number, Boolean, int are such ones, too. By invoking getQualifiedClassName() we can get the fully qualified class name of an object:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> n_num: <span style="color: #0066CC;">Number</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>getQualifiedClassName<span style="color: #66cc66;">&#40;</span>n_num<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// Number</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> n_int: <span style="color: #0066CC;">int</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>getQualifiedClassName<span style="color: #66cc66;">&#40;</span>n_int<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// int</span></pre></td></tr></table></div>

<p>This outputs the result as expected: Number and int. The uint however seems to be somewhat different. If a value of uint type passed to getClassByName(), one would except that the result will be &#8220;uint&#8221;, but actually this is not true.<br />
<span id="more-8"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> n_uint: uint;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>getQualifiedClassName<span style="color: #66cc66;">&#40;</span>n_uint<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// int</span></pre></td></tr></table></div>

<p>The result is &#8220;int&#8221; instead of &#8220;uint&#8221;. Well, that&#8217;s not a big surprise, I can imagine that unsigned integers are internally handled by the same class as signed ones. But the situation is more complex, not only uint behaves weird:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> n_num: <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">12</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>getQualifiedClassName<span style="color: #66cc66;">&#40;</span>n_num<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// int</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> n_int: <span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">12</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>getQualifiedClassName<span style="color: #66cc66;">&#40;</span>n_int<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// int</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> n_uint: uint = <span style="color: #cc66cc;">12</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>getQualifiedClassName<span style="color: #66cc66;">&#40;</span>n_uint<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// int</span></pre></td></tr></table></div>

<p>If I overwrite the default values and assign the same integer value to all three variables even n_num (of type Number) will be considered as of class int! If I assign a non-integer value to n_num, the result will be Number as expected:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> n_num: <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">12.3</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>getQualifiedClassName<span style="color: #66cc66;">&#40;</span>n_num<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// Number</span></pre></td></tr></table></div>

<p>Does it mean that the class depends on the actual value of the variable? At the first look it seems to be possible, but when I checked whether the class definition (class object) of int and Number are really different, I found that they are not!</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> n_num: <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">12.3</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>n_num<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;constructor&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// [class Number]</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> n_int: <span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">12</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>n_int<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;constructor&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// [class Number]</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> n_uint: uint = <span style="color: #cc66cc;">12</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>n_uint<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;constructor&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// [class Number]</span>
&nbsp;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>n_num<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;constructor&quot;</span><span style="color: #66cc66;">&#93;</span> == n_int<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;constructor&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// true</span></pre></td></tr></table></div>

<p>All three numeric types are handled by the same Number class. It doesn&#8217;t mean however that both integer and real numbers are handled similarly by the Number class, but their classes are actually the same.</p>
<p>Earlier there was another weird issue with uint, namely that sometimes its type was changed from int to Number and sometimes back from Number to int. This occured with certain values assigned to the variable. I met this issue some times ago, but it seems to be not reproductible now, probably a recent player update corrected the problem. At last I provide here some links where the actual explanation for this issue can be found (see the comments, too) and some general information related to numbers in Actionscript 3 are also collected there:</p>
<p><a href="http://drawlogic.com/2007/06/06/as3-interesting-numeric-storage-behavior/#comments">Ryan Christensen: AS3 Interesting Numeric Storage Behavior</a><br />
<a href="http://blog.andre-michelle.com/2007/weird_behavior_of_numbers_in_as3/">Andre Michelle: Weird behavior of numbers in as3</a><br />
<a href="http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/">Michael Baczynski: Bitwise gems &#8211; fast integer math</a><br />
<a href="http://lab.polygonal.de/2007/06/06/int-uint-and-number-data-type-conversion/">Michael Baczynski: Int, uint and number data type conversion</a><br />
<a href="http://kuwamoto.org/2006/06/15/avoid-ints-in-actionscript/">Sho Kuwamoto: Avoid ints in ActionScript</a><br />
<a href="http://www.gskinner.com/blog/archives/2006/06/types_in_as3_in.html">Grant Skinner: Types in AS3: ints not so fast, uints slow!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tengerstudio.com/2008/05/03/are-there-real-int-and-uint-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ApplicationDomain &#8211; parent and child</title>
		<link>http://blog.tengerstudio.com/2008/04/15/applicationdomain-parent-and-child/</link>
		<comments>http://blog.tengerstudio.com/2008/04/15/applicationdomain-parent-and-child/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 21:29:34 +0000</pubDate>
		<dc:creator>tenegri</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://blog.tengerstudio.com/?p=5</guid>
		<description><![CDATA[When loading a SWF into a Flash movie you can specify the application domain which the loaded movie will use. If this application domain is a child domain of the loader&#8217;s (or other movie&#8217;s) domain and &#8220;the child defines a class with the same name as a class already defined by the parent, no error [...]]]></description>
			<content:encoded><![CDATA[<p>When loading a SWF into a Flash movie you can specify the application domain which the loaded movie will use. If this application domain is a child domain of the loader&#8217;s (or other movie&#8217;s) domain and <i>&#8220;the child defines a class with the same name as a class already defined by the parent, no error results; the child simply inherits the parent&#8217;s definition of that class, and the child&#8217;s conflicting definition goes unused unless either child or parent calls the ApplicationDomain.getDefinition() method to retrieve it.&#8221;</i> (quoted from the documentation)</p>
<p>The first part of the quoted sentence is true, but the second one is not working. Calling getDefinition() on the child domain will return a reference to the parent&#8217;s class instead of the child&#8217;s original one. I think this is rather a mistake in the documentation than a player bug, since it seems quite logical: referencing a class by the normal way and through getDefinition() should evaluate to the same value. Anyway, I already posted a small note about that to the online documentation.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tengerstudio.com/2008/04/15/applicationdomain-parent-and-child/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Namespace and URI</title>
		<link>http://blog.tengerstudio.com/2008/04/13/namespace-and-uri/</link>
		<comments>http://blog.tengerstudio.com/2008/04/13/namespace-and-uri/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 16:35:31 +0000</pubDate>
		<dc:creator>tenegri</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://blog.tengerstudio.com/?p=4</guid>
		<description><![CDATA[Recently I played a little bit with namespaces in ActionScript 3 and found a somewhat weird thing. Namespaces have an associated URI which makes them unique. When you define a namespace you can specify an explicit URI or you can omit it. In the latter case the compiler will assign a unique value automatically, so [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I played a little bit with namespaces in ActionScript 3 and found a somewhat weird thing. Namespaces have an associated URI which makes them unique. When you define a namespace you can specify an explicit URI or you can omit it. In the latter case the compiler will assign a unique value automatically, so everything should work perfectly. Class members placed into a namespace can be referenced by two ways:</p>
<p>1) by opening the namespace and then referring to the desired member:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">use namespace something;
myFunction<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>2) by qualifying the method or property with the namespace:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">something::myFunction<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>This is what the documentation says. But in practice when I omit the URI only the first way will work and the second one will not. The compiler passes over, everything seems to be OK, but suddenly my namespaces defined without URI are not found at run-time. E.g. I have a package where I define two namespaces, one without an explicit URI and one with a URI:<br />
<span id="more-4"></span><br />
first.as</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">package mypackage <span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">public</span> namespace first;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>second.as</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">package mypackage <span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">public</span> namespace second = <span style="color: #ff0000;">&quot;http://tengerstudio.com/namespace/second&quot;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>And also there is a class using them and defining some methods placed into the above two namespaces:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">package mypackage <span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyClass <span style="color: #66cc66;">&#123;</span>
    first <span style="color: #000000; font-weight: bold;">function</span> doSomething<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: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;doing something&quot;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    first <span style="color: #000000; font-weight: bold;">function</span> doSomethingElse<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: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;doing something else 1&quot;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    second <span style="color: #000000; font-weight: bold;">function</span> doSomethingElse<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: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;doing something else 2&quot;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>This all works, yet, so I instantiate this class and try to invoke the doSomething() method:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> mypackage.<span style="color: #66cc66;">*</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> obj: MyClass = <span style="color: #000000; font-weight: bold;">new</span> MyClass<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
use namespace first;
&nbsp;
obj.<span style="color: #006600;">doSomething</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>This works. But if I use the namespace qualifier, a ReferenceError is thrown:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> mypackage.<span style="color: #66cc66;">*</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> obj: MyClass = <span style="color: #000000; font-weight: bold;">new</span> MyClass<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
obj.<span style="color: #006600;">first</span>::doSomething<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>The result is:</p>
<blockquote><p>ReferenceError: Error #1069: Property mypackage:first::doSomething not found on mypackage.MyClass and there is no default value.<br />
	at namespace2_fla::MainTimeline/frame1()</p></blockquote>
<p>It can be avoided of course if I use the first method, but sometimes it&#8217;s not possible, e.g. when there are two or more identical identifiers in different namespaces (as in the case of the doSomethingElse() methods in MyClass) and I want to use all of them.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> mypackage.<span style="color: #66cc66;">*</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> obj: MyClass = <span style="color: #000000; font-weight: bold;">new</span> MyClass<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
use namespace first;
obj.<span style="color: #006600;">doSomethingElse</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
use namespace second;
obj.<span style="color: #006600;">doSomethingElse</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>It will result in a compiler error saying that the reference to doSomething() is ambiguous (of course). But when I try to avoid this and specify exact namespaces:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> mypackage.<span style="color: #66cc66;">*</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> obj: MyClass = <span style="color: #000000; font-weight: bold;">new</span> MyClass<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
obj.<span style="color: #006600;">first</span>::doSomethingElse<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
obj.<span style="color: #006600;">second</span>::doSomethingElse<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>I get a run-time error:</p>
<blockquote><p>ReferenceError: Error #1069: Property mypackage:first::doSomething not found on mypackage.MyClass and there is no default value.<br />
	at namespace2_fla::MainTimeline/frame1()</p></blockquote>
<p>The result is the same when I include the <i>use namespace</i> statement. If I don&#8217;t refer to namespace <i>first</i> (which has no associated URI), there is no error, namespace <i>second</i> is working (which has a URI), and if I add a URI to namespace <i>first</i> it will run perfectly, too:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">package mypackage <span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">public</span> namespace first = <span style="color: #ff0000;">&quot;http://tengerstudio.com/namespace/first&quot;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>What is the conclusion? Never forget to associate a URI with a namespace, even if the documentation says that this is optional.</p>
<p>Well, beside the above ones I mention one more thing related to namespaces, which was not evident to me, but finally I figured out how to use it. This is accessing a namespace defined in a class rather than in a package:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">package mypackage <span style="color: #66cc66;">&#123;</span>
&nbsp;
  <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyClass2 <span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #0066CC;">public</span> namespace third = <span style="color: #ff0000;">&quot;http://tengerstudio.com/namespace/third&quot;</span>;
&nbsp;
    third <span style="color: #000000; font-weight: bold;">function</span> foo<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: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;foo&quot;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>The only way I could access and use what is in namespace <i>third</i> was placing it&#8217;s value into a variable and referring to the members through this variable:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> mypackage.<span style="color: #66cc66;">*</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> obj: MyClass2 = <span style="color: #000000; font-weight: bold;">new</span> MyClass2<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> ns: Namespace = MyClass2.<span style="color: #006600;">third</span>;
&nbsp;
obj.<span style="color: #006600;">ns</span>::foo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>So it seems that namespaces defined in a class are always static members, although the static attribute is not allowed on namespace definitions (it throws a compiler error). No other ways worked for me including these ones:</p>
<pre lang="" line="1">
// 1
obj.third::foo();

// 2
obj.(MyClass2.third)::foo();

// 3
use namespace MyClass2.third;
obj.third::foo();

// 4
var ns: Namespace = MyClass.third;
use namespace ns;
obj.foo();
</pre>
<p>What is also interesting, that I can omit the URI at the definition of namespace <i>third</i> and it will work through the variable reference, so only package level namespaces require URI for using them as direct qualifiers.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tengerstudio.com/2008/04/13/namespace-and-uri/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
