<?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"
	>

<channel>
	<title>Flashmoto</title>
	<atom:link href="http://www.flashmoto.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flashmoto.com</link>
	<description>Papervision &#38; ActionScript Tips</description>
	<pubDate>Wed, 24 Dec 2008 15:59:12 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>Unity 3D - New Reality!</title>
		<link>http://www.flashmoto.com/flash-software/unity3d-new-reality/</link>
		<comments>http://www.flashmoto.com/flash-software/unity3d-new-reality/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 13:45:42 +0000</pubDate>
		<dc:creator>Difort</dc:creator>
		
		<category><![CDATA[Flash Software]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[unity]]></category>

		<guid isPermaLink="false">http://www.flashmoto.com/?p=211</guid>
		<description><![CDATA[
I&#8217;d like to share with you an inspiring software for 3D developers. Unity3D new reality, the future of online game industry!
You could ask what&#8217;s so AWESOME in Unity3D? Let me explain or simply show you.
First of all you should install Unity3D player which is only 3Mb, after that you could play unity3D projects. Now we [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/12/unity3d/unity3d.jpg" alt="" /></p>
<p>I&#8217;d like to share with you an inspiring software for 3D developers. <a href="http://unity3d.com" onclick="pageTracker._trackPageview('/outgoing/unity3d.com?referer=');">Unity3D</a> new reality, the future of online game industry!<br />
You could ask what&#8217;s so AWESOME in Unity3D? Let me explain or simply show you.<br />
First of all you should install <a rel="nofollow" href="http://unity3d.com/unity/download" onclick="pageTracker._trackPageview('/outgoing/unity3d.com/unity/download?referer=');">Unity3D player</a> which is only 3Mb, after that you could play unity3D projects. Now we could check the samples.</p>
<p><span id="more-211"></span><a rel="nofollow" href="http://madfishgames.com/index.html" target="_blank" onclick="pageTracker._trackPageview('/outgoing/madfishgames.com/index.html?referer=');"><strong>Dungeonz</strong></a> - Control the Green Ogre around the maze. Simple but really cool animation. What I really like is load time!</p>
<p><a rel="nofollow" href="http://madfishgames.com/index.html" target="_blank" onclick="pageTracker._trackPageview('/outgoing/madfishgames.com/index.html?referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/12/unity3d/unity3d-dungeonz.jpg" alt="" /></a></p>
<p><a rel="nofollow" href="http://freeverse.com/games/game/?id=7019" target="_blank" onclick="pageTracker._trackPageview('/outgoing/freeverse.com/games/game/?id=7019&amp;referer=');"><strong>Hordes of Orcs</strong></a> - the best online browser Tower Defense game based on Warcraft World. TERRIFIC!</p>
<p><a rel="nofollow" href="http://freeverse.com/games/game/?id=7019" target="_blank" onclick="pageTracker._trackPageview('/outgoing/freeverse.com/games/game/?id=7019&amp;referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/12/unity3d/hordes-of-orcs.jpg" alt="" /></a></p>
<p><a rel="nofollow" href="http://games.sector3.com.au/tw_mp.aspx" target="_blank" onclick="pageTracker._trackPageview('/outgoing/games.sector3.com.au/tw_mp.aspx?referer=');"><strong>Turret Wars</strong></a> - browser online multilayer game from Sector 3 Games. Choose from FOUR different gun turret types, each with slightly different weapon and armor or projectile features!</p>
<p><a rel="nofollow" href="http://games.sector3.com.au/tw_mp.aspx" target="_blank" onclick="pageTracker._trackPageview('/outgoing/games.sector3.com.au/tw_mp.aspx?referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/12/unity3d/turrentwars.jpg" alt="" /></a></p>
<p><a rel="nofollow" href="http://unity3d.com/gallery/live-demos/avert-fate" target="_blank" onclick="pageTracker._trackPageview('/outgoing/unity3d.com/gallery/live-demos/avert-fate?referer=');"><strong>Avert Fate</strong></a> - fantastic 3D shooter. Install is so small that you would be amazed of the graphic.</p>
<p><a rel="nofollow" href="http://unity3d.com/gallery/live-demos/avert-fate" target="_blank" onclick="pageTracker._trackPageview('/outgoing/unity3d.com/gallery/live-demos/avert-fate?referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/12/unity3d/bigrobot.jpg" alt="" /></a></p>
<p><a rel="nofollow" href="http://unity3d.com/gallery/live-demos/shadows" target="_blank" onclick="pageTracker._trackPageview('/outgoing/unity3d.com/gallery/live-demos/shadows?referer=');"><strong>Shadows Demo</strong></a> - web browse preview or the light and dark side of Unity 3D!</p>
<p><a rel="nofollow" href="http://unity3d.com/gallery/live-demos/shadows" target="_blank" onclick="pageTracker._trackPageview('/outgoing/unity3d.com/gallery/live-demos/shadows?referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/12/unity3d/unity3d-light.jpg" alt="" /></a></p>
<p><a rel="nofollow" href="http://unity3d.com/gallery/live-demos/tropical-paradise" target="_blank" onclick="pageTracker._trackPageview('/outgoing/unity3d.com/gallery/live-demos/tropical-paradise?referer=');"><strong>Tropical Paradase</strong></a> - Feel the sun on your skin – right inside your browser. Using streaming, this huge scene loads almost instantly.</p>
<p><a rel="nofollow" href="http://unity3d.com/gallery/live-demos/tropical-paradise" target="_blank" onclick="pageTracker._trackPageview('/outgoing/unity3d.com/gallery/live-demos/tropical-paradise?referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/12/unity3d/tropical-paradise.jpg" alt="" /></a></p>
<p><a rel="nofollow" href="http://www.bigbrainz.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.bigbrainz.com/?referer=');"><strong>Big Brains</strong></a> - nice logic game with awesome 3D graphic. If you have a kid give them a try.</p>
<p><a rel="nofollow" href="http://www.bigbrainz.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.bigbrainz.com/?referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/12/unity3d/big-brains.jpg" alt="" /></a></p>
<p>I hope you&#8217;ve enjoyed Unity3D with me. Because it&#8217;s really worth your look.<br />
Some cool news for an iPhone owners that you could play all these games at your iPhone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashmoto.com/flash-software/unity3d-new-reality/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Best Papervision3D Websites</title>
		<link>http://www.flashmoto.com/papervision3d/the-best-papervision3d-websites/</link>
		<comments>http://www.flashmoto.com/papervision3d/the-best-papervision3d-websites/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 12:10:10 +0000</pubDate>
		<dc:creator>Difort</dc:creator>
		
		<category><![CDATA[Papervision3D]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[papervision]]></category>

		<guid isPermaLink="false">http://www.flashmoto.com/?p=198</guid>
		<description><![CDATA[I have some positive feedback about the idea of flash showcases. So I decided go on and post some magnificent works in Papervision3D. I’ve listed some websites below for your flash inspiration. All of them differ in style, in the way they make you feel, in the way they are using flash to catch your [...]]]></description>
			<content:encoded><![CDATA[<p>I have some positive feedback about the idea of flash showcases. So I decided go on and post some magnificent works in Papervision3D. I’ve listed some websites below for your flash inspiration. All of them differ in style, in the way they make you feel, in the way they are using flash to catch your attention. Try to use their Ideas in your works. Sometimes it&#8217;s not about user friendliness or usability for the flash websites we should also add the animation approach, unique concept, IDEA!<br />
Enjoy and be creative.</p>
<p><strong>1. <a rel="nofollow" href="http://www.cleoag.ru/labs/flex/parkseasons/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.cleoag.ru/labs/flex/parkseasons/?referer=');">Park Seasons</a> - same tree in 4 seasons just drag your mouse around the tree.</strong><br />
One of the things that I was curious about when using Papervision3D was how the camera moves around and tracks other objects. I think that developer of this website has the same problem. Set up a Camera3D object and moved it around which is not playing well enough to make it OMG-papervision3D example!</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/12/park-seasons.jpg" alt="" /></p>
<p><span id="more-198"></span><strong>2. <a rel="nofollow" href="http://www.papervision3d.org/demos/panorama/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.papervision3d.org/demos/panorama/?referer=');">Papervision3D Panorama</a></strong><br />
Perfection in simplicity! As i&#8217;ve told before about XM Radio website. It&#8217;s simple work but so damn good and attractive that it worth your another look.</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/12/panorama.jpg" alt="" /></p>
<p><strong>3. <a rel="nofollow" href="http://ecodazoo.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/ecodazoo.com/?referer=');">Eco Zoo</a></strong><br />
Also mentioned by me in my previous post <a href="http://www.flashmoto.com/flash-galleries/the-flash-fantasy/">The Flash Fantasy</a> but I didn&#8217;t mention that it was made on Papervision3D. This website is still breathtaking and worth to look at it once again. Still the fastest and the cutest one.</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/12/eco-zoo.jpg" alt="" /></p>
<p><strong>4. <a rel="nofollow" href="http://www.pepsi.se/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.pepsi.se/?referer=');">Pepsi</a></strong><br />
This one was developed by <a href="http://www.muskedunder.com/" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/www.muskedunder.com/?referer=');">Muskedunder Interactive</a> for TriggerMomentum and Pepsi Sweden. All I could say is &#8220;PEPSI - next generation&#8221;. They simply know what they are doing when we are speaking about how to attract teenagers.<br />
It&#8217;s on Sweden but instructions are simple:<br />
- Click a character to select difficulty level (LÄTT = easy, MEDEL =medium, SVÅR = hard)<br />
- Press FGHJ in rythm with music<br />
- Enjoy!</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/12/pepsi.jpg" alt="" /></p>
<p><strong>5. <a href="http://www.motorstorm.com/en_GB/pacificrift/minigame/" target="_blank" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/www.motorstorm.com/en_GB/pacificrift/minigame/?referer=');">Motor Storm</a> - the Game.</strong><br />
Yes, I wrote the word Game from the big G! This flash Game is short and lunker but it really stands for Papervision3D and shows all it&#8217;s features (I think).</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/12/motorstorm.jpg" alt="" /></p>
<p><strong>6. <a href="http://www.saveyoursensible.com/" target="_blank" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/www.saveyoursensible.com/?referer=');">Neglected Sensible Shalter</a> - save your Sensible.</strong><br />
Remember the last widget for Facebook &#8220;Save your Alien!&#8221;. That&#8217;s the same. Actually this one was 1st. Great animation effects.</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/12/sabsible.jpg" alt="" /></p>
<p><strong>7. <a href="http://www.papervision3d.org/" target="_blank" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/www.papervision3d.org/?referer=');">Underwater</a> - gorgeous aquarium.</strong><br />
Actually it&#8217;s the homepage of Papervision3D.org. It&#8217;s like telling you - &#8220;Hey! Check this out! Don&#8217;t read all that manuals and so on and so forth.&#8221; Terrific work. Reminds me the oldies Aquarium Fish Screensaver.</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/12/underwater.jpg" alt="" /></p>
<p><strong>8. <a href="http://www.papervision3d.org/demos/md2/DemoMd2.swf" target="_blank" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/www.papervision3d.org/demos/md2/DemoMd2.swf?referer=');">The Werewolf</a> - mighty and scary 3d model in action!</strong><br />
The final one and the most breathtaking example of Papervision3D. The scary werewolf in action which is terrifying with it&#8217;s sound effects and delighting with it&#8217;s coolness.</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/12/warewolf.jpg" alt="" /></p>
<p>That&#8217;s it for now. Feel free to comment these websites.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashmoto.com/papervision3d/the-best-papervision3d-websites/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Flash Fantasy!</title>
		<link>http://www.flashmoto.com/flash-galleries/the-flash-fantasy/</link>
		<comments>http://www.flashmoto.com/flash-galleries/the-flash-fantasy/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 14:37:12 +0000</pubDate>
		<dc:creator>Difort</dc:creator>
		
		<category><![CDATA[Flash Galleries]]></category>

		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.flashmoto.com/?p=184</guid>
		<description><![CDATA[I’ve listed some websites below for your flash inspiration. All of them differ in style, in the way they make you feel, in the way they are using flash to catch your attention. Try to use their Ideas in your works. Sometimes it&#8217;s not about user friendliness or usability for the flash websites we should [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve listed some websites below for your flash inspiration. All of them differ in style, in the way they make you feel, in the way they are using flash to catch your attention. Try to use their Ideas in your works. Sometimes it&#8217;s not about user friendliness or usability for the flash websites we should also add the animation approach, unique concept, IDEA!<br />
Enjoy and be creative.</p>
<p><span id="more-184"></span><strong>1. <a rel="nofollow" href="http://www.dupontrefinish.eu//dupontrefinish/com/en/Go_Pro2/content.htm" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.dupontrefinish.eu//dupontrefinish/com/en/Go_Pro2/content.htm?referer=');">DuPont</a> - Interactive Go Pro. Virtual bodyshop!</strong><br />
Neatly designed.  I like the idea and how developers worked on video.</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/11/flash-fantasy/flash-site-2.jpg" alt="" /></p>
<p><strong>2. <a rel="nofollow" href="http://www.wildridexm.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.wildridexm.com/?referer=');">XM Radio</a></strong><br />
I don&#8217;t understand what&#8217;s this site all about but when you enter the website simply use your keyboard to drive the car. Yeah, you&#8217;ll tell me it&#8217;s too simple. Perfection in simplicity!</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/11/flash-fantasy/flash-site-3.jpg" alt="" /></p>
<p><strong>3. <a rel="nofollow" href="http://ecodazoo.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/ecodazoo.com/?referer=');">Eco Zoo</a></strong><br />
I was amazed how quickly the website loads and it never showed any type of the preloader or anything when playing around. It’s a great interactive thing, drag the “tree” with your mouse up and down to see different characters, you can also rotate it with the mouse. Choose a book from the small pop-up of the character and you’ll be taken to a separate small charming website! This is a real piece of flash art and papervision!</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/11/flash-fantasy/flash-site-1.jpg" alt="" /></p>
<p><strong>4. <a rel="nofollow" href="http://www.soulpolice.com/motorolacity/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.soulpolice.com/motorolacity/?referer=');">Motorola- Public safety solutions</a></strong><br />
Very nice idea, cool animated stuff. It&#8217;s just video is to heavy &#8230;</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/11/flash-fantasy/flash-site-4.jpg" alt="" /></p>
<p><strong>5. <a href="http://www.coca-cola.com/HF/index.jsp" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.coca-cola.com/HF/index.jsp?referer=');">Happiness Factory</a> - coca-cola website.</strong><br />
Last but not least in this list. The MAX 2008 finalist. The best commercial creation ever made before!</p>
<p><img src="http://www.flashmoto.com/wp-content/uploads/2008/11/coca-cola-hf.jpg" alt="" /></p>
<p>That&#8217;s it for now. Feel free to leave your comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashmoto.com/flash-galleries/the-flash-fantasy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flex Color Wheel Component</title>
		<link>http://www.flashmoto.com/project-news/flex-color-wheel-component/</link>
		<comments>http://www.flashmoto.com/project-news/flex-color-wheel-component/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 10:56:50 +0000</pubDate>
		<dc:creator>Difort</dc:creator>
		
		<category><![CDATA[Project News]]></category>

		<category><![CDATA[colorwheel]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.flashmoto.com/?p=173</guid>
		<description><![CDATA[ColorWheel is a flex component for any kind of DisplayObject or any DisplayObject subclass that can apply filters with new FileReference features.

It is based on ColorMatrixFilter that allows you saturation changes, hue rotation, luminance to alpha, etc. Easy way to work with ColorMatrixFilter gives ColorMatrix class by Mario Klingemann.
The component also uses new ability of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>ColorWheel</strong> is a flex component for any kind of DisplayObject or any DisplayObject subclass that can apply filters with new FileReference features.</p>
<p style="text-align: center;"><a target="_blank" href="http://www.flashmoto.com/wp-content/uploads/2008/11/color-wheel-flex-component/index.html"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/color-wheel-flex-component/colorWheelFlexComponentPreview.jpg" alt="Color Wheel Component" /></a></p>
<p><span id="more-173"></span>It is based on ColorMatrixFilter that allows you saturation changes, hue rotation, luminance to alpha, etc. Easy way to work with ColorMatrixFilter gives ColorMatrix class by Mario Klingemann.</p>
<p>The component also uses new ability of the Flash Player 10 FileReference class to load and save data without server. <a target="_blank" href="http://www.flashmoto.com/wp-content/uploads/2008/11/color-wheel-flex-component/index.html">ColorWheel</a> can be easily customized using its custom properties and events to suit your application&#8217;s design and to integrate with your other classes and components. As usual use right click to view and download source.</p>
<p style="text-align: center;"><a href="http://www.flashmoto.com/wp-content/uploads/2008/11/color-wheel-flex-component/srcview/ColorWheelForBlog.zip"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/downloadSourceButton_forFlex.jpg" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashmoto.com/project-news/flex-color-wheel-component/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Adobe Max 2008</title>
		<link>http://www.flashmoto.com/adobe/adobe-max-2008/</link>
		<comments>http://www.flashmoto.com/adobe/adobe-max-2008/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 05:33:03 +0000</pubDate>
		<dc:creator>Difort</dc:creator>
		
		<category><![CDATA[Adobe]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[max]]></category>

		<guid isPermaLink="false">http://www.flashmoto.com/?p=152</guid>
		<description><![CDATA[
Each year thousands of web developers are waiting for Adobe Max conference (check Adobe Session Locator if you are still about to go). It&#8217;s a world famous conference that is held in San Francisco, California. This year isn&#8217;t an exception. Today was the first day of the largest ever Adobe MAX Conference. 5000 people have [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><img src="http://www.flashmoto.com/wp-content/uploads/2008/11/adobe-max.jpg" alt="Adobe Max" /></p>
<p>Each year thousands of web developers are waiting for <a href="http://max.adobe.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/max.adobe.com/?referer=');">Adobe Max</a> conference (check Adobe <a href="http://max.adobe.com/na/sessions/browser/" onclick="pageTracker._trackPageview('/outgoing/max.adobe.com/na/sessions/browser/?referer=');">Session Locator</a> if you are still about to go). It&#8217;s a world famous conference that is held in San Francisco, California. This year isn&#8217;t an exception. Today was the first day of the largest ever <strong>Adobe MAX Conference</strong>. 5000 people have come to US in order to take part in this conference and this is the record. There isn&#8217;t any necessity to tell who these people are. We can simply call them Adobe Evangelists from all over the world.</p>
<p><span id="more-152"></span>As usual before the conference starts Adobe has represented its latest creation. Saying this we mean CS4 product launch. A lot of web developers still can&#8217;t come to senses. Though, some aspects were left behind the curtain: Flash – Flex – AIR to be exact; TERMO that has been announced last year and of course <strong>Flex 4 – GUMBO</strong> and etc. I think <strong>Adobe MAX Conference</strong> will help us find out when these and other Adobe&#8217;s products will be launched.</p>
<p>The main advantage of this conference is the ability to communicate with web developers. So you can take part in the conference by asking essential questions as well as watching presentations and listening to reports.</p>
<p align="center"><img src="http://www.flashmoto.com/wp-content/uploads/2008/11/coca-cola-hf.jpg" alt="Coca-Cola Happiness Factor" /></p>
<p>One of the world&#8217;s well known brand Coca-cola and the <strong>MAX 2008</strong> finalist  <a rel="nofollow" href="http://www.coca-cola.com/HF/index.jsp" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.coca-cola.com/HF/index.jsp?referer=');">Coca-Cola Happiness Factory website</a> is the best commercial creation ever made before. Which give a stimulus to shoot a <a rel="nofollow" href="http://www.youtube.com/watch?v=mM4VWBa1Lc8" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.youtube.com/watch?v=mM4VWBa1Lc8&amp;referer=');">film</a>!</p>
<p>Web developers from Europe and Asia are invited to visit Adobe MAX Conferences in Milan, Italy ( December 1- 4, 2008) and Tokyo, Japan (January 29-3, 2008). Don&#8217;t loose this chance if you aren&#8217;t in San Francisco now.</p>
<p>So let&#8217;s wait for the news, presentations and the latest Adobe developments. Who knows probably this Adobe MAX Conference will open all Adobe&#8217;s secrets …</p>
<p>&#8230; would <a title="Apple bite's Adobe" href="http://www.flashmoto.com/flash-software/apple-bite/">Apple bite Adobe</a> now?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashmoto.com/adobe/adobe-max-2008/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Apple&#8217;s Bite!</title>
		<link>http://www.flashmoto.com/flash-software/apple-bite/</link>
		<comments>http://www.flashmoto.com/flash-software/apple-bite/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 13:13:01 +0000</pubDate>
		<dc:creator>Difort</dc:creator>
		
		<category><![CDATA[Flash Software]]></category>

		<category><![CDATA[apple]]></category>

		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.flashmoto.com/?p=125</guid>
		<description><![CDATA[According to Steve Jobs Apple is ready to take a bite of Silicon Valley. Why does everyone think so? Currently Apple budget is for about $25 billion. Everyone wants to find the best way to invest their money. This wish is influenced by the economic crisis of 2008. So Apple isn’t an exception. 
“This downturn [...]]]></description>
			<content:encoded><![CDATA[<p><img style="padding: 8px; padding-left:0px; padding-right:15px;" src="http://www.flashmoto.com/wp-content/uploads/2008/11/apple-bite.jpg" alt="Apple Bite" align="left" />According to Steve Jobs Apple is ready to take a bite of Silicon Valley. Why does everyone think so? Currently Apple budget is for about $25 billion. Everyone wants to find the best way to invest their money. This wish is influenced by the economic crisis of 2008. So Apple isn’t an exception. </p>
<p>“This downturn may also present some extraordinary opportunities for companies that have the cash to take advantage of it,” Jobs said.</p>
<p>In the past, the vast majority of Apple acquisitions have been software-related so we could expect it would happen again.</p>
<p>What will be the next Steve’s creation?</p>
<p><span id="more-125"></span>The victim is Adobe. I know that everyone is talking about some iPhone development companies but I trust experts. Earlier this year it was announced that Adobe begins work on Flash player for iPhone. This information was announced at Adobe Town Hall press-conference.<br />
You may know that iPhone is the last smartphone that can’t play Flash content. Seems this problem will be solved in the nearest future because Apple is the third-largest mobile supplier in the word.</p>
<p>Though, there are some questions: What is the Apple’s next move? Will Steve Jobs buy a ready-made solution for his “baby” or the entire company?</p>
<p>So what we have now is: Apple+MacOS is one of the best platforms for developers (SUPERfast! 8-)),  the best video editing software - Final Cut PRO, Unity 3D (only on Mac).<br />
What should we expect in the nearest future?</p>
<p style="text-align: center;"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/apple-adobe.jpg" alt="Adobe new logo" /></p>
<p>Would Mac be the only choice for a developer?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashmoto.com/flash-software/apple-bite/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flex - San Jose conference</title>
		<link>http://www.flashmoto.com/flash-software/flex-san-jose-conference/</link>
		<comments>http://www.flashmoto.com/flash-software/flex-san-jose-conference/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 14:01:34 +0000</pubDate>
		<dc:creator>Difort</dc:creator>
		
		<category><![CDATA[Flash Software]]></category>

		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.flashmoto.com/?p=101</guid>
		<description><![CDATA[360&#124;Flex in San Jose is the most popular an well-known con devoted to Flex/AIR. It takes you to the deeps of Flex! That&#8217;s why when you see some names from the list of 360&#124;Flex be sure that this names know what they are speaking about if they are spelling words Flex &#38; AIR.
Anyway I won&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.360flex.com/" rel="nofollow" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.360flex.com/?referer=');">360|Flex</a> in San Jose is the most popular an well-known con devoted to Flex/AIR. It takes you to the deeps of Flex! That&#8217;s why when you see some names from the list of 360|Flex be sure that this names know what they are speaking about if they are spelling words Flex &amp; AIR.</p>
<p>Anyway I won&#8217;t take you long if you are interested in a 360|Flex reviews I suggest you to read this one:<br />
<a rel="nofollow" href="http://www.colettas.org/?p=175" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.colettas.org/?p=175&amp;referer=');">Dave of Buzzword fame</a> (2007 CON)<br />
<a rel="nofollow" href="http://dougmccune.com/blog/2008/03/01/my-360flex-writeup/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/dougmccune.com/blog/2008/03/01/my-360flex-writeup/?referer=');">Doug McCune</a> (2007 CON)<br />
<a rel="nofollow" href="http://polygeek.com/380_adobeflash_360flex-seattle-brain-dump" target="_blank" onclick="pageTracker._trackPageview('/outgoing/polygeek.com/380_adobeflash_360flex-seattle-brain-dump?referer=');">Our boy PolyGeek</a> (2007 CON)<br />
Straight to the point!</p>
<p>Here is some fantastic presentations that were contributed to Flex community by world leaders in Flex development.</p>
<p><span id="more-101"></span><strong>1. Learning Flex from Scratch (LFFS) by Flater &amp; Sheridan</strong> - <a rel="nofollow" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1743188601?src=mrss" target="_blank" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1743188601?src=mrss&amp;referer=');">presentation</a><br />
<strong>description:</strong> Adam Flater &amp; Scott Sheridan:  The Learning Flex from Scratch series on <a rel="nofollow" href="http://www.insideria.com/ adam_flater_and_scott_sheridan/" onclick="pageTracker._trackPageview('/outgoing/www.insideria.com/_adam_flater_and_scott_sheridan/?referer=');">Inside RIA</a> focused on a non-programmers journey into the world of Flex.</p>
<p><a rel="nofollow" target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1743188601?src=mrss" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1743188601?src=mrss&amp;referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/flex-con/1.jpg" alt="" /></a></p>
<p><strong>2. Using Item Renderers in Flex by Mary Mcdonald</strong> - <a target="_blank" rel="nofollow" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741212621?src=mrss" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741212621?src=mrss&amp;referer=');">presentation</a><br />
<strong>description</strong>: Discusses using item renderers and item editors in Flex to change the look of your data being displayed.  This session has plenty of examples!</p>
<p><a rel="nofollow" target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741212621?src=mrss" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741212621?src=mrss&amp;referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/flex-con/2.jpg" alt="" /></a></p>
<p><strong>3. Creating Flex Components by Jeffry Houser</strong> - <a target="_blank" rel="nofollow" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1740023445?src=mrss" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1740023445?src=mrss&amp;referer=');">presentation</a><br />
<strong>description</strong>: An introductory presentation on creating Flex Components.</p>
<p><a target="_blank" rel="nofollow" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1740023445?src=mrss" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1740023445?src=mrss&amp;referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/flex-con/3.jpg" alt="" /></a></p>
<p><strong>4.  Diving Deep w/ the Flex Component Lifecycle by Owen &amp; Umbaug</strong> - <a rel="nofollow" target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1743188617?src=mrss" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1743188617?src=mrss&amp;referer=');">presentation</a><br />
<strong>description</strong>: RJ Owen &amp; Brad Umbaugh:  In this session, Senior Developers RJ Owen and Brad Umbaugh will explore in depth exactly what happens every time a component is created and rendered in Flex.</p>
<p><a rel="nofollow" target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1743188617?src=mrss" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1743188617?src=mrss&amp;referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/flex-con/4.jpg" alt="" /></a></p>
<p><strong>5. Diving in the Data Binding Waters with Michael Labriola</strong> - <a target="_blank" rel="nofollow" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741212660?src=mrss" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741212660?src=mrss&amp;referer=');">presentation</a><br />
<strong>description</strong>: Just about everyone who uses Flex uses data binding. Now come learn what you are actually doing when you add those curly brackets to your application.</p>
<p><a target="_blank" rel="nofollow" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741212660?src=mrss" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741212660?src=mrss&amp;referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/flex-con/5.jpg" alt="" /></a></p>
<p><strong>6. E4X by Marc Bir</strong> - <a target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741160964?src=mrss" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741160964?src=mrss&amp;referer=');">presentation</a><br />
<strong>description</strong>: What is E4X? How do I use it? Why would I use it? When should I use it?</p>
<p><a target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741160964?src=mrss" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741160964?src=mrss&amp;referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/flex-con/6.jpg" alt="" /></a></p>
<p><strong>7. Creating Reusable Components by Ben Clinkinbeard</strong> - <a target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1738803361?src=mrss" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1738803361?src=mrss&amp;referer=');">presentation</a><br />
<strong>description</strong>: This session will talk about what to keep in mind when creating components that go beyond a single use.</p>
<p><a target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1738803361?src=mrss" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1738803361?src=mrss&amp;referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/flex-con/7.jpg" alt="" /></a></p>
<p><strong>8. Flex and Acrobat by Joel Geraci</strong> - <a target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1743188604?src=mrss" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1743188604?src=mrss&amp;referer=');">presentation</a><br />
<strong>description</strong>: This session will make you rethink everything you know (or think you know) about PDF.</p>
<p><a target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1743188604?src=mrss" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1743188604?src=mrss&amp;referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/flex-con/8.jpg" alt="" /></a></p>
<p><strong>9. Data Visualization and Dashboards by Thomas Gonzalez</strong> - <a target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741234046?src=mrss" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741234046?src=mrss&amp;referer=');">presentation</a><br />
<strong>description</strong>: This session discusses approaches and techniques to implementing Data Visualization and Dashboards within Flex 3.</p>
<p><a target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741234046?src=mrss" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741234046?src=mrss&amp;referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/flex-con/9.jpg" alt="" /></a></p>
<p><strong>10. High Definition Video &amp; Flex Hands On by Christopher Keeler</strong> - <a target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741160953?src=mrss" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741160953?src=mrss&amp;referer=');">presentation</a><br />
<strong>description</strong>: This session covers the tools and workflows you need to produce and stream great HD video in the Flash player and Flex.</p>
<p><a target="_blank" href="http://link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741160953?src=mrss" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/link.brightcove.com/services/link/bcpid1733261879/bclid1729365228/bctid1741160953?src=mrss&amp;referer=');"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/flex-con/10.jpg" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flashmoto.com/flash-software/flex-san-jose-conference/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Papervision 3D Flash Gallery Tutorial</title>
		<link>http://www.flashmoto.com/flash-galleries/papervision3d-flash-gallery-tutorial/</link>
		<comments>http://www.flashmoto.com/flash-galleries/papervision3d-flash-gallery-tutorial/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 06:46:03 +0000</pubDate>
		<dc:creator>Difort</dc:creator>
		
		<category><![CDATA[Flash Galleries]]></category>

		<category><![CDATA[Flash Software]]></category>

		<category><![CDATA[gallery]]></category>

		<category><![CDATA[papervision]]></category>

		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.flashmoto.com/?p=104</guid>
		<description><![CDATA[In our previous posts we have considered several examples of creating really cool Flash Galleries with the help of 3D. As promised, today I’ll try to explain fhow to make papervision gallery. At the end we’ll get something like this – awesome papervision flash gallery. Probably at this stage the gallery looks a bit unfinished, [...]]]></description>
			<content:encoded><![CDATA[<p>In our previous posts we have considered several examples of creating really cool Flash Galleries with the help of 3D. As promised, today I’ll try to explain fhow to make <a title="Papervision Gallery" href="http://www.flashmoto.com/flash-galleries/papervision-3d-flash-gallery">papervision gallery</a>. At the end we’ll get something like this – awesome <a href="http://www.flashmoto.com/wp-content/uploads/2008/11/papervision-gallery-project/index.html" target="_blank">papervision flash gallery</a>. Probably at this stage the gallery looks a bit unfinished, one would wish to add progress bars for the images, image names and descriptions, navigation buttons next &amp; previous, and etc. I’d like to cheer you up by saying it’s just the beginning. In this tutorial we’ll try to write the basics, that is to say an engine for our application. Over the next several steps we&#8217;ll add functionality to this gallery. Note we plan to write more tutorials based on this example.</p>
<p>In this tutorial we’ll try to build a 3D Flash Gallery using Papervison 3D. First of all I’d like to mention that the main aim of this article is passing through all stages of flash application development.  At the same time we would like to discuss all contradictory questions one may face while working with Papervision 3D.  More likely this tutorial will consist of several parts. Together with Papervision 3D library we’ll use <a rel="nofollow" href="http://osflash.org/tweener" target="_blank" onclick="pageTracker._trackPageview('/outgoing/osflash.org/tweener?referer=');">Tweener</a> for a better smooth animation and <a rel="nofollow" href="http://code.google.com/p/bulk-loader/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/bulk-loader/?referer=');">BulkLoader</a> for a better image preloading.</p>
<p>You’ll need this archive in order to through this tutorial. This archive includes all libraries and applications which are necessary for the final swf creation. Flash CS3 or Flex Builder to be exact. If you know what Flex SDK is and you work with its compiler this archive is really useful for you. There is a lot of information regarding Papervision 3d on the net. You can easily find tutorials which teach how to download and install Papervision 3d and other libraries, how to adjust classpaths, and etc. It’s beside our purpose. Simply download this archive. Note you can use its structure and libraries like a start point for the other projects.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/papervision-gallery-code.jpg" alt="Papervision3D gallery" /></p>
<p>Tutorial difficulty level: Basic-Intermediate. We suppose even those of you who are the beginners in Actionscript 3.0 will do this tutorial with awesome results.</p>
<p><span id="more-19"></span>If you still wish to download and install Papervision 3d by yourself these links may be useful for you: <a rel="nofollow" href="http://www.madvertices.com/2008/01/papervision-3d-training-videos.html" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.madvertices.com/2008/01/papervision-3d-training-videos.html?referer=');">Papervision 3D Training Videos</a> and <a rel="nofollow" href="http://archive.pv3d.org/?page_id=29" target="_blank" onclick="pageTracker._trackPageview('/outgoing/archive.pv3d.org/?page_id=29&amp;referer=');">PV3d 2.0 Tutorial List</a>. Having followed these links you can find a lot of interesting tutorials on this application and learn the way it works.</p>
<p>One more thing to mention: in this tutorial we deal with the second version of Papervision 3d. Note this version of Papervision 3d hasn’t been released yet.</p>
<p><strong>1. Initial configuration</strong></p>
<p>So, at the very beginning you should download <a href="http://www.flashmoto.com/wp-content/uploads/2008/11/papervision-gallery-project/galleryProject_final.zip">papervision gallery source</a> the archive which includes an initial project. Having unpacked the archive you should see the next file structure:<br />
<strong></strong></p>
<p style="padding-left: 30px;"><strong>src </strong>– all necessary “as” files such as Papervision3d, Tweener and BulkLoader will be stored here. These are the libraries we’ll use in order to create the gallery.  All the files we create will be added here as well. Gallery Project is a basic class which is used as Document Class in Flash CS3 and it’s being compiled while creating swf file.  So I’ve put it into root. The other files we create for this project will be stored here  com/flashmoto/gallery.</p>
<p style="padding-left: 30px;"><strong>fla </strong>– this folder will include fla files. It already includes GalleryProject.fla with changed settings: the folder ../src is added to classpath, Document Class is GalleryProject.as<br />
<strong></strong></p>
<p style="padding-left: 30px;"><strong>bin </strong>– the application called GalleryProject.swf is stored here. All xml files and images that make an application work are kept here as well. Saving your time I’ve already created an xml file with images data. All images are stores in images folder.</p>
<p>For the beginning let’s start compiling the application. As I’ve already mentioned there are two ways of compilation: using Flash CS3 and on your own (means using Flex SDK compiler). As a rule experienced users apply Flex SDK compiler while creating Flash movies. They definitely know what one should do with the source code in order to get a working swf. So I’ll describe how you can compile movie in Flash CS3.  To do so I should run GalleryProject.fla from the fla folder and compile the movie having clicked Ctrl+Enter. In the flash output panel you should see something like this - Welcome to our 3D gallery!</p>
<p style="text-align: center;"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/papervision-gallery-01.jpg" alt="Papervision3D gallery" /></p>
<p><strong>2. Problem Description</strong></p>
<p>Let’s build a gallery by following our step-by -step guide. First of all we should decide what to do. So our main tasks are:</p>
<p style="padding-left: 30px;">-  Application Initialization<br />
-  Application Initialization<br />
-  Loading XML Data<br />
-  Loading Images<br />
-  3D Engine Initialization<br />
-  3D Objects Creation<br />
-  Adding Objects to the Stage<br />
-  Adding Interactivity</p>
<p><strong>3. Application Initialization</strong></p>
<p>Let’s open file named src/GalleryProject.as. If you’ve noticed it is set as the Document Class in publish settings of the fla file. So the code which is inside GalleryProject functon (constructor) runs after the application has been launched. As for the start let’s set some stage properties - align and scaleMode.</p>
<div class="codecolorer-container actionscript"><div class="codecolorer" style="font-family: monospace;">package<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">display</span>.<span class="me1">Sprite</span>;<br />
&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">display</span>.<span class="me1">StageAlign</span>;<br />
&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">display</span>.<span class="me1">StageScaleMode</span>;<br />
<br />
&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">class</span> GalleryProject <span class="kw3">extends</span> Sprite<br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> GalleryProject<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Set some stage properties</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">stage</span>.<span class="kw3">align</span> = StageAlign.<span class="me1">TOP</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">stage</span>.<span class="kw3">scaleMode</span> = StageScaleMode.<span class="me1">NO_SCALE</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div></div>
<p>Now we should create another class that will be responsible for gallery creation. It’s the right approach if we want to use it for any of our future applications. Considering the fact that it’ll be an ordinary Sprite we can add it anywhere using addChild() method. We can also change different parameters for its positioning.</p>
<p>Let’s create class called Gallery.as in the src/com/flashmoto/gallery folder. At first it will look this way.</p>
<div class="codecolorer-container actionscript"><div class="codecolorer" style="font-family: monospace;">package com.<span class="me1">flashmoto</span>.<span class="me1">gallery</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">class</span> Gallery <span class="kw3">extends</span> Sprite<br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Gallery Constructor<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> Gallery<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div></div>
<p>And we can now add the gallery to our application. To accomplish this we should add some lines to our main file called GalleryProject.as:</p>
<div class="codecolorer-container actionscript"><div class="codecolorer" style="font-family: monospace;">package<br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw3">import</span> com.<span class="me1">flashmoto</span>.<span class="me1">gallery</span>.<span class="me1">Gallery</span>;<br />
&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">display</span>.<span class="me1">Sprite</span>;<br />
&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">display</span>.<span class="me1">StageAlign</span>;<br />
&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">display</span>.<span class="me1">StageScaleMode</span>;<br />
&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">class</span> GalleryProject <span class="kw3">extends</span> Sprite<br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> GalleryProject<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Set some stage properties</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">stage</span>.<span class="kw3">align</span> = StageAlign.<span class="me1">TOP</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">stage</span>.<span class="kw3">scaleMode</span> = StageScaleMode.<span class="me1">NO_SCALE</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create gallery</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> gallery:Gallery = <span class="kw2">new</span> Gallery<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span class="br0">&#40;</span> gallery <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div></div>
<p>All changes are marked with bold type. I always dislike when tutorials which include source code write new lines or code changes separately from the whole class which requires these changes.) It’s always confusing and time taking process to deal with such code. I prefer using more traffic but seeing how the source code receives new functions and expressions with every step I make.</p>
<p>In order to use Gallery class we need to import it first. If you want to make sure that the code is working and the gallery has been really added you can write trace (&#8217;This is your gallery&#8217;) into the gallery class constructor and you’ll see this message in the flash output panel.<br />
Ok, let’s go to the next stage.</p>
<p><strong>4.  Loading XML Data</strong></p>
<p>Now we should get information regarding images and where they should be taken from for download. Of course there is a simpler way to define them as constants directly in our code. Though, this way isn’t very flexible. So all information will be stored in XML file. (If you want to read more about this format you should read <a rel="nofollow" href="http://en.wikipedia.org/wiki/XML" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/XML?referer=');">Wiki</a>! <img src='http://www.flashmoto.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ). At the fist stage all we need is an image file path. So XML file will look like this. (Finished file can be found here: xml/gallery.xml)</p>
<p style="text-align: center;"><img class="aligncenter" src="http://www.flashmoto.com/wp-content/uploads/2008/11/papervision-gallery-02.jpg" alt="Papervision 3D gallery" /></p>
<p>For xml file and images loading I’ll use <a rel="nofollow" href="http://code.google.com/p/bulk-loader/" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/bulk-loader/?referer=');">BulkLoader</a>. Let’s add a few function called loadImagesData() which will be called from the Gallery constructor. In this function we’ll initialize a new loader. Having added our xml file to this loader we’ll start to load images and listen for the loader’s progress, complete and error events. After you make the changes the class will look like this. As you’ve probably noticed a lot of new features and functions has appeared. I did my best to write the comprehensive comments for each feature and function, and in front of every line. So I don’t think it’s necessary to describe them in a more detailed way. Just have a look at the code we’ve created.</p>
<div class="codecolorer-container actionscript" style="height:280px;"><div class="codecolorer" style="font-family: monospace;">package com.<span class="me1">flashmoto</span>.<span class="me1">gallery</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw3">import</span> br.<span class="me1">com</span>.<span class="me1">stimuli</span>.<span class="me1">loading</span>.<span class="me1">BulkErrorEvent</span>;<br />
&nbsp; &nbsp; <span class="kw3">import</span> br.<span class="me1">com</span>.<span class="me1">stimuli</span>.<span class="me1">loading</span>.<span class="me1">BulkLoader</span>;<br />
&nbsp; &nbsp; <span class="kw3">import</span> br.<span class="me1">com</span>.<span class="me1">stimuli</span>.<span class="me1">loading</span>.<span class="me1">BulkProgressEvent</span>;<br />
<br />
&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">display</span>.<span class="me1">Sprite</span>;<br />
&nbsp; &nbsp; <span class="kw3">import</span> flash.<span class="me1">events</span>.<span class="me1">Event</span>;<br />
<br />
&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">class</span> Gallery <span class="kw3">extends</span> Sprite<br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Loader for the gallery xml and gallery images<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> loader:BulkLoader;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Collection of images urls<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> galleryImagesCollection:<span class="kw3">Array</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Flag that indicates if xml is loaded<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _galleryXMLLoaded:<span class="kw3">Boolean</span> = <span class="kw2">false</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Path to the gallery xml file<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw3">static</span> const GALLERY_XML:<span class="kw3">String</span> = <span class="st0">'xml/gallery.xml'</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Gallery Constructor<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> Gallery<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Load images data</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loadImagesData<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Loads images data from xml file.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> loadImagesData<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create new loader</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader = <span class="kw2">new</span> BulkLoader<span class="br0">&#40;</span> <span class="st0">'galleryLoader'</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Loader events</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.<span class="me1">addEventListener</span><span class="br0">&#40;</span>BulkLoader.<span class="me1">COMPLETE</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onGalleryLoaded<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.<span class="me1">addEventListener</span><span class="br0">&#40;</span>BulkLoader.<span class="me1">PROGRESS</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onGalleryLoadingProgress<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.<span class="me1">addEventListener</span><span class="br0">&#40;</span>BulkErrorEvent.<span class="kw3">ERROR</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onGalleryLoadingError<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Add gallery xml to the quenue</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.<span class="kw3">add</span><span class="br0">&#40;</span> GALLERY_XML <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Start loading</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.<span class="kw3">start</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Parses gallery xml file and starts images loading process.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoaded<span class="br0">&#40;</span> event:Event <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Start loading images</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Shows loader progress info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoadingProgress<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event:BulkProgressEvent <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Show gallery xml loading progress</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span> <span class="st0">'Loading XML: '</span> + event.<span class="me1">percentLoaded*</span><span class="nu0">100</span> + <span class="st0">'%'</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Shows loader error info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoadingError<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event:BulkErrorEvent <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span> <span class="st0">'ERROR: Data xml loading failed.'</span> <span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div></div>
<p><strong>5. Loading Images</strong></p>
<p>Now we have all image files paths. So we can load images. We have two variants to load images – loading all the images and then adding them to the stage or making the user tired showing a procedure of image load.  For the beginning we’ll follow an easier way and choose the first variant. We’ll add several lines to the methods we already have. Now we should parse loaded xml, choose image file paths and upload the images. Loading status information can be received via onGalleryLoadingProgress method. At this very stage I’ve simply traced this information to the output panel.</p>
<div class="codecolorer-container actionscript" style="height:280px;"><div class="codecolorer" style="font-family: monospace;">package com.<span class="me1">flashmoto</span>.<span class="me1">gallery</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">// Import statements ...</span><br />
<br />
&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">class</span> Gallery <span class="kw3">extends</span> Sprite<br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Loader for the gallery xml and gallery images<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> loader:BulkLoader;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Collection of images urls<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> galleryImagesCollection:<span class="kw3">Array</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Flag that indicates if xml is loaded<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _galleryXMLLoaded:<span class="kw3">Boolean</span> = <span class="kw2">false</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Path to the gallery xml file<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw3">static</span> const GALLERY_XML:<span class="kw3">String</span> = <span class="st0">'xml/gallery.xml'</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Gallery Constructor<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> Gallery<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Load images data</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loadImagesData<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Loads images data from xml file.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> loadImagesData<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Parses gallery xml file and starts images loading process.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoaded<span class="br0">&#40;</span> event:Event <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> !_galleryXMLLoaded <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Parse loaded gallery xml</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryImagesCollection = <span class="kw2">new</span> <span class="kw3">Array</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> galleryImagesData:<span class="kw3">XML</span> = loader.<span class="me1">getXML</span><span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GALLERY_XML, <span class="kw2">true</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> each <span class="br0">&#40;</span> <span class="kw2">var</span> image:<span class="kw3">XML</span> <span class="kw1">in</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryImagesData.<span class="me1">elements</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> imageSrc:<span class="kw3">String</span> = image.@src.<span class="kw3">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> imageSrc &amp;&amp; imageSrc.<span class="kw3">length</span> &gt; <span class="nu0">0</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryImagesCollection.<span class="kw3">push</span><span class="br0">&#40;</span> imageSrc <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.<span class="kw3">add</span><span class="br0">&#40;</span> imageSrc <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _galleryXMLLoaded = <span class="kw2">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Start loading images</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.<span class="kw3">start</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// TODO: Init 3D components</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Shows loader progress info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoadingProgress<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event:BulkProgressEvent <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> !_galleryXMLLoaded <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Show gallery xml loading progress</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span> <span class="st0">'Loading XML: '</span> +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event.<span class="me1">percentLoaded*</span><span class="nu0">100</span> + <span class="st0">'%'</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Show images loading progress</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span> <span class="st0">'Loading image: '</span> + event.<span class="me1">itemsLoaded</span> + <span class="st0">'/'</span> +<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event.<span class="me1">itemsTotal</span> + <span class="st0">',<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '</span> + event.<span class="me1">percentLoaded*</span><span class="nu0">100</span> + <span class="st0">'%'</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Shows loader error info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoadingError<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event:BulkErrorEvent <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> !_galleryXMLLoaded <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span> <span class="st0">'ERROR: Data xml loading failed.'</span> <span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">trace</span><span class="br0">&#40;</span> <span class="st0">'ERROR: Images loading failed.'</span> <span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div></div>
<p>So we are close to Papervision3d. Let’s start…</p>
<p><strong>6.  3D Engine Initialization</strong></p>
<p>In order to use Papervision3d while moving objects in 3d space we should initialize 3D engine first and create all necessary components such as viewport, camera, scene and renderer. Let’s write a new function called init3DEngine(). We’ll write a new function named init3DEngine() which will be called in onGalleryLoaded() method after the download has been finished.<span style="text-decoration: underline;"> </span></p>
<div class="codecolorer-container actionscript" style="height:280px;"><div class="codecolorer" style="font-family: monospace;">package com.<span class="me1">flashmoto</span>.<span class="me1">gallery</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">// Import statements ...</span><br />
<br />
&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">class</span> Gallery <span class="kw3">extends</span> Sprite<br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Loader for the gallery xml and gallery images<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> loader:BulkLoader;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Papervision3d components - Viewport<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> viewport:Viewport3D;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Papervision3d components - Scene<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> scene:Scene3D;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Papervision3d components - Camera<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> <span class="kw3">camera</span>:Camera3D;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Papervision3d components - BasicRenderEngine<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> renderer:BasicRenderEngine;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Collection of images urls<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> galleryImagesCollection:<span class="kw3">Array</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Flag that indicates if xml is loaded<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _galleryXMLLoaded:<span class="kw3">Boolean</span> = <span class="kw2">false</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Path to the gallery xml file<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw3">static</span> const GALLERY_XML:<span class="kw3">String</span> = <span class="st0">'xml/gallery.xml'</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Viewport width<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw3">static</span> const VIEWPORT_WIDTH:<span class="kw3">Number</span> = <span class="nu0">800</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Viewport&nbsp; height<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw3">static</span> const VIEWPORT_HEIGHT:<span class="kw3">Number</span> = <span class="nu0">800</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Gallery Constructor<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> Gallery<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Load images data</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loadImagesData<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Loads images data from xml file.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> loadImagesData<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Parses gallery xml file and starts images loading process.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoaded<span class="br0">&#40;</span> event:Event <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> !_galleryXMLLoaded <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Parse loaded gallery xml</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryImagesCollection = <span class="kw2">new</span> <span class="kw3">Array</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> galleryImagesData:<span class="kw3">XML</span> = loader.<span class="me1">getXML</span><span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GALLERY_XML, <span class="kw2">true</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> each <span class="br0">&#40;</span> <span class="kw2">var</span> image:<span class="kw3">XML</span> <span class="kw1">in</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryImagesData.<span class="me1">elements</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> imageSrc:<span class="kw3">String</span> = image.@src.<span class="kw3">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> imageSrc &amp;&amp; imageSrc.<span class="kw3">length</span> &gt; <span class="nu0">0</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryImagesCollection.<span class="kw3">push</span><span class="br0">&#40;</span> imageSrc <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.<span class="kw3">add</span><span class="br0">&#40;</span> imageSrc <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _galleryXMLLoaded = <span class="kw2">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Start loading images</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loader.<span class="kw3">start</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Init 3D components</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; init3DEngine<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Shows loader progress info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoadingProgress<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event:BulkProgressEvent <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Shows loader error info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoadingError<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event:BulkErrorEvent <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Inits 3D engine. Creates viewport, scene, camera and<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* renderer and also creates and adds scene objects.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Creates event listener for the enter frame event for<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* the scene rendering.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> init3DEngine<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create viewport</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewport = <span class="kw2">new</span> Viewport3D<span class="br0">&#40;</span> VIEWPORT_WIDTH,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VIEWPORT_HEIGHT, <span class="kw2">false</span>, <span class="kw2">true</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span class="br0">&#40;</span> viewport <span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create scene</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scene = <span class="kw2">new</span> Scene3D<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create camera and set its zoom and focus</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">camera</span> = <span class="kw2">new</span> Camera3D<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">camera</span>.<span class="me1">zoom</span> = <span class="nu0">5</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">camera</span>.<span class="me1">focus</span> = <span class="nu0">100</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create BasicRenderEngine</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renderer = <span class="kw2">new</span> BasicRenderEngine<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div></div>
<p>As you can see some new features including two constants such as VIEWPORT_WIDTH and VIEWPORT_HEIGHT have been added. These constants define render area. Seems it would be better to define them while creating Gallery object. I think we’ll correct it a bit later. The case is that at this stage we have the other tasks. The same relates to other engine configurations such as camera zoom and focus, viewport scaling and interactivity. It would be better to change them dynamically from an external text file. I think we’ll do it for sure.</p>
<p><strong>7.  3D Objects Creation</strong></p>
<p>Now we should create objects in order to add them to the stage. Of course we could add them at once. It would make the code simpler but we’ll not go this way. One should understand that the application gains its flexibility thanks to dynamic object placement. So I recommend separating these two actions from the very beginning.  At first we’ll create objects and then set their positions. For this we should update our class a little bit:</p>
<div class="codecolorer-container actionscript" style="height:280px;"><div class="codecolorer" style="font-family: monospace;">package com.<span class="me1">flashmoto</span>.<span class="me1">gallery</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">// Import statements ...</span><br />
<br />
&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">class</span> Gallery <span class="kw3">extends</span> Sprite<br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ...<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Collection of images urls<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> galleryImagesCollection:<span class="kw3">Array</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Collection of gallery planes to be added to the scene<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> galleryPlanesCollection:<span class="kw3">Array</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Flag that indicates if xml is loaded<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _galleryXMLLoaded:<span class="kw3">Boolean</span> = <span class="kw2">false</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Gallery Constructor<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> Gallery<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Load images data</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loadImagesData<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Loads images data from xml file.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> loadImagesData<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Parses gallery xml file and starts images loading process.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoaded<span class="br0">&#40;</span> event:Event <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Shows loader progress info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoadingProgress<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event:BulkProgressEvent <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Shows loader error info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoadingError<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event:BulkErrorEvent <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Inits 3D engine. Creates viewport, scene, camera and<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* renderer and also creates and adds scene objects.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Creates event listener for the enter frame event for<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* the scene rendering.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> init3DEngine<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create viewport</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewport = <span class="kw2">new</span> Viewport3D<span class="br0">&#40;</span> VIEWPORT_WIDTH,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VIEWPORT_HEIGHT, <span class="kw2">false</span>, <span class="kw2">true</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span class="br0">&#40;</span> viewport <span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create scene</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scene = <span class="kw2">new</span> Scene3D<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create camera and set its zoom and focus</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">camera</span> = <span class="kw2">new</span> Camera3D<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">camera</span>.<span class="me1">zoom</span> = <span class="nu0">5</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">camera</span>.<span class="me1">focus</span> = <span class="nu0">100</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create BasicRenderEngine</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renderer = <span class="kw2">new</span> BasicRenderEngine<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create Gallery Planes</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createGalleryImages<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Creates display objects from loaded images and updates<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* gallery objects collection.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> createGalleryImages<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryPlanesCollection = <span class="kw2">new</span> <span class="kw3">Array</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Go through all images and create planes</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span><span class="br0">&#40;</span> <span class="kw2">var</span> i:uint=<span class="nu0">0</span>; i&lt;galleryImagesCollection.<span class="kw3">length</span>; i++ <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> galleryPlane:DisplayObject3D =<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createGalleryDisplayObject<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryImagesCollection<span class="br0">&#91;</span>i<span class="br0">&#93;</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Add plane to collection</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryPlanesCollection.<span class="kw3">push</span><span class="br0">&#40;</span> galleryPlane <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Creates gallery 3D object using loaded image bitmap.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* The method returns DisplayObject3D object, and gallery<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* do not need to know if there is a plane, cube or sphere,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* so later I can rewrite this method to create any objects<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* needed.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> createGalleryDisplayObject<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image:<span class="kw3">String</span> <span class="br0">&#41;</span>:DisplayObject3D<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Get loaded image bitmap using loader getBitmap method</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> bitmap:Bitmap = loader.<span class="me1">getBitmap</span><span class="br0">&#40;</span> image <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> bitmapHolder:Sprite = <span class="kw2">new</span> Sprite<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bitmapHolder.<span class="me1">addChild</span><span class="br0">&#40;</span> bitmap <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create movie material for the plane</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> material:MovieMaterial =<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">new</span> MovieMaterial<span class="br0">&#40;</span>bitmapHolder<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Use new material rect property to crop image if it is</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// larger that plane's dimensions</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; material.<span class="me1">rect</span> = <span class="kw2">new</span> Rectangle<span class="br0">&#40;</span> <span class="nu0">0</span>, <span class="nu0">0</span>, GALLERY_PLANE_WIDTH,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GALLERY_PLANE_HEIGHT <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Make material double sided and interactive</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; material.<span class="me1">doubleSided</span> = <span class="kw2">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; material.<span class="me1">interactive</span> = <span class="kw2">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create and return plane</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">new</span> Plane<span class="br0">&#40;</span> material, GALLERY_PLANE_WIDTH,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GALLERY_PLANE_HEIGHT, GALLERY_PLANE_SEGMENTS_W,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GALLERY_PLANE_SEGMENTS_H <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div></div>
<p>As you see a method called createGalleryDisplayObject() creates a 3D object and this objects isn’t for sure a Plane. It can be any object. So in a case we wish to draw spheres instead of planes we’ll basically have to rewrite this method.</p>
<p><strong>8. Adding Objects to the Stage</strong></p>
<p>As I’ve already mentioned I comment the code without explaining what should be done and how to do it because our code already goes with comprehensive comments. Almost every code line has its own description. So read the code attentively and comment this tutorial in a case you have any questions. I’ll be more than happy to answer your questions.</p>
<p>So we have a collection of 3D objects which can be added to the stage and placed in a way we wish. In the future I plan to update this example in order to develop several image placement strategies. So we could dynamically change the gallery appearance. At the first stage you can see the first variant: I’ve placed images one by one. Let’s add new method called addGalleryImages()</p>
<div class="codecolorer-container actionscript" style="height:280px;"><div class="codecolorer" style="font-family: monospace;">package com.<span class="me1">flashmoto</span>.<span class="me1">gallery</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">// Import statements ...</span><br />
<br />
&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">class</span> Gallery <span class="kw3">extends</span> Sprite<br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ...<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Collection of gallery planes to be added to the scene<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> galleryPlanesCollection:<span class="kw3">Array</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Collection of scene gallery planes<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">var</span> galleryPlanes:<span class="kw3">Array</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Flag that indicates if xml is loaded<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _galleryXMLLoaded:<span class="kw3">Boolean</span> = <span class="kw2">false</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Holder for the gallery planes<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _planesHolder:DisplayObject3D;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Path to the gallery xml file<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw3">static</span> const GALLERY_XML:<span class="kw3">String</span> = <span class="st0">'xml/gallery.xml'</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; ...<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Gallery Constructor<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> Gallery<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Load images data</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loadImagesData<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Loads images data from xml file.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> loadImagesData<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Parses gallery xml file and starts images loading process.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoaded<span class="br0">&#40;</span> event:Event <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Shows loader progress info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoadingProgress<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event:BulkProgressEvent <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Shows loader error info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoadingError<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event:BulkErrorEvent <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Inits 3D engine. Creates viewport, scene, camera and<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* renderer and also creates and adds scene objects.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Creates event listener for the enter frame event for<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* the scene rendering.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> init3DEngine<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create viewport</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewport = <span class="kw2">new</span> Viewport3D<span class="br0">&#40;</span> VIEWPORT_WIDTH,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VIEWPORT_HEIGHT, <span class="kw2">false</span>, <span class="kw2">true</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span class="br0">&#40;</span> viewport <span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create scene</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scene = <span class="kw2">new</span> Scene3D<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create camera and set its zoom and focus</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">camera</span> = <span class="kw2">new</span> Camera3D<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">camera</span>.<span class="me1">zoom</span> = <span class="nu0">5</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">camera</span>.<span class="me1">focus</span> = <span class="nu0">100</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create BasicRenderEngine</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renderer = <span class="kw2">new</span> BasicRenderEngine<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create Gallery Planes</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createGalleryImages<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Add Gallery Planes to the scene</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;addGalleryImages<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Creates display objects from loaded images and updates<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* gallery objects collection.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> createGalleryImages<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Creates gallery 3D object using loaded image bitmap.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* The method returns DisplayObject3D object, and gallery<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* do not need to know if there is a plane, cube or sphere,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* so later I can rewrite this method to create any objects<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* needed.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> createGalleryDisplayObject<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image:<span class="kw3">String</span> <span class="br0">&#41;</span>:DisplayObject3D<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Adds gallery display objects to the scene and arranges<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* them. Later I will add more arrangent strategies to<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* this application, and all I need to do is to update<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* this method which will get the stategy name as<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* parameter.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> addGalleryImages<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create holder for the gallery objects</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _planesHolder = <span class="kw2">new</span> DisplayObject3D<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scene.<span class="me1">addChild</span><span class="br0">&#40;</span> _planesHolder <span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryPlanes = <span class="kw2">new</span> <span class="kw3">Array</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Add gallery planes</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> flag:<span class="kw3">int</span> = <span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span><span class="br0">&#40;</span> <span class="kw2">var</span> i:uint=<span class="nu0">0</span>; i&lt;galleryPlanesCollection.<span class="kw3">length</span>; i++ <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> galleryPlane:Plane = galleryPlanesCollection<span class="br0">&#91;</span>i<span class="br0">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; as Plane;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryPlane.<span class="me1">z</span> = _firstPlaneZ + i*<span class="nu0">200</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryPlane.<span class="me1">x</span> = <span class="nu0">5000</span>*flag;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryPlanes.<span class="kw3">push</span><span class="br0">&#40;</span>_planesHolder.<span class="me1">addChild</span><span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; galleryPlane<span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flag *= <span class="nu0">-1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tweener.<span class="me1">addTween</span><span class="br0">&#40;</span> galleryPlane, <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x: <span class="nu0">0</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">time</span>:<span class="nu0">2</span>*<span class="br0">&#40;</span>galleryPlanesCollection.<span class="me1">length</span>-i<span class="br0">&#41;</span>/<span class="nu0">20</span><span class="nu0">+1</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; transition:<span class="st0">&quot;easeOutBack&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div></div>
<p><br/><br />
<strong>9. Adding Interactivity</strong></p>
<p>The last thing that should be added is interactivity. Seems it should be described in detail.</p>
<p>The first thing you should do to see the objects that have been added to the stage is rendering the stage. In Papervision3d you can do it with this code</p>
<div class="codecolorer-container actionscript" style="height:35px;"><div class="codecolorer" style="font-family: monospace;">renderer.<span class="me1">renderScene</span><span class="br0">&#40;</span> scene, <span class="kw3">camera</span>, viewport <span class="br0">&#41;</span>;</div></div>
<p>as you see all 3D engine elements are activated in this code. Having executed this code you’ll see what is added to your stage. However you should remember one thing - without calling this method you won&#8217;t see such changes as:</p>
<p style="padding-left: 30px;">- changing object location or object properties;<br />
- changing camera position or rotation;<br />
- refreshing something.</p>
<p>Basically it’s called on every onEnterFrame event, but it’s sometimes difficult for browser to accomplish this. Especially if you have a lot of objects and refining or you need fast rendering and good quality graphics.) So Flash developers find various ways to optimize the application. Having analyzed different requirements they define if a stage should be rendered at the moment or not. If to speak about our example the stage should be rendered every moment because our main aim is camera and mouse interaction. So we should continually refresh the image. In the future I’ll add a requirement to avoid such rendering. For instance in a case we’ve clicked the first image and it has been enlarged.</p>
<p>Papervision uses InteractiveScene3DEvent in order to respond to such mouse events as hitting, pointing and tracking. Note if you want these events work the object material and viewpoint should be interactive.</p>
<p>Material has an interactive feature to accomplish this</p>
<div class="codecolorer-container actionscript" style="height:35px;"><div class="codecolorer" style="font-family: monospace;">material.<span class="me1">interactive</span> = <span class="kw2">true</span>;</div></div>
<p>Viewport has this feature as well. We set its value while creating – the 4th parameter = true</p>
<div class="codecolorer-container actionscript" style="height:35px;"><div class="codecolorer" style="font-family: monospace;">viewport = <span class="kw2">new</span> Viewport3D<span class="br0">&#40;</span>VIEWPORT_WIDTH, VIEWPORT_HEIGHT, <span class="kw2">false</span>, <span class="kw2">true</span><span class="br0">&#41;</span>;</div></div>
<p>Of course adding interactivity isn’t limited to listening for the mouse events only. It also includes response to these events. This is the way logic is added to the code. Note logic is an inseparable part of the application.</p>
<p>It’s time for the most interesting part which can be difficult for an ordinary animator. So this part is usually done by a Flash programmer. Considering the fact that our tutorial relates to Papervision 3d I suggest you to explore application logic by yourself. Note all application logic is described in event listener handlers such as onPlanePress(), onPlaneOver(), onPlaneOut(). Camera moving logic is described in render() method.</p>
<p>Here is the final code. Let’s try to compile it. You should succeed!</p>
<div class="codecolorer-container actionscript" style="height:280px;"><div class="codecolorer" style="font-family: monospace;">package com.<span class="me1">flashmoto</span>.<span class="me1">gallery</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">// Import statements ...</span><br />
<br />
&nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">class</span> Gallery <span class="kw3">extends</span> Sprite<br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ...<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Holder for the gallery planes<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _planesHolder:DisplayObject3D;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Flag that indicates zoomed image state<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _imageZoomed:<span class="kw3">Boolean</span> = <span class="kw2">false</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Current plane ( first in the line ) index<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _currentPlaneIndex:uint = <span class="nu0">0</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* First plane z coordinate, planes shift<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _firstPlaneZ:<span class="kw3">Number</span> = <span class="nu0">0</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Flag that indicates if planes are moving<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">var</span> _planesAreMoving:<span class="kw3">Boolean</span> = <span class="kw2">false</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; * Path to the gallery xml file<br />
&nbsp; &nbsp; &nbsp; &nbsp; */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span class="kw3">public</span> <span class="kw3">static</span> const GALLERY_XML:<span class="kw3">String</span> = <span class="st0">'xml/gallery.xml'</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; ...<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Gallery Constructor<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">public</span> <span class="kw2">function</span> Gallery<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Load images data</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loadImagesData<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Loads images data from xml file.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> loadImagesData<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Parses gallery xml file and starts images loading process.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoaded<span class="br0">&#40;</span> event:Event <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Shows loader progress info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoadingProgress<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event:BulkProgressEvent <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Shows loader error info.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> onGalleryLoadingError<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event:BulkErrorEvent <span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Inits 3D engine. Creates viewport, scene, camera and<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* renderer and also creates and adds scene objects.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Creates event listener for the enter frame event for<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* the scene rendering.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">private</span> <span class="kw2">function</span> init3DEngine<span class="br0">&#40;</span><span class="br0">&#41;</span>:<span class="kw3">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create viewport</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewport = <span class="kw2">new</span> Viewport3D<span class="br0">&#40;</span> VIEWPORT_WIDTH,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VIEWPORT_HEIGHT, <span class="kw2">false</span>, <span class="kw2">true</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span class="br0">&#40;</span> viewport <span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create scene</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scene = <span class="kw2">new</span> Scene3D<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create camera and set its zoom and focus</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">camera</span> = <span class="kw2">new</span> Camera3D<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">camera</span>.<span class="me1">zoom</span> = <span class="nu0">5</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">camera</span>.<span class="me1">focus</span> = <span class="nu0">100</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create BasicRenderEngine</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renderer = <span class="kw2">new</span> BasicRenderEngine<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Create Gallery Planes</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createGalleryImages<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Add Gallery Planes to the scene</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addGalleryImages<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Render the scene every enter frame</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addEventListener<span class="br0">&#40;</span> Event.<span class="me1">ENTER_FRAME</span>, render <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; 