<?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>Jurnal Tripmedia &#187; Programare</title>
	<atom:link href="http://jurnal.tripmedia.ro/category/programare/feed" rel="self" type="application/rss+xml" />
	<link>http://jurnal.tripmedia.ro</link>
	<description>Jurnal Tripmedia</description>
	<lastBuildDate>Sat, 24 Jul 2010 06:56:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Create a PDF file with Adobe AIR</title>
		<link>http://jurnal.tripmedia.ro/create-a-pdf-file-with-adobe-air/2382.html</link>
		<comments>http://jurnal.tripmedia.ro/create-a-pdf-file-with-adobe-air/2382.html#comments</comments>
		<pubDate>Tue, 09 Feb 2010 11:25:53 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programare]]></category>

		<guid isPermaLink="false">http://jurnal.tripmedia.ro/?p=2382</guid>
		<description><![CDATA[In this tutorial we will learn to create a pdf file with Adobe AIR and the help of an external library called AlivePDF. To get things started go to the AlivePDF download page and get the latest version of the API (in this tutorial I use the AlivePDF 0.1.5 RC version) and we can start [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-2394" title="Adobe AIR PDF Tutorial" src="http://jurnal.tripmedia.ro/wp-content/uploads/2010/02/left_pic2.jpg" alt="" width="231" height="295" />In this tutorial we will learn to create a pdf file with Adobe AIR and the help of an external library called AlivePDF. To get things started go to the AlivePDF <a href="http://code.google.com/p/alivepdf/downloads/list" target="_blank">download page </a>and get the latest version of the API (in this tutorial I use the AlivePDF 0.1.5 RC version) and we can start coding our pdf creator app.<span id="more-2382"></span>Create a new Flash File(Adobe AIR) , add an input TextField with an instance name of &#8220;txt&#8221; and create a new button with an instance name of &#8220;but&#8221;; or download the starter files <a href="http://jurnal.tripmedia.ro/wp-content/uploads/2010/02/start.rar" target="_blank">here</a>. Import the classes needed for this example:</p>
<p><code>import org.alivepdf.pdf.PDF;<br />
import org.alivepdf.layout.Size;<br />
import org.alivepdf.saving.Method;<br />
import org.alivepdf.layout.Unit;<br />
import org.alivepdf.layout.Orientation;</code></p>
<p>Now we can start creating our pdf file:</p>
<p><code>var doc:PDF=new PDF(Orientation.PORTRAIT,Unit.MM,Size.A4);</code></p>
<p><span style="color: #800000;">//you can have the orientation either in PORTRAIT or in LANDSCAPE mode<br />
//the unit can be: MM,POINT,CM,INCHES<br />
//Size defines the size of the document page witch can be: //A3,A4,A5,LETTER, LEGAL,TABLOID</span></p>
<p>To add a new page to the pdf file you simply call the addPage method:</p>
<p><code>doc.addPage();</code></p>
<p>Now let&#8217;s create the file and filestream, so we can save the pdf:</p>
<p><code>var stream:FileStream=new FileStream();<br />
var file:File=File.desktopDirectory.resolvePath("mydoc.pdf");<br />
stream.open(file,FileMode.WRITE);</code></p>
<p>The pdf file will be saved on the user&#8217;s desktop as we defined the path. Now it&#8217;s time for the function that creates and saves the file:</p>
<p><code>but.addEventListener(MouseEvent.CLICK,save);</code></p>
<p><code>function save(e:MouseEvent):void{<br />
doc.addText(txt.text,5,10);</code><span style="color: #800000;">//add the text from text input field and position it at the x:5 and y:10</span><br />
<code>var byte:ByteArray=doc.save(Method.LOCAL);</code><span style="color: #800000;"> //if you are publishing for a web application you should set the Method.REMOTE</span><br />
<code>stream.writeBytes(byte);<br />
stream.close();<br />
}</code></p>
<p>If we run our project we should have a little pdf creating app.You can download the finished source files <a href="http://jurnal.tripmedia.ro/wp-content/uploads/2010/02/finish.rar" target="_blank">here</a>. The AlivePDF library has a lot of options like: adding an image to the file using the addImage(displayObject) method, or setting the font style, hyperlinks and much more. If you want to learn more about AlivePDF you can visit the official <a href="http://www.alivepdf.org/" target="_blank">site</a> , or the tutorials page <a href="http://www.alivepdf.org/?page_id=5" target="_blank">here </a>(tough some of the tutorials were written on an earlier version of the library and may not work with the current version).</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjurnal.tripmedia.ro%2Fcreate-a-pdf-file-with-adobe-air%2F2382.html&amp;title=Create%20a%20PDF%20file%20with%20Adobe%20AIR" id="wpa2a_2">Articol favorit</a></p>]]></content:encoded>
			<wfw:commentRss>http://jurnal.tripmedia.ro/create-a-pdf-file-with-adobe-air/2382.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe-Mobile-Packager pe TripMobil</title>
		<link>http://jurnal.tripmedia.ro/adobe-mobile-packager/2249.html</link>
		<comments>http://jurnal.tripmedia.ro/adobe-mobile-packager/2249.html#comments</comments>
		<pubDate>Wed, 22 Jul 2009 11:08:07 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programare]]></category>

		<guid isPermaLink="false">http://jurnal.tripmedia.ro/?p=2249</guid>
		<description><![CDATA[De curand am descoperit ca prietenii nostri de la Adobe ne dau voie sa facem aplicatii pentru terminalele mobile prin intermediul noii lor aplicatii Adobe Mobile Packager care ne permita sa publicam ceea ce ne trece noua prin cap si sub forma de aplicatii pentru terminalele mobile. Urmand cursul firesc al evenimentelor si neputand sa [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-2256" title="Adobe Mobile Packager" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/07/left_pic3.jpg" alt="Adobe Mobile Packager" width="231" height="295" />De curand am descoperit ca prietenii nostri de la Adobe ne dau voie sa facem aplicatii pentru terminalele mobile prin intermediul noii lor aplicatii Adobe Mobile Packager care ne permita sa publicam ceea ce ne trece noua prin cap si sub forma de aplicatii pentru terminalele mobile. Urmand cursul firesc al evenimentelor si neputand sa ne stapanim curiozitatea am inceput sa testam capabilitatile noii aplicatii. <span id="more-2249"></span></p>
<p><img class="aligncenter size-full wp-image-2262" title="In game" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/07/print.jpg" alt="In game" width="477" height="509" /></p>
<p>Si ce tip de aplicatie era mai potrivita pentru asa ceva decat un joc (cu muste dupa ideea lui Ciprica si Maximilian)? Ce a iesit puteti vedea descarcand aplicatia de <a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/07/bugs.rar" target="_blank">aici</a> pentru Windows Mobile (jocul este gandit pentru telefoanele cu touchscreen). Pentru a putea folosi Adobe Mobile Packager trebuie sa descarcati aplicatia de <a href="http://labs.adobe.com/technologies/distributableplayer/" target="_blank">aici</a>, o instalati apoi urmati pasii din tutorialele video de <a href="http://www.youtube.com/watch?v=ay9AjobZ_Jg&amp;feature=PlayList&amp;p=20BE62FD7F1E1A12&amp;index=0" target="_blank">aici</a>. Iar pentru a putea rula aplicatiile pe telefonul mobil va trebui sa descarcati o noua versiune de Flash Lite Player de <a href="http://labs.adobe.com/technologies/distributableplayer/" target="_blank">aici</a>. Momentan aplicatiile merg pe un numar restrans de telefoane mobile ce se gasesc in lista de <a href="http://labs.adobe.com/wiki/index.php/Distributable_Player:Supported_Devices" target="_blank">aici</a>. Trebuie sa recunoastem ca ne-am fi dorit o data cu lansarea acestei aplicatii sa avem mai mult control asupra terminalului mobil, dar poate vor veni in timp. Puteti descarca si sursa jocului de <a href="http:///jurnal.tripmedia.ro/wp-content/uploads/2009/07/sursa.rar">aici</a> pentru a vedea cum a fost creat.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjurnal.tripmedia.ro%2Fadobe-mobile-packager%2F2249.html&amp;title=Adobe-Mobile-Packager%20pe%20TripMobil" id="wpa2a_4">Articol favorit</a></p>]]></content:encoded>
			<wfw:commentRss>http://jurnal.tripmedia.ro/adobe-mobile-packager/2249.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Last FM widget for wordpress</title>
		<link>http://jurnal.tripmedia.ro/last-fm-widget-for-wordpress/2163.html</link>
		<comments>http://jurnal.tripmedia.ro/last-fm-widget-for-wordpress/2163.html#comments</comments>
		<pubDate>Mon, 13 Jul 2009 16:10:44 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Programare]]></category>

		<guid isPermaLink="false">http://jurnal.tripmedia.ro/?p=2163</guid>
		<description><![CDATA[Last FM creates atmosphere in our office, so we breathe music legal and paid. We&#8217;ve developed a widget and now you could listen the music we are listening to. It is our pleasure to offer you this widget for download. It is designed to show our account by default, but if you want to display [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-2171" title="lastfm_widget" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/07/lastfm_widget.gif" alt="lastfm_widget" width="231" height="295" />Last FM creates atmosphere in our office, so we breathe music legal and paid. We&#8217;ve developed a widget and now you could listen the music we are listening to.</p>
<p>It is our pleasure to offer you this widget for download. It is designed to show our account by default, but if you want to display your recent tracks, you should go to <a title="lastFM" href="http://www.last.fm/widgets" target="_blank">lastFM</a> widgets, customize your code and fill in the required textarea in the plugin backend zone. Unfortunately, the widget displays Usher from time to time. It&#8217;s the inevitable software error, please ignore it. Press the red plus sign below to get the download link.</p>
<p><span id="more-2163"></span></p>
<p>Post here any related questions.</p>
<p>Oh, I almost forgot, the download <a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/07/lastfm-tripmedia.zip">link</a>.</p>
<p>Have fun!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjurnal.tripmedia.ro%2Flast-fm-widget-for-wordpress%2F2163.html&amp;title=Last%20FM%20widget%20for%20wordpress" id="wpa2a_6">Articol favorit</a></p>]]></content:encoded>
			<wfw:commentRss>http://jurnal.tripmedia.ro/last-fm-widget-for-wordpress/2163.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Papervision 3D Loading Collada Files</title>
		<link>http://jurnal.tripmedia.ro/papervision-3d-loading-collada-files/2096.html</link>
		<comments>http://jurnal.tripmedia.ro/papervision-3d-loading-collada-files/2096.html#comments</comments>
		<pubDate>Mon, 08 Jun 2009 12:54:31 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programare]]></category>
		<category><![CDATA[papervision3d]]></category>

		<guid isPermaLink="false">http://jurnal.tripmedia.ro/?p=2096</guid>
		<description><![CDATA[In this new tutorial I will show you the basics of importing a 3d model into papervision 3D. For this tutorial you need Adobe Flash , the papervision 3d library ( you can download it here ), and a 3d Modeling application (like Google Sketchup or 3DS Max) that exports the model in Collada format [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/06/left_picy.jpg"><img class="aligncenter size-full wp-image-2101" title="Papervision 3d tutorial" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/06/left_picy.jpg" alt="Papervision 3d tutorial" width="231" height="295" /></a>In this new tutorial I will show you the basics of importing a 3d model into papervision 3D. For this tutorial you need Adobe Flash , the papervision 3d library ( you can download it <a href="http://code.google.com/p/papervision3d/" target="_blank">here</a> ), and a 3d Modeling application (like Google Sketchup or 3DS Max) that exports the model in Collada format ( with the .dae extension).</p>
<p><span id="more-2096"></span> First you need to create you 3d model (for this tutorial I build a model that resembles a tank) or download a model from <a href="http://sketchup.google.com/3dwarehouse/" target="_blank">google 3D warehouse</a>. You can get the starter files here.</p>
<p>To get things started we create a new flash file and start importing all the papervision classes that we need:</p>
<p><code><br />
import org.papervision3d.scenes.Scene3D;<br />
import org.papervision3d.view.Viewport3D;<br />
import org.papervision3d.render.BasicRenderEngine;<br />
import org.papervision3d.objects.DisplayObject3D;<br />
import org.papervision3d.objects.parsers.Collada;<br />
import org.papervision3d.cameras.Camera3D;<br />
import org.papervision3d.materials.utils.MaterialsList;<br />
import org.papervision3d.materials.shadematerials.FlatShadeMaterial;<br />
import org.papervision3d.lights.PointLight3D;<br />
import org.papervision3d.materials.shaders.CellShader;</code></p>
<p>Now let&#8217;s prepare the 3d scene:</p>
<p><code>var cam:Camera3D=new Camera3D();<br />
var scena:Scene3D=new Scene3D();<br />
var view:Viewport3D=new Viewport3D();<br />
var pl:PointLight3D = new PointLight3D();<br />
var render:BasicRenderEngine=new BasicRenderEngine();</code></p>
<p>So in order to create a papervision scene we need a camera object, a scene3D, viewport3D and a RenderEngine this is necesary for a papervision scene.</p>
<p>Now create the materials:</p>
<p><code><span style="color: #800000;">//the glow filter will give a nice outer stroke to the 3d model</span><br />
var gf:GlowFilter=new GlowFilter(0x000000,1,5,5,4,1);<br />
<span style="color: #800000;">//this is a material from the papervision 3d library that uses a light to cast shadows on the objects</span><br />
var cs:CellShader = new CellShader(pl);<br />
<span style="color: #800000;">//the material list contains all the materials for the different faces, in this case all the faces<br />
//are flast shaded</span><br />
var ml:MaterialsList = new MaterialsList( { all:new FlatShadeMaterial(pl) } );</code></p>
<p>Now import the 3d model and add it to the scene object:</p>
<p><code>var tank:DisplayObject3D=new Collada("tnk.dae",ml);<br />
<span style="color: #800000;">//because the 3d modeling tool used is different this values may need some<br />
//trial and error before getting them right</span><br />
tank.scaleX=tank.scaleY=tank.scaleZ=0.3;<br />
tank.y=-300;<br />
tank.z=300;<br />
tank.rotationY=90;<br />
<span style="color: #800000;">//all you filters are not added to the actual model but on the viewport 3d</span><br />
view.filters=[gf];<br />
<span style="color: #800000;">//add the tank object to the scene 3d</span><br />
scena.addChild(tank);<br />
<span style="color: #800000;">//add the viewport to the flash display list</span><br />
addChild(view);</code></p>
<p>To be able to render animations you need to encapsulate the render function in a EnterFrame event:</p>
<p><code>addEventListener(Event.ENTER_FRAME,anim);</code></p>
<p><code>function anim(e:Event){<br />
tank.rotationY++;<br />
<span style="color: #800000;">//the renderScene function expects 3 parameters: the scene3D where all the objects are<br />
//the camera and the viewport3D</span><br />
render.renderScene(scena,cam,view);<br />
}</code></p>
<p>Now test the movie and you should get the following result:</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_dae_51686593"
			class="flashmovie"
			width="444"
			height="400">
	<param name="movie" value="http://jurnal.tripmedia.ro/wp-content/uploads/2009/06/dae.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://jurnal.tripmedia.ro/wp-content/uploads/2009/06/dae.swf"
			name="fm_dae_51686593"
			width="444"
			height="400">
	<!--<![endif]-->
		<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>You can download the final source files<a href="http:///jurnal.tripmedia.ro/wp-content/uploads/2009/06/final.rar" target="_blank"> here</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjurnal.tripmedia.ro%2Fpapervision-3d-loading-collada-files%2F2096.html&amp;title=Papervision%203D%20Loading%20Collada%20Files" id="wpa2a_8">Articol favorit</a></p>]]></content:encoded>
			<wfw:commentRss>http://jurnal.tripmedia.ro/papervision-3d-loading-collada-files/2096.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash BitmapData Glass Effect</title>
		<link>http://jurnal.tripmedia.ro/flash-bitmapdata-glass-effec/2050.html</link>
		<comments>http://jurnal.tripmedia.ro/flash-bitmapdata-glass-effec/2050.html#comments</comments>
		<pubDate>Mon, 11 May 2009 06:56:30 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programare]]></category>
		<category><![CDATA[BitmapData]]></category>

		<guid isPermaLink="false">http://jurnal.tripmedia.ro/?p=2050</guid>
		<description><![CDATA[In this new tutorial you will learn how to use BitmapData to draw an image and how to draw only one part of the desired image and apply an effect or transformation to it (in this case a blur effect). To get started we create a new MovieClip in the library and inside it another [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/05/left_pic.jpg"><img class="aligncenter size-full wp-image-2065" title="BitmapData tutorial" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/05/left_pic.jpg" alt="BitmapData tutorial" width="231" height="295" /></a>In this new tutorial you will learn how to use BitmapData to draw an image and how to draw only one part of the desired image and apply an effect or transformation to it (in this case a blur effect).<span id="more-2050"></span> To get started we create a new MovieClip in the library and inside it another MovieClip that will be the holder for our bitmapdata(it has an instance name of <em>&#8220;hld&#8221;</em>). Also import import in the flash file an image and convert it to MovieClip. If you don&#8217;t want to do all of this you should get the starter files <a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/05/start.rar" target="_blank">here</a> .</p>
<p>Now let&#8217;s arrange our stage. First of all we add the MovieClip that contains the image and give it an instance name of <em>&#8220;img&#8221;</em> on top of that we add the holder and give it an instance name of <em>&#8220;scrol&#8221;</em>.</p>
<p>Let&#8217;s begin the coding: add the following code in the first frame&#8230;</p>
<p><code>var first:Boolean=true;<br />
var bmp:Bitmap=new Bitmap();</code></p>
<p>The variable <em>&#8220;first&#8221;</em> tell&#8217;s us if it&#8217;s the first time that we call the draw function, if not we can clear our bitmap called <em>&#8220;bmp&#8221;</em>.  Now will add an Event listener to our <em>&#8220;scrol&#8221;</em> MovieClip.</p>
<p><code>scrol.addEventListener(MouseEvent.MOUSE_DOWN,strtDrag);</code><br />
<code><br />
function strtDrag(e:MouseEvent){<br />
first=false;<span style="color: #800000;">//we set the variable first to false</span><br />
scrol.my=scrol.mouseY;<span style="color: #800000;">//we save the current mouse Y</span><br />
scrol.removeEventListener(MouseEvent.MOUSE_DOWN,strtDrag);<br />
scrol.addEventListener(MouseEvent.MOUSE_MOVE,repos);<br />
scrol.addEventListener(MouseEvent.MOUSE_UP,rem);<br />
}</code></p>
<p>When we mouse down on our <em>&#8220;scrol&#8221;</em> MovieClip we remove the event listener for mouse down and add two new events: one to listen for the mouse move event so that our movieclip will follow the mouse on the Y axis and another to listen for the mouse up event so we can stop the draging. Now let&#8217;s add our other functions.<br />
<code><br />
function rem(e:MouseEvent){<br />
scrol.addEventListener(MouseEvent.MOUSE_DOWN,strtDrag);<br />
scrol.removeEventListener(MouseEvent.MOUSE_MOVE,repos);<br />
scrol.removeEventListener(MouseEvent.MOUSE_UP,rem);<br />
}</code><br />
<code><br />
function repos(e:MouseEvent){<br />
scrol.y=mouseY-scrol.my;<span style="color: #800000;">//change the y position</span><br />
beginDraw();<span style="color: #800000;">//the function that does the bitmap drawing</span><br />
}</code></p>
<p>If you are asking: why not use <em>&#8220;startDrag()&#8221;</em> instead of all this code. The answer is that in order to use it only on the Y axis you should create a new Rectangle variable so you can limit it only on the Y axis. Because the center point of <em>&#8220;scrol&#8221;</em> is in the top left corner we need to substract from the current mouse position our variable. Now let&#8217;s create the beginDraw function:</p>
<p><code>function beginDraw() {<br />
if(!first){<br />
scrol.hld.removeChild(bmp);<br />
}<br />
var bmd:BitmapData=new BitmapData(scrol.width,scrol.height);<br />
var bmd2:BitmapData=new BitmapData(444,400);<br />
var rectangle:Rectangle=new Rectangle(0,scrol.y,scrol.width,scrol.height);<br />
bmd2.draw(img);<br />
bmd.copyPixels(bmd2,rectangle,new Point(0,0));<br />
bmd2.dispose();<br />
bmp.bitmapData=bmd;<br />
var bf:BlurFilter=new BlurFilter(6,6,3);<br />
bmp.filters=[bf];<br />
scrol.hld.addChild(bmp);<br />
}</code></p>
<p><code>beginDraw();</code></p>
<p>In order to draw just the part of the image that is under the <em>&#8220;scrol&#8221; </em>MovieClip,  create two bitmapData variables: one to copy the whole image and another to copy only the pixels that we need.Finally we add a blur filter to the bitmap and call our <em>&#8220;beginDraw&#8221;</em> function so we can see the effect the first time we enter the flash movie. When you test your movie it should look like this:</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_blurs_1632956480"
			class="flashmovie"
			width="444"
			height="400">
	<param name="movie" value="http://jurnal.tripmedia.ro/wp-content/uploads/2009/05/blurs.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://jurnal.tripmedia.ro/wp-content/uploads/2009/05/blurs.swf"
			name="fm_blurs_1632956480"
			width="444"
			height="400">
	<!--<![endif]-->
		<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>You can download the finished source files <a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/05/finished.rar" target="_blank">here</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjurnal.tripmedia.ro%2Fflash-bitmapdata-glass-effec%2F2050.html&amp;title=Flash%20BitmapData%20Glass%20Effect" id="wpa2a_10">Articol favorit</a></p>]]></content:encoded>
			<wfw:commentRss>http://jurnal.tripmedia.ro/flash-bitmapdata-glass-effec/2050.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Parse XML and 3D gallery in Adobe Flash CS4</title>
		<link>http://jurnal.tripmedia.ro/parse-xml-and-3d-gallery-adobe-flash-cs4/1696.html</link>
		<comments>http://jurnal.tripmedia.ro/parse-xml-and-3d-gallery-adobe-flash-cs4/1696.html#comments</comments>
		<pubDate>Thu, 12 Mar 2009 15:53:36 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programare]]></category>
		<category><![CDATA[3D Gallery]]></category>
		<category><![CDATA[Adobe Flash CS4]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://jurnal.tripmedia.ro/?p=1696</guid>
		<description><![CDATA[It&#8217;s time for a new tutorial, appropriate for beginners, too. This tutorial ilustrates a couple of basic stuff, for example how to load and parse a xml file. The tutorial also explains how to create a 3D gallery in Flash CS4 without any external 3D library. You must remember that  3D in Flash CS4 is  inferior to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/img.jpg"><img class="aligncenter size-full wp-image-1766" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/img.jpg" alt="img" width="231" height="295" /></a>It&#8217;s time for a new tutorial, appropriate for beginners, too. This tutorial ilustrates a couple of basic stuff, for example how to load and parse a xml file. The tutorial also explains how to create a 3D gallery in Flash CS4 without any external 3D library. You must remember that  3D in Flash CS4 is  inferior to 3D provided by engines like <a href="http://blog.papervision3d.org/" target="_blank">Papervision</a> or <a href="http://away3d.com/" target="_blank">Away3D</a> (there is no Z axis sorting, therefore adding a movieclip to the stage at 100 on the Z axis and then another at 500 on the Z axis, the last added movieclip lays in front, even though it should lay in the back). For this tutorial you  need only <a href="http://www.adobe.com/products/flash/" target="_blank">Adobe Flash CS4</a>.</p>
<p><span id="more-1696"></span></p>
<p>To start things off, I have created a new flash document called photo.fla and saved it, a xml file called gall.xml and 7 pics 200&#215;200. If you don&#8217;t have a desire for creating this files for yourself you may download the start files right <a title="Flash Tutorial" href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/start.rar" target="_blank">here</a>.</p>
<p>Let&#8217;s begin by creating the needed variables:</p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p1.jpg"><img class="aligncenter size-medium wp-image-1711" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p1-230x92.jpg" alt="Adobe Flash CS4 tutorial" width="230" height="92" /></a><br />
<code>var arr:Array=new Array();<span style="color: #800000;">//this holds out all xml data</span><br />
var pics:Array=new Array();<span style="color: #800000;">//this holds out all the images</span><br />
var str:Number=-90;<span style="color: #800000;">//this is for the maximum angle</span><br />
var decr:Number=0;<span style="color: #800000;">//this is the angle increment</span><br />
var nr:Number=0;<span style="color: #800000;">//this is the number of the picture</span><br />
var uldr:URLLoader=new URLLoader();<span style="color: #800000;">//the url loader variable to load the xml</span></code></p>
<p>Now let&#8217;s load the xml:</p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p2.jpg"><img class="aligncenter size-medium wp-image-1713" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p2-230x117.jpg" alt="Adobe Flash CS4 Tutorial" width="230" height="117" /></a><br />
<code><br />
<span style="color: #800000;">//add a new event listener for the loader</span><br />
uldr.addEventListener(Event.COMPLETE,doArr);<br />
<span style="color: #800000;">//load our xml</span><br />
uldr.load(new URLRequest("gall.xml"));</code></p>
<p>Now add the code for the Event.Complete function called doArr. This function parses the xml file.</p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p3.jpg"><img class="aligncenter size-medium wp-image-1715" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p3-229x156.jpg" alt="Adobe Flash CS4 Tutorial" width="229" height="156" /></a></p>
<p><code><span style="color: #800000;">//create the Event.COMPLETE function that parses the xml</span><br />
function doArr(e:Event){<br />
<span style="color: #800000;">//create a new xml variable</span><br />
var xml:XML=new XML(e.target.data);<br />
<span style="color: #800000;">//create a new xml list variable</span><br />
var il:XMLList=xml.item;<br />
<span style="color: #800000;">//parse the xml</span><br />
for(var i:uint=0;i&lt;il.length();i++){<br />
arr.push(il[i].linku);<br />
}<br />
<span style="color: #800000;">//after the xml has been parsed, calculate the<br />
//rotation distance between photos</span><br />
decr=-Math.round((str/il.length()));<br />
<span style="color: #800000;">//call the function that creates the gallery</span><br />
createGall();<br />
}</code></p>
<p>Let&#8217;s construct the createGall function:</p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p4.jpg"><img class="aligncenter size-medium wp-image-1717" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p4-230x125.jpg" alt="Adobe Flash CS4 Tutorial" width="230" height="125" /></a><br />
<code><br />
<span style="color: #800000;">//create the function that loads our gallery images</span><br />
function createGall(){<br />
<span style="color: #800000;">//parse the array that contains our images</span><br />
for(var i:uint=0;i&lt;arr.length;i++){<br />
<span style="color: #800000;">//create a new url loader</span><br />
var ldr:Loader=new Loader();<br />
<span style="color: #800000;">//load the image locate at the i position in the array</span><br />
ldr.load(new URLRequest(arr[i]));<br />
<span style="color: #800000;">//add a new event listener that ads the image to the stage</span><br />
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,doImg);<br />
}<br />
}</code></p>
<p>Write the function that adds the gallery to the Stage.</p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p5.jpg"><img class="aligncenter size-medium wp-image-1719" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p5-230x170.jpg" alt="Adobe Flash CS4 Tutorial" width="230" height="170" /></a></p>
<p><code>function doImg(e:Event){<br />
<span style="color: #800000;">//create a new movieclip to hold the image</span><br />
var t:MovieClip=new MovieClip();<br />
<span style="color: #800000;">//create a new sprite in wich to draw a white rectangle</span><br />
var spr:Sprite=new Sprite();<br />
<span style="color: #800000;">//we set the fill color to white</span><br />
spr.graphics.beginFill(0xFFFFFF);<br />
<span style="color: #800000;">//we draw the rectangle at x:0,y:0, width:210,height:210<br />
//that means +10 of the width and height of our image (200x200)</span><br />
spr.graphics.drawRect(0,0,210,210);<br />
<span style="color: #800000;">//and drawing</span><br />
spr.graphics.endFill();<br />
<span style="color: #800000;">//we position our sprite</span><br />
spr.x=-spr.width/2;<br />
spr.y=-spr.height+5;<br />
<span style="color: #800000;">//create a new bitmap that receives the loaded image</span><br />
var bm:Bitmap=Bitmap(e.target.content);<br />
<span style="color: #800000;">//position the image</span><br />
bm.x=-bm.width/2;<br />
bm.y=-bm.height;<br />
<span style="color: #800000;">//smooth the image</span><br />
bm.smoothing=true;<br />
<span style="color: #800000;">//add the sprite and image to our movieclip</span><br />
t.addChild(spr);<br />
t.addChild(bm);<br />
<span style="color: #800000;">//position the movieclip on the stage</span><br />
t.x=300;<br />
t.y=300;<br />
<span style="color: #800000;">//set the rotation in 3d space</span><br />
t.rotationY=-40;<br />
t.rotationX=str;<br />
str+=decr;<br />
<span style="color: #800000;">//create a new rot property for the movieclip<br />
//that holds the rotation on the X axis</span><br />
t.rot=t.rotationX;<br />
<span style="color: #800000;">//the number of the picture</span><br />
t.nr=nr;<br />
nr++;<br />
<span style="color: #800000;">//push the picture in the pics array</span><br />
pics.push(t);<br />
<span style="color: #800000;">//add the movieclip to the Stage</span><br />
addChild(t);<br />
<span style="color: #800000;">//add a new event listener to the movieclip<br />
//that animates our gallery when we click an image</span><br />
t.addEventListener(MouseEvent.CLICK,entr);<br />
}</code></p>
<p>Now let&#8217;s write the click function that animates the gallery:</p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p6.jpg"><img class="aligncenter size-medium wp-image-1721" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p6-230x165.jpg" alt="Adobe Flash CS4 Tutorial" width="230" height="165" /></a></p>
<p><code>function entr(e:MouseEvent){<br />
<span style="color: #800000;">//check to see if the clicked image is in front</span><br />
if(e.currentTarget.nr==nr-1){<br />
nr-=1;<br />
<span style="color: #800000;">//add a new event to the clicked image</span><br />
e.currentTarget.addEventListener(Event.ENTER_FRAME,anim);<br />
for(var i:uint=0;i&lt;pics.length;i++){<br />
<span style="color: #800000;">//all the images in a lower postion than the clicked image<br />
//are animated with another function</span><br />
if(i&lt;e.currentTarget.nr){<br />
<span style="color: #800000;">//create a temporary movieclip</span><br />
var tmp:MovieClip=MovieClip(pics[i]);<br />
<span style="color: #800000;">//animate th movieclip</span><br />
tmp.addEventListener(Event.ENTER_FRAME,anim2);<br />
}<br />
}<br />
<span style="color: #800000;">//remove the click event from the current clicked image</span><br />
e.currentTarget.removeEventListener(MouseEvent.CLICK,entr);<br />
}<br />
}</code></p>
<p>Add the following code to create the first animation function:</p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p7.jpg"><img class="aligncenter size-medium wp-image-1722" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p7-230x107.jpg" alt="Adobe Flash CS4 Tutorial" width="230" height="107" /></a><br />
<code><br />
function anim(e:Event){<br />
if(e.currentTarget.rotationX&lt;90){<br />
<span style="color: #800000;">//roatate the front image</span><br />
e.currentTarget.rotationX+=(90-e.currentTarget.rotationX)/10;<br />
<span style="color: #800000;">//decrease the alpha of the image</span><br />
e.currentTarget.alpha+=(0-e.currentTarget.alpha)/10;<br />
}<br />
}</code></p>
<p>Now the code that animates the rest of the images:</p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p8.jpg"><img class="aligncenter size-medium wp-image-1724" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/p8-230x134.jpg" alt="Adobe Flash CS4 Tutorial" width="230" height="134" /></a></p>
<p><code>function anim2(e:Event){<br />
<span style="color: #800000;">//calculate the rotation at wich the picture<br />
//will be set at the final of the animation</span><br />
var nrx:Number=e.currentTarget.rot+decr;<br />
<span style="color: #800000;">//animate the rotation</span><br />
e.currentTarget.rotationX+=Math.round((nrx-e.currentTarget.rotationX)/10);<br />
<span style="color: #800000;">//check to see the rotation value</span><br />
if(e.currentTarget.rotationX&gt;=nrx-4){<br />
<span style="color: #800000;">//remove this function</span><br />
e.currentTarget.removeEventListener(Event.ENTER_FRAME,anim2);<br />
<span style="color: #800000;">//set the rot property</span><br />
e.currentTarget.rot=nrx;<br />
}<br />
}</code></p>
<p>Let&#8217;s test our movie to see the final result:</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_photo_665811955"
			class="flashmovie"
			width="444"
			height="400">
	<param name="movie" value="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/photo.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/photo.swf"
			name="fm_photo_665811955"
			width="444"
			height="400">
	<!--<![endif]-->
		<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>You can get the final source files <a title="Flash Tutorial" href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/photo.rar" target="_blank">here</a> , play with it and show me what you come up with.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjurnal.tripmedia.ro%2Fparse-xml-and-3d-gallery-adobe-flash-cs4%2F1696.html&amp;title=Parse%20XML%20and%203D%20gallery%20in%20Adobe%20Flash%20CS4" id="wpa2a_12">Articol favorit</a></p>]]></content:encoded>
			<wfw:commentRss>http://jurnal.tripmedia.ro/parse-xml-and-3d-gallery-adobe-flash-cs4/1696.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Adobe Air HTML Tutorial</title>
		<link>http://jurnal.tripmedia.ro/adobe-air-html-tutorial/1732.html</link>
		<comments>http://jurnal.tripmedia.ro/adobe-air-html-tutorial/1732.html#comments</comments>
		<pubDate>Sun, 08 Mar 2009 17:26:07 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programare]]></category>
		<category><![CDATA[Adobe air]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://jurnal.tripmedia.ro/?p=1732</guid>
		<description><![CDATA[Today I have decided to start with a simple tutorial that quickly shows what Adobe Air can do. So for this tutorial we will create a simple web browser. To do this you need Adobe Flash CS4 and Adobe AIR 1.5 .  Adobe AIR uses Webkit to render the HTML content, the same engine that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/tutx.jpg"><img class="aligncenter size-medium wp-image-1735" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/03/tutx-230x293.jpg" alt="Flash and Air and Tutorial" width="230" height="293" /></a>Today I have decided to start with a simple tutorial that quickly shows what Adobe Air can do. So for this tutorial we will create a simple web browser. To do this you need <a href="http://www.adobe.com/products/flash/" target="_blank">Adobe Flash CS4</a> and <a href="http://www.adobe.com/products/air/" target="_blank">Adobe AIR 1.5</a> .  Adobe AIR uses <a href="http://webkit.org/" target="_blank">Webkit</a> to render the HTML content, the same engine that powers <a href="http://www.apple.com/safari/" target="_blank">Safari</a>.</p>
<p><span id="more-1732"></span>Let&#8217;s get started by creating a new flash file and adding the following code:</p>
<p><code><span style="color: #800000;">Create a new HTML loader variable</span><br />
var htmlL:HTMLLoader=new HTMLLoader();<br />
<span style="color: #800000;">set the dimensions of your html content to the<br />
dimensions of the stage</span><br />
htmlL.width=stage.stageWidth;<br />
htmlL.height=stage.stageHeight;<br />
<span style="color: #800000;">add the html to the stage</span><br />
addChild(htmlL);<br />
<span style="color: #800000;">this next line disables cache for your browser<br />
if you set it to true when you revisit a web page<br />
it will take some components of that web site from<br />
the cache saved on your computer</span><br />
htmlL.cacheResponse=false;<br />
<span style="color: #800000;">this loads the desired web page</span><br />
htmlL.load(new URLRequest("http://tripmedia.ro"));</code></p>
<p>Now test your file and you will see the web page. This is just an example to show what Adobe Air can do, the browser is not completly functional because the user can not input the adress and there is no UI(user interface) . But this is something that everybody can experiment with and let their imagination loose.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjurnal.tripmedia.ro%2Fadobe-air-html-tutorial%2F1732.html&amp;title=Adobe%20Air%20HTML%20Tutorial" id="wpa2a_14">Articol favorit</a></p>]]></content:encoded>
			<wfw:commentRss>http://jurnal.tripmedia.ro/adobe-air-html-tutorial/1732.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adobe AIR &amp; Flash Tutorial</title>
		<link>http://jurnal.tripmedia.ro/phone-book-adobe-air/1536.html</link>
		<comments>http://jurnal.tripmedia.ro/phone-book-adobe-air/1536.html#comments</comments>
		<pubDate>Tue, 24 Feb 2009 08:36:04 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programare]]></category>
		<category><![CDATA[Adobe air]]></category>
		<category><![CDATA[baze de date]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://jurnal.tripmedia.ro/?p=1536</guid>
		<description><![CDATA[It&#8217;s time for a new tutorial. Now let&#8217;s move to the intermediate users who have basic knowledge of Adobe Flash and are starting to use Adobe AIR . Let&#8217;s build a little address book application using the power of Adobe AIR and a local database (note that this is just an introduction to air and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/left_pic.jpg"><img class="aligncenter size-full wp-image-1611" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/left_pic.jpg" alt="left_pic" width="231" height="295" /></a>It&#8217;s time for a new tutorial. Now let&#8217;s move to the intermediate users who have basic knowledge of Adobe Flash and are starting to use Adobe AIR . Let&#8217;s build a little address book application using the power of Adobe AIR and a local database (note that this is just an introduction to air and local mysql lite databases).</p>
<p>First &#8230; What is Adobe AIR? Adobe AIR is a cross-platform <span class="mw-redirect">runtime environment</span> for building rich Internet applications using Adobe Flash, Adobe Flex, HTML, or Ajax, that can be deployed as a desktop application.<span id="more-1536"></span></p>
<p>For this tutorial you will need at least <a href="http://www.adobe.com/products/flash/">Adobe Flash CS3</a> and the latest <a href="http://www.adobe.com/products/air/develop/flash/">Adobe Air</a> runtime for Flash. In order to start our application I&#8217;ve created a background movie clip called &#8220;<em>back</em>&#8221; , two buttons (one to add new contacts with an instance name of &#8220;<em>plus</em>&#8221; and one to close the application with an instance name of &#8220;<em>xu</em>&#8220;). In the first frame I have a combo box component with an instance name of &#8220;<em>lister</em>&#8221; , in the second frame two input text fields with the instance names of &#8220;<em>nume</em>&#8221; and &#8220;<em>tel</em>&#8220;. If you don&#8217;t want to create this for yourself you can download the <a title="Start files" href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/start.rar" target="_blank">start.fla file</a>.<br />
<a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p1.jpg"><img class="aligncenter size-medium wp-image-1542" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p1-230x163.jpg" alt="Pasul 1" width="230" height="163" /></a></p>
<p>Add the following code to the first frame of your movie:</p>
<p><code>stop();</code></p>
<p style="text-align: left;"><code><span style="color: #800000;">//create a new sql connection</span><br />
var conn:SQLConnection= new SQLConnection();<br />
<span style="color: #800000;">//add an event handeler for the open event</span><br />
conn.addEventListener(SQLEvent.OPEN, openHandler);<br />
<span style="color: #800000;">//create the database if it doesn't exist, otherwise just opens it</span><br />
var dbFile:File =File.applicationDirectory.resolvePath ("exemplu.db");<br />
conn.openAsync(dbFile);</code></p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p2.jpg"><img class="aligncenter size-medium wp-image-1546" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p2-230x125.jpg" alt="pasul2" width="230" height="125" /></a></p>
<p>Now add a new function that creates a table in the database. To do so, write the following code in the first frame of your application:</p>
<p><code>function openHandler(event:SQLEvent):void {<br />
<span style="color: #800000;">//create a new sql statement</span><br />
var sql:SQLStatement=new SQLStatement();<br />
<span style="color: #800000;">//set the statement to connect to our database</span><br />
sql.sqlConnection=conn;<br />
<span style="color: #800000;">//parse the sql command that creates the table if it doesn't exist</span><br />
sql.text= "CREATE TABLE IF NOT EXISTS contacte(" +<br />
"id INTEGER PRIMARY KEY AUTOINCREMENT, " +<br />
"nume TEXT, " +<br />
"telefon INTEGER)";<br />
<span style="color: #800000;">//add a new event listener to the sql when it completes </span>creating the table<br />
sql.addEventListener(SQLEvent.RESULT,retrieveData);<br />
<span style="color: #00ff00;"><span style="color: #800000;">/</span><span style="color: #800000;">/call the execute function to execute our statement</span></span><br />
sql.execute();<br />
}</code></p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p3.jpg"><img class="aligncenter size-medium wp-image-1553" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p3-230x147.jpg" alt="Pasul 3" width="230" height="147" /></a></p>
<p>The next step is to create the function that retrieves the data from the table in the database. Just write the following code in the first frame of your application:</p>
<p><code>function retrieveData(event:SQLEvent = null):void {<br />
<span style="color: #800000;">//create a new sql statemant</span><br />
var sql:SQLStatement = new SQLStatement();<br />
sql.sqlConnection=conn;<br />
<span style="color: #800000;">//this sql command retrieves all the fields from our<br />
//table in the database and orders it by name</span><br />
sql.text =  "SELECT id, nume, " +<br />
"telefon " +<br />
"FROM contacte ORDER BY nume";<br />
<span style="color: #800000;">//add a new event listener if there is data<br />
//to display it</span><br />
sql.addEventListener(SQLEvent.RESULT, selectHandler);<br />
sql.execute();<br />
}</code></p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p4.jpg"><img class="aligncenter size-medium wp-image-1561" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p4-230x177.jpg" alt="Pasul 4" width="230" height="177" /></a></p>
<p>Now it is time to create the function that shows the contacts in the list component. To create it just insert in the first frame of your file the following code:</p>
<p><code>function selectHandler(event:SQLEvent):void {<br />
<span style="color: #800000;">//first we clear our list</span><br />
lister.removeAll();<br />
<span style="color: #800000;">//the we create a result variable that holds<br />
//all our contacts</span><br />
var result:SQLResult=event.target.getResult();<br />
<span style="color: #800000;">//we check if results is not empty</span><br />
if (result!=null&amp;&amp;result.data!=null) {<br />
<span style="color: #800000;">//and we add a new item to our list for<br />
//each contact in our database</span><br />
for (var i:Number = 0; i &lt; result.data.length; i++) {<br />
lister.addItem ({ label:result.data[i].nume + "-" +result.data[i].telefon<br />
, nr:result.data[i].id });<br />
}<br />
}<br />
}</code></p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p5.jpg"><img class="aligncenter size-medium wp-image-1565" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p5-230x145.jpg" alt="Pasul 5" width="230" height="145" /></a></p>
<p>Now to add some code to our buttons :</p>
<p><code>plus.addEventListener(MouseEvent.CLICK,adder);<br />
xu.addEventListener(MouseEvent.CLICK,closeapp);<br />
back.addEventListener(MouseEvent.MOUSE_DOWN,drag);<br />
<span style="color: #800000;">//because my buttons are not real buttons<br />
//but movieclips i need to set the<br />
//buttonMode property to true</span><br />
plus.buttonMode=true;<br />
xu.buttonMode=true;</code></p>
<p><code>function adder(e:MouseEvent):void{<br />
<span style="color: #800000;">//remove the eventlistener and move to the<br />
//next frame</span><br />
plus.removeEventListener(MouseEvent.CLICK,adder);<br />
nextFrame();<br />
}</code></p>
<p><code>function closeapp(e:MouseEvent):void {<br />
<span style="color: #800000;">//close the application</span><br />
NativeApplication.nativeApplication.exit();<br />
}</code></p>
<p><code>function drag(e:MouseEvent):void {<br />
<span style="color: #800000;">//drag the application</span><br />
this.stage.nativeWindow.startMove();<br />
}</code></p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p6.jpg"><img class="aligncenter size-medium wp-image-1575" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p6-230x152.jpg" alt="Pasul 6" width="230" height="152" /></a></p>
<p>You&#8217;ve finished the first frame, it&#8217;s time to go to the second frame where we add the contacts. Start by adding the next code:</p>
<p><code><span style="color: #800000;">//this line restricts the user input<br />
//to just numbers in the phone input box</span><br />
tel.restrict="0-9";<br />
<span style="color: #800000;">//add a new event listener to our plus button</span><br />
plus.addEventListener(MouseEvent.CLICK,adder2);</code></p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p7.jpg"><img class="aligncenter size-medium wp-image-1578" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p7-230x132.jpg" alt="Pasul 7" width="230" height="132" /></a></p>
<p>Now create the final function that adds a new contact in the database:</p>
<p><code>function adder2(e:MouseEvent):void {<br />
<span style="color: #800000;">//create a new sql statement variable</span><br />
var sql:SQLStatement=new SQLStatement();<br />
sql.sqlConnection=conn;<br />
<span style="color: #800000;">//the next sql command creates a new entry<br />
//in the table contacte from our database</span><br />
sql.text =  "INSERT INTO contacte(nume, " +<br />
"telefon)" +<br />
"VALUES(@nume, " +<br />
"@telefon)";<br />
<span style="color: #800000;">//to insert variables into sql commnads<br />
//we use the parameters definition</span><br />
sql.parameters["@nume"]=nume.text;<br />
sql.parameters["@telefon"]=tel.text;<br />
<span style="color: #800000;">//add a new event listener that calls the<br />
//function that retrieves the data</span><br />
sql.addEventListener(SQLEvent.RESULT,retrieveData);<br />
sql.execute();<br />
<span style="color: #800000;">//go to frame no. 1</span><br />
prevFrame();<br />
<span style="color: #800000;">//remove the eventlistener from our plus button</span><br />
plus.removeEventListener(MouseEvent.CLICK,adder2);<br />
}</code></p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p8.jpg"><img class="aligncenter size-medium wp-image-1582" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/p8-230x223.jpg" alt="Pasul 8" width="230" height="223" /></a></p>
<p>Now you can test the application like you would normaly do (CTRL+Enter on windows or command+enter on Mac). This is how my finished application looks like on desktop.</p>
<p><a href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/finished.jpg"><img class="aligncenter size-medium wp-image-1583" src="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/finished-230x216.jpg" alt="finished" width="230" height="216" /></a></p>
<p>Now to publish the file as an Air application, so that other users can use the application, go to File&gt;AIR Settings . A new window will appear; you can set whatever names in there but be sure to set the Window Style to Custom Chrome (transparent). Press the Publish AIR file button that creates an air installer file in the same directory where you&#8217;ve saved your .fla file. <a title="Final sources" href="http://jurnal.tripmedia.ro/wp-content/uploads/2009/02/final.rar" target="_blank">Here</a> is the finished source file.</p>
<p>This tutorial is just to get you started on using Adobe AIR. It is not a complete application, because there are some missing functions. For example there is no checking to see that the users input is not empty. You can not delete or  modify a contact and the list could go on, the only limit is your imagination. If you want to add extra features to your application, you should use the same techniques shown in this tutorial. For more Sql commands you should use google or ask Maximilian to search what you want to modify in the database.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fjurnal.tripmedia.ro%2Fphone-book-adobe-air%2F1536.html&amp;title=Adobe%20AIR%20%26%23038%3B%20Flash%20Tutorial" id="wpa2a_16">Articol favorit</a></p>]]></content:encoded>
			<wfw:commentRss>http://jurnal.tripmedia.ro/phone-book-adobe-air/1536.html/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
