<?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>Talos</title>
	<atom:link href="http://www.talos.cz/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.talos.cz</link>
	<description>blog pro osvícence, kteří neovládají gramatiku</description>
	<lastBuildDate>Wed, 05 Oct 2011 13:19:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>SecurityError: fileWriteResource</title>
		<link>http://www.talos.cz/2010/05/31/securityerror-filewriteresource/</link>
		<comments>http://www.talos.cz/2010/05/31/securityerror-filewriteresource/#comments</comments>
		<pubDate>Mon, 31 May 2010 15:48:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.talos.cz/?p=309</guid>
		<description><![CDATA[Poprvé si začínám hrát trochu s AIR a hned se objevila první překážka při zápisu dat do adresáře s aplikací. Nejdříve jsem napsal takovýto kód. var file:File = File.applicationDirectory.resolvePath&#40;&#34;test.txt&#34;&#41;; var stream:FileStream = new FileStream&#40;&#41;; stream.open&#40;file,FileMode.WRITE&#41;; stream.writeUTF&#40;&#34;ahoj&#34;&#41;; stream.close&#40;&#41;; To ale nefunguje a vypisuje to chybu. Tak jsem použil podle dokumentace druhý způsob zápisu cesty k souboru, [...]]]></description>
			<content:encoded><![CDATA[<p>Poprvé si začínám hrát trochu s AIR a hned se objevila první překážka při zápisu dat do adresáře s aplikací.<br />
<span id="more-309"></span><br />
Nejdříve jsem napsal takovýto kód.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> file<span style="color: #000066; font-weight: bold;">:</span>File = File<span style="color: #000066; font-weight: bold;">.</span>applicationDirectory<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;test.txt&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> stream<span style="color: #000066; font-weight: bold;">:</span>FileStream = <span style="color: #0033ff; font-weight: bold;">new</span> FileStream<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
stream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">open</span><span style="color: #000000;">&#40;</span>file<span style="color: #000066; font-weight: bold;">,</span>FileMode<span style="color: #000066; font-weight: bold;">.</span>WRITE<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
stream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">writeUTF</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;ahoj&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
stream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>To ale nefunguje a vypisuje to chybu. Tak jsem použil podle dokumentace druhý způsob zápisu cesty k souboru, který ale musí být absolutní.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> file<span style="color: #000066; font-weight: bold;">:</span>File = <span style="color: #0033ff; font-weight: bold;">new</span> File<span style="color: #000000;">&#40;</span>File<span style="color: #000066; font-weight: bold;">.</span>applicationDirectory<span style="color: #000066; font-weight: bold;">.</span>nativePath<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;/test.txt&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> stream<span style="color: #000066; font-weight: bold;">:</span>FileStream = <span style="color: #0033ff; font-weight: bold;">new</span> FileStream<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
stream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">open</span><span style="color: #000000;">&#40;</span>file<span style="color: #000066; font-weight: bold;">,</span>FileMode<span style="color: #000066; font-weight: bold;">.</span>WRITE<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
stream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">writeUTF</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;ahoj&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
stream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>Tento zápis již funguje.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talos.cz/2010/05/31/securityerror-filewriteresource/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Grafický editor &#8211; 1.díl AS3</title>
		<link>http://www.talos.cz/2010/03/11/graficky-editor-1-dil/</link>
		<comments>http://www.talos.cz/2010/03/11/graficky-editor-1-dil/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 07:17:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.talos.cz/?p=297</guid>
		<description><![CDATA[Tentokrát, jsem připravil ukázku rastrového grafického editoru se základními funkcemi, hlavně se budu zabývat objektem BitmapData a jeho vybranými metodami. Nejdřív začneme s úplně tím nejzkládnějším a to je nakreslení čáry. Budu předpokládat, že máme nějakou plochu.(plane) var helpSprite:Sprite = new Sprite&#40;&#41;; addChild&#40;helpSprite&#41;; var mouse:Boolean = false; var size:Number = 10; var color:uint = 0; [...]]]></description>
			<content:encoded><![CDATA[<p>Tentokrát, jsem připravil ukázku rastrového grafického editoru se základními funkcemi, hlavně se budu zabývat objektem BitmapData a jeho vybranými metodami.<br />
<span id="more-297"></span><br />
Nejdřív začneme s úplně tím nejzkládnějším a to je nakreslení čáry. Budu předpokládat, že máme nějakou plochu.(plane)</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> helpSprite<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>helpSprite<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> mouse<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">size</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">color</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> circle<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>circle<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
setSize<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span>move<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_DOWN</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">mouseDown</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_UP</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">mouseUp</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> move<span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseX</span><span style="color: #000066; font-weight: bold;">;</span>
	circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseY</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>mouse<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		helpSprite<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span>plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseX</span><span style="color: #000066; font-weight: bold;">,</span>plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseY</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">mouseDown</span><span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	mouse = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
	helpSprite<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineStyle</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">size</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">color</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	helpSprite<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">moveTo</span><span style="color: #000000;">&#40;</span>plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseX</span><span style="color: #000066; font-weight: bold;">,</span>plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseY</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">mouseUp</span><span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	mouse = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #339966; font-weight: bold;">function</span> setSize<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">color</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">0.8</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawCircle</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">size</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Další funkce grafického programu je guma, ale kvůli ní si musíme uvědomit, že pokud chceme gumovat musíme mít odkud. To znamená, že musíme vykreslovat tu čáru do Bitmapy. Takže po úpravě to bude vypadat nějak takto.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> helpSprite<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> bmpData<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">BitmapData</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">BitmapData</span><span style="color: #000000;">&#40;</span>plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">,</span>plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">,</span>0xff<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> vrstva1<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> bmp<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Bitmap</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Bitmap</span><span style="color: #000000;">&#40;</span>bmpData<span style="color: #000066; font-weight: bold;">,</span><span style="color: #990000;">&quot;auto&quot;</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
vrstva1<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>bmp<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>vrstva1<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #6699cc; font-weight: bold;">var</span> mouse<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">size</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">color</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> circle<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>circle<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
setSize<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span>moving<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_DOWN</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">mouseDown</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_UP</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">mouseUp</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> moving<span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseX</span><span style="color: #000066; font-weight: bold;">;</span>
	circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseY</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>mouse<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		helpSprite<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span>plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseX</span><span style="color: #000066; font-weight: bold;">,</span>plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseY</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		bmp<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>bmpData<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">mouseDown</span><span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	mouse = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
	helpSprite<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineStyle</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">size</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">color</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	helpSprite<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">moveTo</span><span style="color: #000000;">&#40;</span>plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseX</span><span style="color: #000066; font-weight: bold;">,</span>plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseY</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">mouseUp</span><span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	mouse = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
	helpSprite<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #339966; font-weight: bold;">function</span> setSize<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">color</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">0.8</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawCircle</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">size</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Teď už můžeme přidat další funkci. Gumování může vypadat, tak že budeme mít v nějakém původním objektu BitmapData nějaký výchozí stav, do kterého budeme přepisovat aktuální objekt BitmapData. Kód by mohl vypadat nějak takto.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #339966; font-weight: bold;">function</span> moving<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseX</span><span style="color: #000066; font-weight: bold;">;</span>
	circle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseY</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>mouse<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">offset</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span>plane<span style="color: #000066; font-weight: bold;">.</span>mouseX<span style="color: #000066; font-weight: bold;">-</span><span style="color: #004993;">size</span> <span style="color: #000066; font-weight: bold;">,</span> plane<span style="color: #000066; font-weight: bold;">.</span>mouseY<span style="color: #000066; font-weight: bold;">-</span><span style="color: #004993;">size</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">drawRect</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Rectangle</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">offset</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">offset</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">size</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">size</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		bmpData<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">copyPixels</span><span style="color: #000000;">&#40;</span>bmpData<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">drawRect</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">offset</span><span style="color: #000066; font-weight: bold;">,</span> bmpDataEdge<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #339966; font-weight: bold;">function</span> prepare<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	eraseCircle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	eraseCircle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawCircle</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">size</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">size</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">size</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	bmpDataEdge = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">BitmapData</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">size</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">size</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">,</span> 0xFFFFFFFF<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Rectangle</span>=<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Rectangle</span><span style="color: #000000;">&#40;</span>bmpDataEdge<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">,</span>bmpDataEdge<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	bmpDataEdge<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>eraseCircle<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	bmpDataEdge<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">copyChannel</span><span style="color: #000000;">&#40;</span>bmpDataEdge<span style="color: #000066; font-weight: bold;">,</span> bmpDataEdge<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">getColorBoundsRect</span><span style="color: #000000;">&#40;</span>0xFFFFFF<span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">8</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Funkce prepare se musí vykonat před použítím gumy.<br />
A poslední funkce grafické aplikace bude výplň. Ta lze udělat velmi snadno.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">bmpData<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floodFill</span><span style="color: #000000;">&#40;</span>plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseX</span><span style="color: #000066; font-weight: bold;">,</span>plane<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">mouseY</span><span style="color: #000066; font-weight: bold;">,</span>ARGB<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>Důležité snad je, že se zde zadává barva v jiném formátu než normálně. Formát ARGB přidává jako první číslici ještě hodnotu alphy (průhlednost).</p>
<p>Zdrojové soubory, jsou k dispozici <a href="http://www.talos.cz/prilohy-flash/grapheditor/editor1.zip" target="_blank">zde.</a><br />
Ukázka je níže.<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="data" value="http://www.talos.cz/prilohy-flash/grapheditor/drawing1.swf" /><param name="src" value="http://www.talos.cz/prilohy-flash/grapheditor/drawing1.swf" /><embed type="application/x-shockwave-flash" width="550" height="400" src="http://www.talos.cz/prilohy-flash/grapheditor/drawing1.swf" data="http://www.talos.cz/prilohy-flash/grapheditor/drawing1.swf"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.talos.cz/2010/03/11/graficky-editor-1-dil/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embed font přes meta-data AS3</title>
		<link>http://www.talos.cz/2009/11/01/embed-font-pres-meta-data-as3/</link>
		<comments>http://www.talos.cz/2009/11/01/embed-font-pres-meta-data-as3/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 16:58:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.talos.cz/?p=286</guid>
		<description><![CDATA[Flash CS4 zaznamenal jeden vcelku závažný problém, a to že když se vloží do knihovny font, tak k výslednému flashi se sice připojí, ale bohužel ne kompletní. To lze vyřešit za pomocí Flex builderu(Flash builderu), díky kterému se nová možnost vkládání fontů přidala i do Flashe CS4. Jediné omezení ve Flashi je, že se toto [...]]]></description>
			<content:encoded><![CDATA[<p>Flash CS4 zaznamenal jeden vcelku závažný problém, a to že když se vloží do knihovny font, tak k výslednému flashi se sice připojí, ale bohužel ne kompletní. To lze vyřešit za pomocí Flex builderu(Flash builderu), díky kterému se nová možnost vkládání fontů přidala i do Flashe CS4.<br />
<span id="more-286"></span><br />
Jediné omezení ve Flashi je, že se toto řešení nedá použít přímo na časové ose, ale pouze ve třídě. Ale to by neměl být žádný problém. </p>
<p>Ukázka jednoduchého vložení fontu:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main<span style="color: #000000;">&#123;</span>
		<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;C:/WINDOWS/Fonts/arial.ttf&quot;</span><span style="color: #000066; font-weight: bold;">,</span> fontFamily=<span style="color: #990000;">&quot;mujFont&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
                <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> Arial<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Class</span><span style="color: #000066; font-weight: bold;">;</span>
        <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>použití je pak již snadné</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">TextField</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">TextFormat</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MovieClip</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Main <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#123;</span>
        <span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;C:/WINDOWS/Fonts/arial.ttf&quot;</span><span style="color: #000066; font-weight: bold;">,</span> fontFamily=<span style="color: #990000;">&quot;mujFont&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> Arial<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Class</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> txtF<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">TextField</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">TextField</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> txtFMT<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">TextFormat</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">TextFormat</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			txtFMT<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">font</span> = <span style="color: #990000;">&quot;mujFont&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			txtF<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Ahoj světe&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
			txtF<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">embedFonts</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
			txtF<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setTextFormat</span><span style="color: #000000;">&#40;</span>txtFMT<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>txtF<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>										
		<span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Takovéto řešení není, ale na projektech u kterých zavisí na velikosti souboru moc efektivní. Pochopitelně lze načítat font i externě za běhu aplikace, ale velikost lze snížit i tím, že omezíme načítané znaky pouze na latinku. To se dělá pomocí parametru unicodeRange. Pro již zmíněnou latinku toto řešení vypadá asi takto.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;C:/WINDOWS/Fonts/arial.ttf&quot;</span><span style="color: #000066; font-weight: bold;">,</span> fontFamily=<span style="color: #990000;">&quot;mujFont&quot;</span><span style="color: #000066; font-weight: bold;">,</span> unicodeRange=<span style="color: #990000;">&quot;U+0020-U+007F,U+0080-U+00FF,U+0100-U+017F,U+02B0-U+02FF,U+2000-U+206F,U+2070-U+209F,U+2150-U+218F,U+2200-U+227F&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></pre></div></div>

<p>Font Arial zrovna není nejlepší případ na ukázku tohoto omezení, protože obsahuje pouze latinku, ale některé fonty obsahují spoustu zbytečných znaků, které tímto můžeme eliminovat. Například u tohoto fontu můžeme znaky omezit třeba jen na číslice, kde již rozdíl ve velikosti bude znatelný, konkrétně to bude vypadat nějak takto.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;C:/WINDOWS/Fonts/arial.ttf&quot;</span><span style="color: #000066; font-weight: bold;">,</span> fontFamily=<span style="color: #990000;">&quot;mujFont&quot;</span><span style="color: #000066; font-weight: bold;">,</span> unicodeRange=<span style="color: #990000;">&quot;U+0030-U+0039&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></pre></div></div>

<p>Tímto už snížeme velikost asi z 200kB na 2kB.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talos.cz/2009/11/01/embed-font-pres-meta-data-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alive PDF</title>
		<link>http://www.talos.cz/2009/08/05/alive-pdf/</link>
		<comments>http://www.talos.cz/2009/08/05/alive-pdf/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 12:48:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.talos.cz/?p=268</guid>
		<description><![CDATA[Před nějakou dobou jsem natrefil při mých toulkách v různých zákoutí internetu na open source projekt Alive PDF, je to projekt který dokáže v realném čase vytvořit a uložit pdf soubor přímo z flashe. Tenkrát jsem tomu moc nevěnoval pozornost, projekt byl v zárodku a po krátkém vyzkoušení, by se slušně dalo říci, že měl [...]]]></description>
			<content:encoded><![CDATA[<p>Před nějakou dobou jsem natrefil při mých toulkách v různých zákoutí internetu na open source projekt Alive PDF, je to projekt který dokáže v realném čase vytvořit a uložit pdf soubor přímo z flashe. Tenkrát jsem tomu moc nevěnoval pozornost, projekt byl v zárodku a po krátkém vyzkoušení, by se slušně dalo říci, že měl ještě mouchy. Nyní jsem ale potřeboval přesně jeho funkčnost a tak jsem ho vyhledal znovu a musím říct projekt od té doby docela slušně pokročil, a to i přesto, že poslední stabilní verze je <a href="http://alivepdf.bytearray.org/?p=204">0.1.4.9</a>.<br />
<span id="more-268"></span><br />
Nejvíce se mi na tomto projektu líbí jeho snadná implementace. Je to snazší než by si člověk myslel.<br />
Malá ukázka.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> mojePDF <span style="color: #000066; font-weight: bold;">:</span> PDF = <span style="color: #0033ff; font-weight: bold;">new</span> PDF <span style="color: #000000;">&#40;</span> Orientation<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">PORTRAIT</span><span style="color: #000066; font-weight: bold;">,</span> Unit<span style="color: #000066; font-weight: bold;">.</span>MM<span style="color: #000066; font-weight: bold;">,</span>Size<span style="color: #000066; font-weight: bold;">.</span>A4<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
mojePDF<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addPage</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
mojePDF<span style="color: #000066; font-weight: bold;">.</span>addImage <span style="color: #000000;">&#40;</span>pozadi1<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">,</span> ImageFormat<span style="color: #000066; font-weight: bold;">.</span>JPG<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> 
&nbsp;
mojePDF<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addPage</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
mojePDF<span style="color: #000066; font-weight: bold;">.</span>addImage <span style="color: #000000;">&#40;</span>pozadi2<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">,</span> ImageFormat<span style="color: #000066; font-weight: bold;">.</span>JPG<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> 
mojePDF<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">save</span><span style="color: #000000;">&#40;</span>Method<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">REMOTE</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;create.php&quot;</span><span style="color: #000066; font-weight: bold;">,</span>Download<span style="color: #000066; font-weight: bold;">.</span>ATTACHMENT<span style="color: #000066; font-weight: bold;">,</span><span style="color: #990000;">&quot;mojePDF.pdf&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>Teď jsem pomocí jednoduchého kódu, udělal online verzi, kde uživateli po spuštění tohoto kódu vyběhne klasický download dialog, ve kterém se mu nabídne stažení pdf souboru jménem mojePDF.pdf, který bude obsahovat dvě stránky A4, které byli vytvořeny ze dvou movie clipů, na které odkazovaly proměnné pozadi1 a pozadi2.</p>
<p>Formátů je předvoleno několik klasických jako (A4, A3, LETTER a další), vy si ale můžete použít vlastní. Vypadá to potom asi takto.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> mmSirka = <span style="color: #000000; font-weight:bold;">90</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> mmVyska = <span style="color: #000000; font-weight:bold;">50</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> mujRozmer<span style="color: #000066; font-weight: bold;">:</span>Size = <span style="color: #0033ff; font-weight: bold;">new</span> Size <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#40;</span>mmSirka<span style="color: #000066; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">25.4</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">72</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000;">&#40;</span>mmVyska<span style="color: #000066; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">25.4</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">72</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;mujRozmer&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000;">&#91;</span>mmSirka<span style="color: #000066; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">25.4</span><span style="color: #000066; font-weight: bold;">,</span> mmVyska<span style="color: #000066; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">25.4</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000;">&#91;</span>mmSirka<span style="color: #000066; font-weight: bold;">,</span> mmVyska<span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> mojePDF <span style="color: #000066; font-weight: bold;">:</span> PDF = <span style="color: #0033ff; font-weight: bold;">new</span> PDF <span style="color: #000000;">&#40;</span> Orientation<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">PORTRAIT</span><span style="color: #000066; font-weight: bold;">,</span> Unit<span style="color: #000066; font-weight: bold;">.</span>MM<span style="color: #000066; font-weight: bold;">,</span>mujRozmer<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>V této ukázce jsem nastavil novému rozměru, parametry klasické vizitky(90x50mm). Pochopitelně nemusíme nastavovat rozměry celému PDF, ale i každé stránce zvlášť. </p>
<p>V ukázce o trochu níž jsem použil nízké dpi, díky tomu to vypadá trochu rozmazaně.<br />
Ukázka (text &#8222;Sem vyplňte údaje&#8220; lze přepsat):<br />
<object width="550" height="400" data="http://www.talos.cz/prilohy-flash/AlivePDF/alivePDF.swf" type="application/x-shockwave-flash"><param name="src" value="http://www.talos.cz/prilohy-flash/AlivePDF/alivePDF.swf" /></object></p>
<p>Ještě jak by měl vypadat soubor create.php zmiňovaný výše:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$method</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'method'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_RAW_POST_DATA&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// get bytearray</span>
	<span style="color: #000088;">$pdf</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_RAW_POST_DATA&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// add headers for download dialog-box</span>
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Type: application/pdf'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Length: '</span><span style="color: #339933;">.</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pdf</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-disposition:'</span><span style="color: #339933;">.</span><span style="color: #000088;">$method</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'; filename=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$pdf</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>  <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'An error occured.'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.talos.cz/2009/08/05/alive-pdf/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Předvolební spot ČSSD aneb může za to ODS</title>
		<link>http://www.talos.cz/2009/05/25/predvolebni-spot-cssd-aneb-muze-za-to-ods/</link>
		<comments>http://www.talos.cz/2009/05/25/predvolebni-spot-cssd-aneb-muze-za-to-ods/#comments</comments>
		<pubDate>Mon, 25 May 2009 18:52:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Politika]]></category>

		<guid isPermaLink="false">http://www.talos.cz/?p=257</guid>
		<description><![CDATA[Dneska jsem si udělal trochu času a shlédl jsem předvolební spoty jednotlivých stran. Pobavil jsem u strany Zelených a zažil jsem mírné překvapení nad tím, že komunistům se spot celkem podařil a občanští demokraté představili vcelku střídmí konzervativní spot, který neuráží. Oproti komunistům se výborně ukázala ČSSD. Něco tak urážlivého a neslušného bych snad nezvládl [...]]]></description>
			<content:encoded><![CDATA[<p>Dneska jsem si udělal trochu času a shlédl jsem předvolební spoty jednotlivých stran. Pobavil jsem u strany Zelených a zažil jsem mírné překvapení nad tím, že komunistům se spot celkem podařil a občanští demokraté představili vcelku střídmí konzervativní spot, který neuráží. Oproti komunistům se výborně ukázala ČSSD.<br />
<span id="more-257"></span><br />
Něco tak urážlivého a neslušného bych snad nezvládl zplodit ani já. Když jsem to poprvé viděl, nemohl jsem uvěřit vlastním očím, koukl jsem se na to podruhé a zjistil, že se mi to nezdálo. Doopravdy někdo má takovou odvahu, lépe řečeno drzost, aby něco takového vymyslel? Ono v celém spotu jsem se vlastně dozvěděl jedno volte nás, abyste nevolili ODS. Jinými slovy, teď chceme vládnout zase my, platy poslanců jsou totiž moc malé a jsme moc málo v televizi. A jen tak mimochodem my vás spasíme před tou zlou ekonomickou krizí, kterou zavinili ti zlý kapitalisté, kteří vás každý den vykořisťují v práci. To je informační hodnota spotu, jinými slovy házení špíny. </p>
<p>Vyloženě mě vytáčí všechny strany těmi negativistickými kampaněmi, ale lze vidět, že ti co to začali jsou v tom opravdu největší přeborníci. Po tomto snad ani člověk sociálně smýšlející je volit nemůže, kdybych byl já levicového zaměření tak raději ani nejdu k volbám, přeci jen občas musí vyhrávat etika nad politickým smýšlení. Nepopírám, že třeba kauza pana Topolánka a novináře co ho obtěžoval v ne zrovna nejlepším okamžiku, nebyla nejšťastnější, ale to bych chápal asi jen jako chvilkový zkrat. Pokud ale někdo něco předvádí dlouhodobě jako třeba pan Paroubek, tak je chyba někde jinde.</p>
<p>Ještě malá ukázka toho jak by předvolební kampaň podle mě vypadat <strong>neměla</strong>.<br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/xZbJB2Hcf-w&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/xZbJB2Hcf-w&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.talos.cz/2009/05/25/predvolebni-spot-cssd-aneb-muze-za-to-ods/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HTC Raphael (Touch Pro)</title>
		<link>http://www.talos.cz/2009/05/17/htc-raphael-touch-pro/</link>
		<comments>http://www.talos.cz/2009/05/17/htc-raphael-touch-pro/#comments</comments>
		<pubDate>Sun, 17 May 2009 11:41:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows mobile]]></category>

		<guid isPermaLink="false">http://www.talos.cz/?p=216</guid>
		<description><![CDATA[Nedávno jsem si pořídil nový telefon po dosluhující nokii N73, která ikdyž nebyla špatná, tak ke koupi mě rozhoupaly její hlavní nedostatky a to chybějící podpora pro standard SDHC (paměťové karty pouze do 2gB), chybějící wi-fi a málo otevřený systém symbian 9 (se slzou v oku vzpomínám na starší verze). Můj nový telefon HTC Raphael [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.talos.cz/wp-content/uploads/2009/05/img_1909.jpg"><img class="alignnone size-full wp-image-246" title="HTC Raphael" src="http://www.talos.cz/wp-content/uploads/2009/05/img_1909.jpg" alt="HTC Raphael" width="307" height="249" align="right" /></a>Nedávno jsem si pořídil nový telefon po dosluhující nokii N73, která ikdyž nebyla špatná, tak ke koupi mě rozhoupaly její hlavní nedostatky a to chybějící podpora pro standard SDHC (paměťové karty pouze do 2gB), chybějící wi-fi a málo otevřený systém symbian 9 (se slzou v oku vzpomínám na starší verze).<br />
<span id="more-216"></span><br />
Můj nový telefon HTC Raphael má místo Symbianu, Windows mobile, není to ale moje první zkušenost s WM, už několik let vlastním PDA ASUS A636, které tímto také odchází do věčných lovišť mého šuplíku spolu s nokií N73. ASUS A636 používal ještě starou verzi windows mobilu a to 5.0. Raphael běží na verzi 6.1, u které nepozoruje žádné zásadní vylepšení možná mírná vylepšení co se týká ovládání prsty, ale to nevim na kolik za to může TouchFlo 3D od HTC, které je v telefonu nainstalováno. Můj první krok potom co mi přišel můj nový telefon bylo najít tu správnou romku. Po dlouhém rozmýšlení jsem nakonec zvolil romku zase s wm 6.1, ale tentokrát neoficiální s názvem Titan, na kterou si rozhodně nemůžu stěžovat je rychlá a stabilní.</p>
<p><a href="http://www.ce4you.cz/forums/view_topic.asp?t=32928">odkaz na Titan rom</a></p>
<p>Tato rom je vyvedena ve dvou verzích a to s novým TouchFlo 3D, které je určeno pro Touch Pro 2 a se starým. Nejdřív mi to nebylo jasné proč, ale potom co jsem si ji flashnul, tak už jsem věděl, sice novější TouchFlo má několik nových vychytávek, ze všech bych vyzdvihnul možnost práce s landscape, ale je doopravdy určené pro Touch Pro 2, který má širší displej, takže tam prostě občas kousek chybí. Mě to nakonec ani nevadilo, protože to jen potvrdilo moje dřívější rozhodnutí TouchFlo 3D vypnout. Ono TouchFlo je sice pěkné, ale mě přišlo vcelku nepraktické a na jedné obrazovce zobrazuje přílíš málo informací, nechápu co je to za módu dělat hodiny přes půl displeje.</p>
<p>Moje nové prostředí pro home screen tady zaujal shell od firmy Spb (Spb Mobile Shell) ve verzi 3.0, které je podle mě výrazně lepší hlavně v možnostech customizace. Mimojiné rozhodlo i velmi dobře navržené vyhledávání kontaktů. Jediné co nechápu na tomto prostředí je zbytečné využití carousel efektu pro přejíždění mezi obrazovkami, přijde mi to jako nepraktické mrhání výkonem, naštěstí ho má Raphael dost a dost.</p>
<p>Internet explorer zase nezklamal a je stejně tragický jako už od jeho prvních mobile verzích naštěstí si to HTC uvědomilo a dodává stejně jako autor Titan romky předinstalovanou Operu, která je doopravdy výborná. Jediná škoda, že naši operátoři jsou pořád sto let za opicemi, takže pomalý internet ji celkem degraduje. Naštěstí už autoři Opery připravují v další verzi mód Opera TURBO, který by měl fungovat na stejným principu jako velmi povedená Opera mini. Což by mělo načítání stránek zrychlit.</p>
<div id="attachment_223" class="wp-caption alignnone" style="width: 298px"><a href="http://www.talos.cz/wp-content/uploads/2009/05/screen03.jpg"><img class="size-full wp-image-223" title="Spb Mobile Shell" src="http://www.talos.cz/wp-content/uploads/2009/05/screen03.jpg" alt="Spb Mobile Shell" width="288" height="384" /></a><p class="wp-caption-text">Můj homescreen</p></div>
<div id="attachment_234" class="wp-caption alignnone" style="width: 298px"><a href="http://www.talos.cz/wp-content/uploads/2009/05/screen04.jpg"><img class="size-full wp-image-234" title="Opera Mobile" src="http://www.talos.cz/wp-content/uploads/2009/05/screen04.jpg" alt="Opera Mobile" width="288" height="384" align="right" /></a><p class="wp-caption-text">Opera Mobile</p></div>
<p>U standardně předinstalovaných her mě zaujala nová hra Teeter, princip hry je jednoduchý pomocí naklánění telefonu dostaňte kuličku do zelené díry a vyhněte se všem černým dírám. Hra využívá pohybové čidlo a osobně mě překvapilo jak velmi citlivé je. Pro pohybové čidlo, existují ještě další hry například Need for speed:UnderCroft nebo Resco Bubbles. Pohybové čidlo využívají i různé aplikace například již výše zmiňovaná Opera nebo prohlížeč obrázků. Her je u Windows mobile docela slušný výběr nemůžu nezmínit mé nejoblíbenější jako je Age of Empires a Worm:World Party.</p>
<div id="attachment_241" class="wp-caption alignnone" style="width: 394px"><a href="http://www.talos.cz/wp-content/uploads/2009/05/screen01.jpg"><img class="size-full wp-image-241" title="Teeter" src="http://www.talos.cz/wp-content/uploads/2009/05/screen01.jpg" alt="Teeter" width="384" height="288" /></a><p class="wp-caption-text">Teeter</p></div>
<div id="attachment_242" class="wp-caption alignnone" style="width: 394px"><a href="http://www.talos.cz/wp-content/uploads/2009/05/screen09.jpg"><img class="size-full wp-image-242" title="Age of Empires" src="http://www.talos.cz/wp-content/uploads/2009/05/screen09.jpg" alt="Age of Empires" width="384" height="288" /></a><p class="wp-caption-text">Age of Empires</p></div>
<p>Největší klad Windows mobile je ve velkém množství aplikací. Například mám jako druhý notebook Acer aspire one, který bohužel nemá bluetooth, ale pouze wi-fi, takže se v terénu nemůžu s ním připojit na internet přes mobil, naštěstí existuje aplikace WMWifiRouter. Která dokáže zprostředkovat skrz Raphaela jakékoliv připojení do pc. Nebo mě například moc neuspokojoval standardní budík, co je nainstalován v základu, tak jsem si pořídil nadstavbu Spb Time, který mimojiné výborně spolupracuje s aplikací Spb Mobile Shell. Dále už v základu nabízí HTC jednoduchou aplikaci pro prohlížení videí na Youtube a Microsoft nedávno uvolnil aplikaci pro správu profilu na Facebooku.</p>
<div id="attachment_243" class="wp-caption alignnone" style="width: 298px"><a href="http://www.talos.cz/wp-content/uploads/2009/05/screen05.jpg"><img class="size-full wp-image-243" title="WMWifiRouter" src="http://www.talos.cz/wp-content/uploads/2009/05/screen05.jpg" alt="WMWifiRouter" width="288" height="384" /></a><p class="wp-caption-text">WMWifiRouter</p></div>
<div id="attachment_244" class="wp-caption alignnone" style="width: 298px"><a href="http://www.talos.cz/wp-content/uploads/2009/05/screen06.jpg"><img class="size-full wp-image-244" title="Spb Time" src="http://www.talos.cz/wp-content/uploads/2009/05/screen06.jpg" alt="Spb Time" width="288" height="384" /></a><p class="wp-caption-text">Spb Time</p></div>
<div id="attachment_245" class="wp-caption alignnone" style="width: 298px"><a href="http://www.talos.cz/wp-content/uploads/2009/05/screen07.jpg"><img class="size-full wp-image-245" title="YouTube" src="http://www.talos.cz/wp-content/uploads/2009/05/screen07.jpg" alt="YouTube" width="288" height="384" /></a><p class="wp-caption-text">YouTube</p></div>
<p>Na zařízení jen těžko hledám zápory snad jen velké rozměry, za což může hardwarové klávesnice, ale jak nám ukázala Nokia na svém modelu E75, tak i mobil s hardwarovou klávesnicí může být kompaktní. Dále pak nevýhoda všech moderních telefonů a to je slabá výdrž baterie, která při náročném používání vydrží sotva den. A při normálním používání, volání, sms, e-maily a občas internet přes GPRS, sem tam nějaká hra až tři dny. Při minimálním používání pouze volání a sms, a to ještě velmi občasné, a jas displej na minimum až šest dnů. Potom by mohlo HTC u tak vysokého modelu mít bohatší v příslušenství osobně mi chybí TV-out kabel a pořádné pouzdro. A poslední nevýhody byl jsem zvyklý z nokie N73 na trochu lepší foťák a vyšší kvalitu repráků.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talos.cz/2009/05/17/htc-raphael-touch-pro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Průhlednost textového pole bez vložení fontu</title>
		<link>http://www.talos.cz/2009/04/19/pruhlednost-textoveho-pole-bez-vlozeni-fontu/</link>
		<comments>http://www.talos.cz/2009/04/19/pruhlednost-textoveho-pole-bez-vlozeni-fontu/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 19:01:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.talos.cz/?p=208</guid>
		<description><![CDATA[Ve flash playeru 9, v actionscriptu 3 nastává problém pokud chcete nastavovat průhlednost textového pole. Těžko říct proč už se tento problém netýká flash playeru 10. Ale řešení pro devítku funguje korektně i v desítce. Řešení je vcelku prosté pomocí spravného nastavení vlastnosti blendMode u textového pole. Průhlednost nám umožní když nastavíme blendMode na hodnotu [...]]]></description>
			<content:encoded><![CDATA[<p>Ve flash playeru 9, v actionscriptu 3 nastává problém pokud chcete nastavovat průhlednost textového pole. Těžko říct proč už se tento problém netýká flash playeru 10. Ale řešení pro devítku funguje korektně i v desítce.<br />
<span id="more-208"></span><br />
Řešení je vcelku prosté pomocí spravného nastavení vlastnosti blendMode u textového pole. Průhlednost nám umožní když nastavíme blendMode na hodnotu BlendMode.LAYER.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900; font-style: italic;">//vytvoříme si nejdříve objekt pro naformátování textu</span>
<span style="color: #6699cc; font-weight: bold;">var</span> txtFormat<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">TextFormat</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">TextFormat</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
txtFormat<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">font</span> = <span style="color: #990000;">&quot;Arial&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
txtFormat<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">size</span> = <span style="color: #000000; font-weight:bold;">25</span><span style="color: #000066; font-weight: bold;">;</span>
txtFormat<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">align</span> = <span style="color: #004993;">TextFormatAlign</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CENTER</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">//potom vytvoříme samotné textové pole</span>
<span style="color: #6699cc; font-weight: bold;">var</span> txt<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">TextField</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">TextField</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #009900; font-style: italic;">//nastavíme danou vlastnost</span>
txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">blendMode</span>=<span style="color: #004993;">BlendMode</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">LAYER</span><span style="color: #000066; font-weight: bold;">;</span>
txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Zkušební text&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setTextFormat</span><span style="color: #000000;">&#40;</span>txtFormat<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span> = <span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">;</span>
txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> = <span style="color: #000000; font-weight:bold;">35</span><span style="color: #000066; font-weight: bold;">;</span>
txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">50</span><span style="color: #000066; font-weight: bold;">;</span>
txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">50</span>
&nbsp;
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>txt<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> changeAlpha<span style="color: #000000;">&#40;</span>evt<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	Tweener<span style="color: #000066; font-weight: bold;">.</span>addTween<span style="color: #000000;">&#40;</span>txt<span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000;">&#123;</span><span style="color: #004993;">alpha</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">time</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">,</span> transition<span style="color: #000066; font-weight: bold;">:</span><span style="color: #990000;">&quot;easeOutBounce&quot;</span><span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	Tweener<span style="color: #000066; font-weight: bold;">.</span>addTween<span style="color: #000000;">&#40;</span>txt<span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000;">&#123;</span><span style="color: #004993;">alpha</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">time</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">,</span> transition<span style="color: #000066; font-weight: bold;">:</span><span style="color: #990000;">&quot;easeOutBounce&quot;</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #004993;">delay</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #009900; font-style: italic;">//nastavíme listener pro spuštění animace s průhledností</span>
alphar<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span>changeAlpha<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>Skript počítá s tím že na ploše máme umístění movie clip či button s názvem alphar, na který když klikneme, tak se spustí animace.</p>
<p>Ukázka<br />
<object width="550" height="400" data="http://www.talos.cz/prilohy-flash/alphaTextField/textFields.swf" type="application/x-shockwave-flash"><param name="src" value="http://www.talos.cz/prilohy-flash/alphaTextField/textFields.swf" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.talos.cz/2009/04/19/pruhlednost-textoveho-pole-bez-vlozeni-fontu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tweener color</title>
		<link>http://www.talos.cz/2009/03/21/tweener-color/</link>
		<comments>http://www.talos.cz/2009/03/21/tweener-color/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 09:45:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[actionscript 3.0]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[color tweener]]></category>
		<category><![CDATA[tweener]]></category>

		<guid isPermaLink="false">http://www.talos.cz/?p=195</guid>
		<description><![CDATA[Třída tweener je rozhodně jedna z nejpoužívanějších, její základní vlastnosti popisovat nebudu. Ta je popsána pěkně třeba tady http://www.flash.cz/portal/clanek.aspx?id=1326 . Já se zaměřím na jednu část a to je přechod barev. Je to vcelku snadné, jediné co budeme potřebovat je třída tweener. Ke stažení pro AS3 zde http://tweener.googlecode.com/files/tweener_1_31_74_as3.zip . Teď už k samotnému scriptu. Tweener [...]]]></description>
			<content:encoded><![CDATA[<p>Třída tweener je rozhodně jedna z nejpoužívanějších, její základní vlastnosti popisovat nebudu. Ta je popsána pěkně třeba tady <a href="http://www.flash.cz/portal/clanek.aspx?id=1326" target="_blank">http://www.flash.cz/portal/clanek.aspx?id=1326</a> . Já se zaměřím na jednu část a to je přechod barev.<br />
<span id="more-195"></span><br />
Je to vcelku snadné, jediné co budeme potřebovat je třída tweener. Ke stažení pro AS3 zde <a href="http://tweener.googlecode.com/files/tweener_1_31_74_as3.zip" target="_blank">http://tweener.googlecode.com/files/tweener_1_31_74_as3.zip</a> . Teď už k samotnému scriptu. Tweener používá k přechodům speciální vlastnost colorshortcut. Která se musí na začátku inicializovat, pro správnou funkčnost.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900; font-style: italic;">//import tweeneru</span>
<span style="color: #0033ff; font-weight: bold;">import</span> caurina<span style="color: #000066; font-weight: bold;">.</span>transitions<span style="color: #000066; font-weight: bold;">.*;</span>
<span style="color: #009900; font-style: italic;">//import vlastnosti colorShotcut</span>
<span style="color: #0033ff; font-weight: bold;">import</span> caurina<span style="color: #000066; font-weight: bold;">.</span>transitions<span style="color: #000066; font-weight: bold;">.</span>properties<span style="color: #000066; font-weight: bold;">.</span>ColorShortcuts<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #009900; font-style: italic;">//inicializace colorShortcut</span>
ColorShortcuts<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">//vytvoření ukázkového movie clipu v černé barvě</span>
<span style="color: #6699cc; font-weight: bold;">var</span> ukazka<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
ukazka<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0x000000<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
ukazka<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">70</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">50</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">400</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">300</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>ukazka<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> 
&nbsp;
<span style="color: #009900; font-style: italic;">//vytvoření listenerů pro detekci najetí myší na movie clip</span>
ukazka<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OVER</span><span style="color: #000066; font-weight: bold;">,</span> prechodNaZelenou<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
ukazka<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_OUT</span><span style="color: #000066; font-weight: bold;">,</span> prechodZpet<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">//myš je na movie clipu barva se změní na zelenou</span>
<span style="color: #339966; font-weight: bold;">function</span> prechodNaZelenou<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
  Tweener<span style="color: #000066; font-weight: bold;">.</span>addTween<span style="color: #000000;">&#40;</span>ukazka<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000;">&#123;</span>_color<span style="color: #000066; font-weight: bold;">:</span>0x00ff00<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">time</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> transition<span style="color: #000066; font-weight: bold;">:</span><span style="color: #990000;">&quot;easeOutSine&quot;</span><span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #009900; font-style: italic;">//myš je pryč barva se změní zpět</span>
<span style="color: #339966; font-weight: bold;">function</span> prechodZpet<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
  Tweener<span style="color: #000066; font-weight: bold;">.</span>addTween<span style="color: #000000;">&#40;</span>ukazka<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000;">&#123;</span>_color<span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">time</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> transition<span style="color: #000066; font-weight: bold;">:</span><span style="color: #990000;">&quot;easeOutSine&quot;</span><span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Ještě ukázka toho jak to vypadá<br />
<object width="550" height="400" data="http://www.talos.cz/prilohy-flash/colorShortcut/colorShortcut.swf" type="application/x-shockwave-flash"><param name="src" value="http://www.talos.cz/prilohy-flash/colorShortcut/colorShortcut.swf" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.talos.cz/2009/03/21/tweener-color/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Převod řetězce na třídu</title>
		<link>http://www.talos.cz/2009/01/22/prevod-retezce-na-tridu/</link>
		<comments>http://www.talos.cz/2009/01/22/prevod-retezce-na-tridu/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 17:59:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[řetězec]]></category>
		<category><![CDATA[string to class]]></category>
		<category><![CDATA[třída]]></category>

		<guid isPermaLink="false">http://www.talos.cz/?p=189</guid>
		<description><![CDATA[V actionscriptu 3, když máte v knihovně hodně movie clipů, máte jméno třídy těchto objektů pouze v řetězcové podobě, je trochu problém je vložit na scénu. V actionscriptu 2 to nebyl problém, ale vzhledem k tomu, že actionscript 3 trochu pokročil na své cestě k dokonalejšímu jazyku k čemuž patří i přísnější pravidla, které nám [...]]]></description>
			<content:encoded><![CDATA[<p>V actionscriptu 3, když máte v knihovně hodně movie clipů, máte jméno třídy těchto objektů pouze v řetězcové podobě, je trochu problém je vložit na scénu. V actionscriptu 2 to nebyl problém, ale vzhledem k tomu, že actionscript 3 trochu pokročil na své cestě k dokonalejšímu jazyku k čemuž patří i přísnější pravidla, které nám sice občas ztrpčují život, ale v konečném důsledku je to tak lepší.<br />
<span id="more-189"></span><br />
Tak tedy v actionscriptu 2 by jsme pro vložení objektu z knihovny, použili něco takového.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="actionscript2" style="font-family:monospace;">attachMovie(&quot;mc&quot;+i,&quot;mc&quot;,this.getNextHighestDepths);</pre></td></tr></table></div>

<p>v actionscriptu 3 pro stejný výsledek musíme použít</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> trida<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Class</span> = <span style="color: #004993;">getDefinitionByName</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;mc&quot;</span><span style="color: #000066; font-weight: bold;">+</span>i<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">Class</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> mc<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = <span style="color: #0033ff; font-weight: bold;">new</span> trida<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>mc<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.talos.cz/2009/01/22/prevod-retezce-na-tridu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Třída MyLoader a Progr</title>
		<link>http://www.talos.cz/2009/01/03/trida-myloader-a-progr/</link>
		<comments>http://www.talos.cz/2009/01/03/trida-myloader-a-progr/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 22:54:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[actionscript 3.0]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[MyLoader]]></category>
		<category><![CDATA[ProgressEvent]]></category>
		<category><![CDATA[ProgressEvent.Progress]]></category>

		<guid isPermaLink="false">http://www.talos.cz/?p=178</guid>
		<description><![CDATA[Dnes jsem potřeboval v actionscriptu 3 při načítání obrázků, zjistit jeho rodiče. Což v události ProgressEvent.PROGRESS není povoleno. Tak jsem si vytvořil vlastní třídy jejíž pomocí jsem toho bez problémů dosáhl. Takže nejdřív jsem si vytvořil třídu z názvem Progr. Která vytváří dvě nové vlastní události. A to Progr.prubeh a Progr.konec.Oběma těmto událostem jsem umístil [...]]]></description>
			<content:encoded><![CDATA[<p>Dnes jsem potřeboval v actionscriptu 3 při načítání obrázků, zjistit jeho rodiče. Což v události ProgressEvent.PROGRESS není povoleno. Tak jsem si vytvořil vlastní třídy jejíž pomocí jsem toho bez problémů dosáhl.<br />
<span id="more-178"></span><br />
Takže nejdřív jsem si vytvořil třídu z názvem Progr. Která vytváří dvě nové vlastní události. A to Progr.prubeh a Progr.konec.Oběma těmto událostem jsem umístil tři parametry jeden typu movie clip a dva typu number. Ty dva typu number mám v plánu využít jako ukazatele načtených a celkových dat. A movie clip bude definován uživatelem třídy.</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
16
17
18
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MovieClip</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Progr <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Event</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> static const prubeh<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;prubeh&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> static const konec<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;konec&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> mc<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> loaded<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> total<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Progr<span style="color: #000000;">&#40;</span><span style="color: #004993;">type</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">,</span> _mc<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span><span style="color: #000066; font-weight: bold;">,</span> _loaded<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000066; font-weight: bold;">,</span> _total<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">type</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>mc = _mc<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>loaded = _loaded<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>total = _total<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>		
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Jak je známo, když chci načíst nějaký externí obrázek či movie clip v actionscriptu 3, musím použít objekt Loader. Tak jsem se si vytvořil jednoduchou třídu, která objekt Loader rozšiřuje a využívá předchozí třídu, tak jak jsem popisoval výše.Třída se jmenuje MyLoader.</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
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.*;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">URLRequest</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.*;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> progr<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MyLoader <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">Loader</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #6699cc; font-weight: bold;">var</span> mc<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> MyLoader<span style="color: #000000;">&#40;</span>_mc<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>mc = _mc<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> loadRequest<span style="color: #000000;">&#40;</span><span style="color: #004993;">url</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> urlReq<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">URLRequest</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">url</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span>urlReq<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			handleEvents<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">contentLoaderInfo</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleEvents<span style="color: #000000;">&#40;</span><span style="color: #004993;">d</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">IEventDispatcher</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">d</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">COMPLETE</span><span style="color: #000066; font-weight: bold;">,</span> completeHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #004993;">d</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">ProgressEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">PROGRESS</span><span style="color: #000066; font-weight: bold;">,</span> progressHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> completeHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> progr<span style="color: #000000;">&#40;</span>Progr<span style="color: #000066; font-weight: bold;">.</span>konec<span style="color: #000066; font-weight: bold;">,</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>mc<span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> progressHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">ProgressEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> progr<span style="color: #000000;">&#40;</span>Progr<span style="color: #000066; font-weight: bold;">.</span>prubeh<span style="color: #000066; font-weight: bold;">,</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>mc<span style="color: #000066; font-weight: bold;">,</span> event<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">bytesLoaded</span><span style="color: #000066; font-weight: bold;">,</span> event<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">bytesTotal</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Ještě jednoduchý příklad využití těchto tříd.</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
16
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">import</span> MyLoader<span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> adresa<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;obrazek.jpg&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> novyMc<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">loader</span><span style="color: #000066; font-weight: bold;">:</span>MyLoader = <span style="color: #0033ff; font-weight: bold;">new</span> MyLoader<span style="color: #000000;">&#40;</span>novyMc<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">loader</span><span style="color: #000066; font-weight: bold;">.</span>loadRequest<span style="color: #000000;">&#40;</span>adresa<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> obrazekNacitani<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>Progr<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> mc<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = <span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">.</span>mc <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Movie clip &quot;</span><span style="color: #000066; font-weight: bold;">+</span>mc<span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot; je načten z &quot;</span><span style="color: #000066; font-weight: bold;">+</span>event<span style="color: #000066; font-weight: bold;">.</span>loaded<span style="color: #000066; font-weight: bold;">/</span>event<span style="color: #000066; font-weight: bold;">.</span>total<span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;%&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #339966; font-weight: bold;">function</span> obrazekKonec<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>Progr<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> mc<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = <span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">.</span>mc <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Movie clip &quot;</span><span style="color: #000066; font-weight: bold;">+</span>mc<span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot; je načten&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #004993;">loader</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>Progr<span style="color: #000066; font-weight: bold;">.</span>prubeh<span style="color: #000066; font-weight: bold;">,</span>obrazekNacitani<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">loader</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>Progr<span style="color: #000066; font-weight: bold;">.</span>konec<span style="color: #000066; font-weight: bold;">,</span>obrazekKonec<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

<p>Toto lze zejména využít, když načítáte více obrázků najednou a v každém máte umístěný vlastní preloader. Tento příklad je zaměřený na přidání konkrétního parametru do konkrétní události, ale pochopitelně se dá využít na jakoukoliv jinou událost a jakýkoliv jiný parametr.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talos.cz/2009/01/03/trida-myloader-a-progr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

