<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>4r Web Solutions Blog</title>
	<atom:link href="http://www.blog.4rwebsolutions.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blog.4rwebsolutions.com</link>
	<description></description>
	<lastBuildDate>Fri, 07 Jan 2011 14:19:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Zoom Into Your Own Canvas of Content</title>
		<link>http://www.blog.4rwebsolutions.com/2011/01/zoom-into-your-own-canvas-of-content/</link>
		<comments>http://www.blog.4rwebsolutions.com/2011/01/zoom-into-your-own-canvas-of-content/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 14:19:49 +0000</pubDate>
		<dc:creator>4rwebsolutions</dc:creator>
				<category><![CDATA[PoSt]]></category>

		<guid isPermaLink="false">http://www.blog.4rwebsolutions.com/?p=526</guid>
		<description><![CDATA[Source: http://bit.ly/eChBJX Some paintings require you take a closer look to see all the details. Now instead of a painting, imagine a blank canvas that can be filled with images and text and dynamic descriptions. Note: This tutorial has nothing to do with the HTML5 canvas element! The demo is a viewer application that loads [...]]]></description>
			<content:encoded><![CDATA[<p>Source: http://bit.ly/eChBJX</p>
<p>Some paintings require you take a closer look to see all the details.  Now instead of a painting, imagine a blank canvas that can be filled  with images and text and dynamic descriptions.</p>
<p><em><strong>Note:</strong> This tutorial has nothing to do with the HTML5 canvas element!</em></p>
<hr />The demo is a viewer application that loads its data from XML.  Content is placed on the &#8220;canvas&#8221; and the user can zoom into the canvas  or click on any of the images to center it on the screen. Settings such  as page size, background color/texture and other settings are loaded  dynamically. As a bonus the user can create multiple pages.</p>
<p>In this tutorial we will be looking at the basic concepts of creating  an application like this. It is advisable to keep the source code next  to you while reading the tutorial because not every part is explained.  Source code is available for use with <a href="http://www.flashdevelop.org/">FlashDevelop</a> or with Flash CS3 Professional and higher.</p>
<hr />
<h2>Note: Opening the Application Locally</h2>
<p>Please be aware that before trying to open the application from your  hard disk, you will need to have it added to the “trusted locations”  list specified in the Global Security Settings panel shown below.  Otherwise, no access is granted to grab the images from your hard disk.  This is not needed when uploaded to a website as long as the images are  located on the same web server.</p>
<div><img src="http://d2fhka9tf2vaj2.cloudfront.net/tuts/222_canvasApp/tutorial/img0.jpg" alt="Global Security Settings panel" /></div>
<hr />
<h2>Step 1: Setting up the XML file</h2>
<p>In case you are unfamiliar with XML, check out Dru Kepple’s <a href="http://active.tutsplus.com/tutorials/actionscript/as3-101xml/">AS3 101: XML</a>.  Shown below is the XML data corresponding to one page filled with one  image and one text field. Settings specified here apply to all pages. As  you can see, creating multiple pages and adding content to them is made  easy. To images you can add a title and description which is seen when  hovered over with the mouse. Multi-line text  be added  and size and  style can be customized. Every text field uses a custom font found in  the .fla file.</p>
<div>
<div id="highlighter_452852">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
<div>18</div>
<div>19</div>
<div>20</div>
<div>21</div>
<div>22</div>
<div>23</div>
<div>24</div>
<div>25</div>
<div>26</div>
<div>27</div>
<div>28</div>
<div>29</div>
<div>30</div>
<div>31</div>
<div>32</div>
<div>33</div>
<div>34</div>
<div>35</div>
<div>36</div>
<div>37</div>
<div>38</div>
<div>39</div>
<div>40</div>
</td>
<td>
<div>
<div><code>&lt;?</code><code>xml</code> <code>version</code><code>=</code><code>"1.0"</code> <code>encoding</code><code>=</code><code>"utf-8"</code> <code>?&gt;</code></div>
<div><code>&lt;</code><code>data</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>settings</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>bg_color</code><code>&gt;0x000000&lt;/</code><code>bg_color</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>image_path</code><code>&gt;../images/&lt;/</code><code>image_path</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>viewer_width</code><code>&gt;580&lt;/</code><code>viewer_width</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>viewer_height</code><code>&gt;380&lt;/</code><code>viewer_height</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>content_width</code><code>&gt;2000&lt;/</code><code>content_width</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>content_height</code><code>&gt;1300&lt;/</code><code>content_height</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>viewer_bg_color</code><code>&gt;0xEEDEC0&lt;/</code><code>viewer_bg_color</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>viewer_line_color</code><code>&gt;0xC1C59C&lt;/</code><code>viewer_line_color</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>viewer_offset_x</code><code>&gt;10&lt;/</code><code>viewer_offset_x</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>viewer_offset_y</code><code>&gt;10&lt;/</code><code>viewer_offset_y</code><code>&gt;</code></div>
<div><code> </code><code>&lt;/</code><code>settings</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>page</code> <code>id</code><code>=</code><code>"0"</code> <code>name</code><code>=</code><code>"Holiday in Copenhagen"</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>text</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>content</code><code>&gt;</code></div>
<div><code>Hello there and welcome to the demonstration of the canvas application.</code></div>
<div><code> </code><code>Used as a subject here is my holiday to Copenhagen. anno 2010.</code></div>
<div><code> </code><code>Feel free to read the texts and sniff up the culture.</code></div>
<div><code> </code><code>&lt;/</code><code>content</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>size</code><code>&gt;23&lt;/</code><code>size</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>x</code><code>&gt;470&lt;/</code><code>x</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>y</code><code>&gt;50&lt;/</code><code>y</code><code>&gt;</code></div>
<div><code> </code><code>&lt;/</code><code>text</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>image</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>title</code><code>&gt;Church and lake&lt;/</code><code>title</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>description</code><code>&gt;The beautiful enviroment in Kastelskirken.&lt;/</code><code>description</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>url</code><code>&gt;Church_And_Lake.jpg&lt;/</code><code>url</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>scale</code><code>&gt;1&lt;/</code><code>scale</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>x</code><code>&gt;750&lt;/</code><code>x</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>y</code><code>&gt;500&lt;/</code><code>y</code><code>&gt;</code></div>
<div><code> </code><code>&lt;/</code><code>image</code><code>&gt;</code></div>
<div><code> </code><code>&lt;/</code><code>page</code><code>&gt;</code></div>
<div><code>&lt;/</code><code>data</code><code>&gt;</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr />
<h2>Step 2: The Document and Canvas Class</h2>
<p>Use the following code to set up our application. It is almost  completely generated by FlashDevelop using the “AS3 Project” template.  Main is the document class – which is the class first loaded when  starting flash – and inside <code>Canvas</code> we are building our application.</p>
<div>
<div id="highlighter_378182">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
</td>
<td>
<div>
<div><code>public</code> <code>class</code> <code>Main </code><code>extends</code> <code>Sprite</code></div>
<div><code>{</code></div>
<div><code> </code><code>public</code> <code>function</code> <code>Main():</code><code>void</code></div>
<div><code> </code><code>{</code></div>
<div><code> </code><code>if</code> <code>(stage) init();</code></div>
<div><code> </code><code>else</code> <code>addEventListener(Event.ADDED_TO_STAGE, init);</code></div>
<div><code> </code><code>}</code></div>
<div><code> </code><code>private</code> <code>function</code> <code>init(e:Event = </code><code>null</code><code>):</code><code>void</code></div>
<div><code> </code><code>{</code></div>
<div><code> </code><code>removeEventListener(Event.ADDED_TO_STAGE, init);</code></div>
<div><code> </code><code>// entry point</code></div>
<div><code> </code><code>var</code> <code>canvas:Canvas = </code><code>new</code> <code>Canvas(</code><code>this</code><code>);</code></div>
<div><code> </code><code>}</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>And a simplistic version of Canvas. Note that we use a display object  container as a parameter to add that extra bit of control to add/remove  the Canvas.</p>
<div>
<div id="highlighter_29269">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
</td>
<td>
<div>
<div><code>public</code> <code>class</code> <code>Canvas </code><code>extends</code> <code>Sprite</code></div>
<div><code>{</code></div>
<div><code> </code><code>public</code> <code>function</code> <code>Canvas(container:DisplayObjectContainer)</code></div>
<div><code> </code><code>{</code></div>
<div><code> </code><code>// Save parameter locally</code></div>
<div><code> </code><code>this</code><code>.container = container;</code></div>
<div><code> </code><code>// Add to container</code></div>
<div><code> </code><code>container.addChild(</code><code>this</code><code>);</code></div>
<div><code> </code><code>}</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr />
<h2>Step 3: Using Bulk Loader to Load Assets</h2>
<p>In this application we are using the so called <a href="http://code.google.com/p/bulk-loader/" target="_blank"><code>BulkLoader</code></a>:  an AS3 library that aims to make loading and managing complex loading  requirements easier and faster. When first loading up, we use it to grab  the XML file and a background image. The following code shows how to  boot up the <code>BulkLoader</code> and add two items to the loading queue. The <code>Complete</code> function is called when all items are loaded.</p>
<div>
<div id="highlighter_424146">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
</td>
<td>
<div>
<div><code>// Init bulk loader</code></div>
<div><code>loader = </code><code>new</code> <code>BulkLoader(</code><code>"Canvas"</code><code>);</code></div>
<div><code>loader.add(</code><code>"../background.jpg"</code><code>, { id:</code><code>"background"</code> <code>} );</code></div>
<div><code>loader.add(</code><code>"../settings.xml"</code><code>,   { id:</code><code>"xmldata"</code> <code>} );</code></div>
<div><code>// Loader events</code></div>
<div><code>loader.addEventListener(BulkLoader.COMPLETE, Complete, </code><code>false</code> <code>, </code><code>0</code><code>, </code><code>true</code><code>);</code></div>
<div><code>loader.addEventListener(BulkLoader.ERROR, HandleError, </code><code>false</code><code>, </code><code>0</code><code>, </code><code>true</code><code>);</code></div>
<div><code>// Start loader</code></div>
<div><code>loader.start();</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr />
<h2>Step 4: Saving the Loaded Assets</h2>
<p>We save the loaded assets inside the class for later use. The <code>BulkLoader</code> provides an easy way to grab the items we need. Just call the function  corresponding to the type of object and use the object’s ID string.  Static variables are used to make the XML data globally available (e.g.   accessing a static variable using <code>Canvas.viewerWidth</code>). The <code>path</code> variable specifies where the externally loaded images will be located.  Images can only be loaded from the own webserver due to security  restrictions.</p>
<div>
<div id="highlighter_172544">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
<div>18</div>
<div>19</div>
<div>20</div>
<div>21</div>
<div>22</div>
<div>23</div>
<div>24</div>
<div>25</div>
<div>26</div>
</td>
<td>
<div>
<div><code>// Get background image</code></div>
<div><code>g_background = (loader.getBitmap(</code><code>"background"</code><code>)).bitmapData;</code></div>
<div><code>// Get XML data</code></div>
<div><code>xmldata = loader.getXML(</code><code>"xmldata"</code><code>);</code></div>
<div><code>// Set static vars for easy access</code></div>
<div><code>viewerWidth = </code><code>int</code><code>(xmldata.settings.viewer_width);</code></div>
<div><code>viewerHeight = </code><code>int</code><code>(xmldata.settings.viewer_height);</code></div>
<div><code>viewerBgColor = </code><code>uint</code><code>(xmldata.settings.viewer_bg_color);</code></div>
<div><code>path = </code><code>String</code><code>(xmldata.settings.image_path);</code></div>
<div><code>customFont = </code><code>new</code> <code>customFontClass();</code></div>
<div><code>contentWidth = </code><code>int</code><code>(xmldata.settings.content_width);</code></div>
<div><code>contentHeight = </code><code>int</code><code>(xmldata.settings.content_height);</code></div>
<div><code>// Remove complete listener</code></div>
<div><code>loader.removeEventListener(BulkLoader.COMPLETE, Complete);</code></div>
<div><code>// Remove all data references stored in the loader</code></div>
<div><code>loader.clear();</code></div>
<div><code>// Remove loader from memory</code></div>
<div><code>loader = </code><code>null</code><code>;</code></div>
<div><code>// Set up viewer</code></div>
<div><code>InitialiseViewer();</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr />
<h2>Step 5: Introducing the Virtual Camera</h2>
<p>As you may or may not have guessed, the application uses a virtual  camera to extract a portion of the canvas and show to the user. The  camera applies scaling and translation to a displayobject container such  that only the area under the camera is seen on the screen. The  following demonstration gives you a better idea of how it works.</p>
<p>The source code of this demonstration is also included in the  archive. Let’s explain this example by starting with configurating the  settings. We would like the viewer region to be 305 x 230, and the  content region – which are the dimensions of the flower image – should  try to keep the aspect ratio of the viewer region so it does not deform  too much. Our flower is 1000 x 750, which is close enough. In order to  show the entire flower in the viewer region, the camera must be the same  size as the flower, which is 1000 x 750.</p>
<p>The following code sets the dimension settings. In this  example they are hardcoded, but otherwise it is taken from XML.</p>
<div>
<div id="highlighter_712279">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</td>
<td>
<div>
<div><code>// Settings</code></div>
<div><code>viewerWidth = </code><code>305</code><code>;</code></div>
<div><code>viewerHeight = </code><code>230</code><code>;</code></div>
<div><code>contentWidth = </code><code>1000</code><code>;</code></div>
<div><code>contentHeight = </code><code>750</code><code>;</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Next up we create a viewer container.The option <code>scrollRect</code> is used to clip off anything outside a specified rectangle. This is  very useful as only a portion of the canvas must be shown when zoomed  in. It is a neater solution than for example putting a black border  around the application.</p>
<div>
<div id="highlighter_281772">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</td>
<td>
<div>
<div><code>// Viewer container</code></div>
<div><code>viewerContainer = </code><code>new</code> <code>Sprite();</code></div>
<div><code>viewerContainer.scrollRect = </code><code>new</code> <code>Rectangle(</code><code>0</code><code>,</code><code>0</code><code>, viewerWidth, viewerHeight);</code></div>
<div><code>addChild(viewerContainer);</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>To the viewer container we add another <code>Sprite</code> called <code>viewerScroller</code>. The function of <code>viewerScroller</code> is simply to act as a container for anything that must serve as content  for the camera. It makes it easier to add multiple items to the content  region.</p>
<div>
<div id="highlighter_143488">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
<div>3</div>
</td>
<td>
<div>
<div><code>// Page scroller</code></div>
<div><code>var</code> <code>viewerScroller:Sprite = </code><code>new</code> <code>Sprite();</code></div>
<div><code>viewerContainer.addChild(viewerScroller);</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Add content to the <code>viewerScroller</code>. In this case the flower image.</p>
<div>
<div id="highlighter_836138">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</td>
<td>
<div>
<div><code>// Content</code></div>
<div><code>content = </code><code>new</code> <code>Sprite();</code></div>
<div><code>viewerScroller.addChild(content);</code></div>
<div><code>var</code> <code>bmp:Bitmap = </code><code>new</code> <code>image();</code></div>
<div><code>content.addChild(bmp);</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Now add the <code>Camera</code> class. Although we have yet to make the <code>Camera</code> class, its constructor will take the viewer dimensions as parameter, and the function <code>SetTarget</code> has the content <code>Sprite</code> as parameter. We position the <code>Camera</code> in the middle of the content and give it a first update.</p>
<div>
<div id="highlighter_246802">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</td>
<td>
<div>
<div><code>// Add virtual camera</code></div>
<div><code>cam = </code><code>new</code> <code>Camera(viewerWidth,viewerHeight);</code></div>
<div><code>cam.SetTarget(viewerScroller);</code></div>
<div><code>cam.x = contentWidth / </code><code>2</code><code>;</code></div>
<div><code>cam.y = contentHeight / </code><code>2</code><code>;</code></div>
<div><code>cam.Update();</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>With all this code in place we are able to render and manipulate the camera. Inside a <code>Event.ENTER_FRAME</code> loop you could run <code>cam.Update()</code> to refresh the camera view. It is however more efficient to only update upon a change. By changing <code>cam.x</code> and <code>cam.y</code> you can move the camera around, and by changing <code>cam.scaleX</code> and <code>cam.scaleY</code> you can change the scale. This is exactly what the keyboard keys in the example do.</p>
<hr />
<h2>Step 6: Camera Class A Closer Look</h2>
<p>Here we take a look at the internals of the <code>Camera</code>. In  the constructor function we add some graphics which are needed for the  manipulation of scale of scale of the camera. We also store the viewer  content dimensions locally inside the class.</p>
<div>
<div id="highlighter_443098">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
</td>
<td>
<div>
<div><code>public</code> <code>function</code> <code>Camera(width:</code><code>int</code><code>,height:</code><code>int</code><code>,initialZoom:</code><code>Number</code> <code>= </code><code>1</code><code>)</code></div>
<div><code>{</code></div>
<div><code> </code><code>// Sprite used to give the camera a width and height.</code></div>
<div><code> </code><code>g = </code><code>new</code> <code>Shape();</code></div>
<div><code> </code><code>g.graphics.drawRect(</code><code>0</code><code>, </code><code>0</code><code>, </code><code>10</code><code>, </code><code>10</code><code>);</code></div>
<div><code> </code><code>g.graphics.endFill();</code></div>
<div><code> </code><code>addChild(g);</code></div>
<div><code> </code><code>// Set dimensions of viewer rectangle</code></div>
<div><code> </code><code>tw = width;</code></div>
<div><code> </code><code>th = height;</code></div>
<div><code> </code><code>// Initial zoom</code></div>
<div><code> </code><code>this</code><code>.scaleX = </code><code>this</code><code>.scaleY = initialZoom;</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Next up, attach the camera to an object. The camera becomes the same scale as the object.</p>
<div>
<div id="highlighter_753592">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
</td>
<td>
<div>
<div><code>public</code> <code>function</code> <code>SetTarget(target:Sprite):</code><code>void</code></div>
<div><code>{</code></div>
<div><code> </code><code>this</code><code>.target = target;</code></div>
<div><code> </code><code>// adjust camera dimensions</code></div>
<div><code> </code><code>g.width = target.width;</code></div>
<div><code> </code><code>g.height = target.height;</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>This is the most interesting part and the engine of the camera.  Scaling and translation is applied to the object attached to the camera  by giving it a new transform matrix. Check out the <a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/geom/Matrix.html"><code>Matrix</code> class</a> in the AS3 documentation for more information on the use of matrices.</p>
<div>
<div id="highlighter_335340">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
<div>18</div>
<div>19</div>
<div>20</div>
<div>21</div>
</td>
<td>
<div>
<div><code>public</code> <code>function</code> <code>Update():</code><code>void</code></div>
<div><code>{</code></div>
<div><code> </code><code>cw = </code><code>this</code><code>.width;</code></div>
<div><code> </code><code>ch = </code><code>this</code><code>.height;</code></div>
<div><code> </code><code>tscaleX = tw / cw;</code></div>
<div><code> </code><code>tscaleY = th / ch;</code></div>
<div><code> </code><code>// put new scaling values</code></div>
<div><code> </code><code>mat.a = tscaleX;</code></div>
<div><code> </code><code>mat.d = tscaleY;</code></div>
<div><code> </code><code>// put new position (translation) values.</code></div>
<div><code> </code><code>// the camera position is made negative, because e.g. when the camera moves right, the page has to move left to accomodate.</code></div>
<div><code> </code><code>// cw and ch are added to move the page to the center of the viewing area</code></div>
<div><code> </code><code>// all positions are scaled accordingly</code></div>
<div><code> </code><code>mat.tx = (-mat.tx + cw / </code><code>2</code><code>) * tscaleX;</code></div>
<div><code> </code><code>mat.ty = (-mat.ty + ch / </code><code>2</code><code>) * tscaleY;</code></div>
<div><code> </code><code>target.transform.matrix = mat;</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr />
<h2>Step 7: Setting up the Viewer</h2>
<p>We return to our application. In this step we lay down the foundation for so called <code>Page</code> objects that contain the canvas with pictures and text. First, create a  background for the whole application. The  color is specified from XML.</p>
<div>
<div id="highlighter_99569">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</td>
<td>
<div>
<div><code>// Background</code></div>
<div><code>var</code> <code>bg:Sprite = </code><code>new</code> <code>Sprite();</code></div>
<div><code>bg.graphics.beginFill(xmldata.settings.bgcolor);</code></div>
<div><code>bg.graphics.drawRect(</code><code>0</code><code>, </code><code>0</code><code>, stage.stageWidth, stage.stageHeight);</code></div>
<div><code>bg.graphics.endFill();</code></div>
<div><code>addChild(bg);</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Like in the example with the <code>Camera</code> and the flower, we are using <code>pageContainer</code> and <code>pageScroller</code> and <code>Camera</code>. This should look pretty familar.</p>
<p>Next up is adding all the <code>Page</code> objects required as specified in the XML. In our example we have only created one page. Note that the <code>Page</code> class does not exist yet as we are creating this one the next step. <code>pages</code> is an array that will hold all <code>Page</code> references for later use.</p>
<p>Parameters used by <code>Page</code> are</p>
<ul>
<li><code>pageScroller</code>: the <code>Sprite</code> to which the <code>Page</code> will be added to</li>
<li><code>p</code>: an XML data object containing all information within a certain page (all images and text)</li>
<li><code>g_background</code>: the background texture</li>
</ul>
<div>
<div id="highlighter_116650">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
</td>
<td>
<div>
<div><code>// Add pages</code></div>
<div><code>pages = </code><code>new</code> <code>Array</code><code>(xmldata.page.length());</code></div>
<div><code>for</code> <code>each</code><code>(</code><code>var</code> <code>p:XML </code><code>in</code> <code>xmldata.page)</code></div>
<div><code>{</code></div>
<div><code> </code><code>var</code> <code>id:</code><code>int</code> <code>= </code><code>int</code><code>(p.attributes()[</code><code>0</code><code>]);</code></div>
<div><code> </code><code>pages[id] = </code><code>new</code> <code>Page(pageScroller, p, g_background);</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr />
<h2>Step 8: Creating a Page</h2>
<p>Displayed below is the constructor of <code>Page</code>. We simply save all the parameters locally in the class for later use.</p>
<div>
<div id="highlighter_772520">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
</td>
<td>
<div>
<div><code>public</code> <code>function</code> <code>Page(container:DisplayObjectContainer,data:XML,background:BitmapData)</code></div>
<div><code>{</code></div>
<div><code> </code><code>this</code><code>.id = id;</code></div>
<div><code> </code><code>this</code><code>.container = container;</code></div>
<div><code> </code><code>this</code><code>.data = data;</code></div>
<div><code> </code><code>this</code><code>.background = background;</code></div>
<div><code> </code><code>this</code><code>.title = </code><code>String</code><code>(data.attributes()[</code><code>1</code><code>]);</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Now a bit more interesting stuff. The <code>Load</code> function of <code>Page</code> starts off by taking the background texture we loaded before and  wrapping it over the canvas. To do this we need to know the size of the  background image we are looping and the size of the entire canvas.  Create a <code>Sprite</code> called <code>g_background</code> which functions as a graphics container. Add a solid background color to prevent lines between the bitmap images to show.</p>
<div>
<div id="highlighter_611030">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
</td>
<td>
<div>
<div><code>var</code> <code>b:</code><code>int</code> <code>= background.width;</code></div>
<div><code>var</code> <code>h:</code><code>int</code> <code>= background.height;</code></div>
<div><code>var</code> <code>trueWidth:</code><code>int</code> <code>= Canvas.contentWidth;</code></div>
<div><code>var</code> <code>trueHeight:</code><code>int</code> <code>= Canvas.contentHeight;</code></div>
<div><code>// background layer</code></div>
<div><code>g_background = </code><code>new</code> <code>Sprite();</code></div>
<div><code>addChild(g_background);</code></div>
<div><code>// A solid background color</code></div>
<div><code>var</code> <code>bg:Sprite = </code><code>new</code> <code>Sprite();</code></div>
<div><code>bg.graphics.beginFill(Canvas.viewerBgColor);</code></div>
<div><code>bg.graphics.drawRect(</code><code>0</code><code>, </code><code>0</code><code>, trueWidth, trueHeight);</code></div>
<div><code>bg.graphics.endFill();</code></div>
<div><code>g_background.addChild(bg);</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Wrapping the background texture uses two loops, only vertically and  one horizontally. It keeps on looping until the edge is reached. Every  every tile at an even position – like (2,2), (4,2), (4,6) et cetera – is  flipped around using <code>scaleX</code> or <code>scaleY</code>. This  makes the texture flow over to the next one seamlessly. Checking if a  number is even is done using the modulo operator (%). If the remainder  of a number after deviding by 2 is zero then that number must be even.  Around the edges we clip off any texture that goes outside the content  dimensions as specified in <code>trueWidth</code> and <code>trueHeight</code>. It is important that the <code>Page </code>object stays this size as making it larger will change the aspect ratio and cause the screen to deform.</p>
<div>
<div id="highlighter_752819">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
<div>18</div>
<div>19</div>
<div>20</div>
<div>21</div>
<div>22</div>
<div>23</div>
<div>24</div>
<div>25</div>
<div>26</div>
<div>27</div>
<div>28</div>
<div>29</div>
<div>30</div>
<div>31</div>
<div>32</div>
<div>33</div>
<div>34</div>
<div>35</div>
<div>36</div>
<div>37</div>
<div>38</div>
<div>39</div>
<div>40</div>
<div>41</div>
<div>42</div>
<div>43</div>
<div>44</div>
<div>45</div>
<div>46</div>
<div>47</div>
<div>48</div>
</td>
<td>
<div>
<div><code>// Add looped background image</code></div>
<div><code>var</code> <code>i:</code><code>int</code><code>, j:</code><code>int</code><code>;</code></div>
<div><code>while</code> <code>(i * b &lt; trueWidth)</code></div>
<div><code>{</code></div>
<div><code> </code><code>j = </code><code>0</code><code>;</code></div>
<div><code> </code><code>while</code> <code>(j * h &lt; trueHeight)</code></div>
<div><code> </code><code>{</code></div>
<div><code> </code><code>// new bitmap</code></div>
<div><code> </code><code>var</code> <code>s:Bitmap = </code><code>new</code> <code>Bitmap(background);</code></div>
<div><code> </code><code>// position</code></div>
<div><code> </code><code>s.x = i * b;</code></div>
<div><code> </code><code>s.y = j * h;</code></div>
<div><code> </code><code>// alternate horizontal and vertical flip</code></div>
<div><code> </code><code>if</code> <code>(i % </code><code>2</code> <code>!= </code><code>0</code><code>)</code></div>
<div><code> </code><code>{</code></div>
<div><code> </code><code>s.scaleX *= -</code><code>1</code><code>;</code></div>
<div><code> </code><code>s.x += b;</code></div>
<div><code> </code><code>}</code></div>
<div><code> </code><code>if</code> <code>(j % </code><code>2</code> <code>!= </code><code>0</code><code>)</code></div>
<div><code> </code><code>{</code></div>
<div><code> </code><code>s.scaleY *= -</code><code>1</code><code>;</code></div>
<div><code> </code><code>s.y += h;</code></div>
<div><code> </code><code>}</code></div>
<div><code> </code><code>// clip</code></div>
<div><code> </code><code>if</code> <code>(i * b + b &gt; trueWidth || j * h + h &gt; trueHeight)</code></div>
<div><code> </code><code>{</code></div>
<div><code> </code><code>var</code> <code>clipw:</code><code>int</code> <code>= Math.min(trueWidth - i * b, b);</code></div>
<div><code> </code><code>var</code> <code>cliph:</code><code>int</code> <code>= Math.min(trueHeight - j * h, h);</code></div>
<div><code> </code><code>var</code> <code>nbd:BitmapData = </code><code>new</code> <code>BitmapData(clipw, cliph);</code></div>
<div><code> </code><code>nbd.copyPixels(background, </code><code>new</code> <code>Rectangle(</code><code>0</code><code>, </code><code>0</code><code>, clipw, cliph), </code><code>new</code> <code>Point());</code></div>
<div><code> </code><code>s.bitmapData = nbd;</code></div>
<div><code> </code><code>if</code> <code>(s.scaleX == -</code><code>1</code><code>)</code></div>
<div><code> </code><code>s.x -= b - clipw;</code></div>
<div><code> </code><code>if</code> <code>(s.scaleY == -</code><code>1</code><code>)</code></div>
<div><code> </code><code>s.y -= h - cliph;</code></div>
<div><code> </code><code>}</code></div>
<div><code> </code><code>// add bitmap to display list</code></div>
<div><code> </code><code>g_background.addChild(s);</code></div>
<div><code> </code><code>j++;</code></div>
<div><code> </code><code>}</code></div>
<div><code> </code><code>i++;</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>The result of the repeating background should be something like this. Dark borders are added for clarity.</p>
<p><ins><ins id="google_ads_frame1_anchor"></ins></ins></p>
<div><img src="http://d2fhka9tf2vaj2.cloudfront.net/tuts/222_canvasApp/tutorial/img2.jpg" alt="Repeating background" /></div>
<hr />
<h2>Step 9: Loading Text</h2>
<p>Let’s start our page-filling journey by adding text. Go through all XML entries labelled &#8220;text&#8221; and pass their data to the <code>AddText</code> function.</p>
<div>
<div id="highlighter_694521">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</td>
<td>
<div>
<div><code>texts = </code><code>new</code> <code>Array</code><code>();</code></div>
<div><code>for</code> <code>each</code><code>(</code><code>var</code> <code>text:XML </code><code>in</code> <code>data.text)</code></div>
<div><code>{</code></div>
<div><code> </code><code>AddText(text);</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>The <code>AddText</code> function looks like this. The first portion  of the code validates the XML data. In case some fields aren’t filled in  it will append a standard value. <code>QuickText</code> is a class used to create a textfield with certain options. Finally, the text must be excluded from mouse interaction by using <code>mouseEnabled = false</code> and <code>mouseChildren = false</code>.</p>
<div>
<div id="highlighter_359989">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
<div>18</div>
<div>19</div>
<div>20</div>
<div>21</div>
</td>
<td>
<div>
<div><code>private</code> <code>function</code> <code>AddText(text:XML):</code><code>void</code></div>
<div><code>{</code></div>
<div><code> </code><code>if</code> <code>(!text.font)</code></div>
<div><code> </code><code>text.font = </code><code>null</code><code>;</code></div>
<div><code> </code><code>if</code> <code>(!text.size)</code></div>
<div><code> </code><code>text.size = </code><code>12</code><code>;</code></div>
<div><code> </code><code>if</code> <code>(!text.color)</code></div>
<div><code> </code><code>text.color = </code><code>0x000000</code><code>;</code></div>
<div><code> </code><code>if</code> <code>(!text.bold)</code></div>
<div><code> </code><code>text.bold = </code><code>0</code><code>;</code></div>
<div><code> </code><code>if</code> <code>(!text.italic)</code></div>
<div><code> </code><code>text.italic = </code><code>0</code><code>;</code></div>
<div><code> </code><code>var</code> <code>qt:QuickText = </code><code>new</code> <code>QuickText(text.x, text.y, </code><code>String</code><code>(text.content), Canvas.customFont, </code><code>int</code><code>(text.size), </code><code>uint</code><code>(text.color), </code><code>Boolean</code><code>(text.bold), </code><code>Boolean</code><code>(text.italic));</code></div>
<div><code> </code><code>qt.blendMode = BlendMode.LAYER;</code></div>
<div><code> </code><code>texts.push(qt);</code></div>
<div><code> </code><code>addChild(qt);</code></div>
<div><code> </code><code>qt.mouseEnabled = </code><code>false</code><code>;</code></div>
<div><code> </code><code>qt.mouseChildren = </code><code>false</code><code>;</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>The following image shows all the options of the <code>QuickText</code> class:</p>
<div><img src="http://d2fhka9tf2vaj2.cloudfront.net/tuts/222_canvasApp/tutorial/img1.jpg" alt="The options of the QuickText class." /></div>
<p>And the result of the new page including text:</p>
<div><img src="http://d2fhka9tf2vaj2.cloudfront.net/tuts/222_canvasApp/tutorial/img3.jpg" alt="Page with text" /></div>
<hr />
<h2>Step 10: Loading Images</h2>
<p>The first step here is to create <code>Picture</code> objects that  will hold the XML data, the bitmap and some descriptive text. Listeners  are directly applied for mouse interaction. All these <code>Picture</code> objects are then stored in an array for easy access later.</p>
<div>
<div id="highlighter_443405">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
</td>
<td>
<div>
<div><code>// grab all images</code></div>
<div><code>pictures = </code><code>new</code> <code>Array</code><code>();</code></div>
<div><code>for</code> <code>each</code><code>(</code><code>var</code> <code>image:XML </code><code>in</code> <code>data.image)</code></div>
<div><code>{</code></div>
<div><code> </code><code>// new picture object with information in it</code></div>
<div><code> </code><code>var</code> <code>picture:Picture = </code><code>new</code> <code>Picture(image);</code></div>
<div><code> </code><code>pictures.push(picture);</code></div>
<div><code> </code><code>// add listeners to picture</code></div>
<div><code> </code><code>picture.addEventListener(MouseEvent.MOUSE_OVER, PictureMouseOver);</code></div>
<div><code> </code><code>picture.addEventListener(MouseEvent.MOUSE_OUT, PictureMouseOut);</code></div>
<div><code> </code><code>picture.addEventListener(MouseEvent.MOUSE_DOWN, PictureMouseDown);</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>And here is the basic version of the <code>Picture</code> class, just holding the XML data. <code>Picture</code> extends <code>Sprite</code>,  we can already position it somewhere. The scale setting is verified  before being used, because if the user omits it from the XML it will  return 0. The standard value for scale is 1.</p>
<div>
<div id="highlighter_212706">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
</td>
<td>
<div>
<div><code>public</code> <code>function</code> <code>Picture(data:XML)</code></div>
<div><code>{</code></div>
<div><code> </code><code>title = data.title;</code></div>
<div><code> </code><code>description = data.description;</code></div>
<div><code> </code><code>url = data.url;</code></div>
<div><code> </code><code>page = data.page;</code></div>
<div><code> </code><code>x = data.x;</code></div>
<div><code> </code><code>y = data.y;</code></div>
<div><code> </code><code>if</code> <code>(</code><code>Number</code><code>(data.scale) != </code><code>0</code><code>)</code></div>
<div><code> </code><code>imgscale = </code><code>Number</code><code>(data.scale);</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Create a new <code>BulkLoader</code> just like the first time, but  now to load batches of images. We are going to be loading 5 images at a  time and displaying those when done. It will keep fetching new images  until all are done. The function <code>Complete</code> is called at the completion of each batch.</p>
<div>
<div id="highlighter_351782">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
</td>
<td>
<div>
<div><code>// Create bulk loader.</code></div>
<div><code>loader = </code><code>new</code> <code>BulkLoader(</code><code>"page"</code> <code>+ id);</code></div>
<div><code>loader.addEventListener(BulkLoader.COMPLETE, Complete, </code><code>false</code><code>, </code><code>0</code><code>, </code><code>true</code><code>);&lt;br /&gt;&lt;br /&gt;</code></div>
<div><code>// set total amount of pictures</code></div>
<div><code>totalPictures = pictures.length;</code></div>
<div><code>// grab the first 5 pictures or the total amount of pictures if there are less.</code></div>
<div><code>i = </code><code>0</code><code>;</code></div>
<div><code>while</code> <code>(i &lt; Math.min(totalPictures,</code><code>5</code><code>))</code></div>
<div><code>{</code></div>
<div><code> </code><code>loader.add(</code><code>String</code><code>(Canvas.path + pictures[i].url), { id: </code><code>"img"</code> <code>+ i } );</code></div>
<div><code> </code><code>i++;</code></div>
<div><code>}</code></div>
<div><code>// Start loader</code></div>
<div><code>loader.start();</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr />
<h2>Step 11: Loading Images (Continued)</h2>
<p>In this step we’re putting the loaded data inside <code>Picture</code> objects. The <code>items</code> property of the loader holds all objects that have been loaded in. Loop  over all those objects and check whether they are an image. Each <code>Bitmap</code> is given to the corresponding <code>Picture</code> object and the <code>Picture</code> is added to the canvas. We also delete the loaded image from the loader  items list to prevent conflicts with a later batch of loaded images.</p>
<div>
<div id="highlighter_525715">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
</td>
<td>
<div>
<div><code>// Image batch loaded. save the data to individual Picture objects.</code></div>
<div><code>i = amountPicturesLoaded;</code></div>
<div><code>for</code> <code>each</code><code>(</code><code>var</code> <code>item:LoadingItem </code><code>in</code> <code>loader.items)</code></div>
<div><code>{</code></div>
<div><code> </code><code>if</code> <code>(item.isImage())</code></div>
<div><code> </code><code>{</code></div>
<div><code> </code><code>pictures[i].SetImage(loader.getBitmap(item.id));</code></div>
<div><code> </code><code>loader.remove(item.id);</code></div>
<div><code> </code><code>AddPicture(pictures[i]);</code></div>
<div><code> </code><code>i++;</code></div>
<div><code> </code><code>amountPicturesLoaded++;</code></div>
<div><code> </code><code>}</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>And a closer look at the <code>SetImage</code> function of <code>Picture</code>.</p>
<div>
<div id="highlighter_620234">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
</td>
<td>
<div>
<div><code>public</code> <code>function</code> <code>SetImage(ob:Bitmap):</code><code>void</code></div>
<div><code>{</code></div>
<div><code> </code><code>// if no image data is loaded, show nothing</code></div>
<div><code> </code><code>if</code> <code>(ob == </code><code>null</code><code>)</code></div>
<div><code> </code><code>return</code><code>;</code></div>
<div><code> </code><code>// save the data inside the class</code></div>
<div><code> </code><code>img = ob;</code></div>
<div><code> </code><code>// show image</code></div>
<div><code> </code><code>addChild(img);</code></div>
<div><code> </code><code>// scale</code></div>
<div><code> </code><code>img.scaleX = img.scaleY = imgscale;</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>And adding a picture to the canvas is as easy as calling <code>addChild</code>.</p>
<div>
<div id="highlighter_852098">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</td>
<td>
<div>
<div><code>private</code> <code>function</code> <code>AddPicture(pict:Picture):</code><code>void</code></div>
<div><code>{</code></div>
<div><code> </code><code>addChild(pict);</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>The result now becomes:</p>
<div><img src="http://d2fhka9tf2vaj2.cloudfront.net/tuts/222_canvasApp/tutorial/img4.jpg" alt="Page with text and images" /></div>
<hr />
<h2>Step 12: Adding the Page</h2>
<p>Adding something to the camera view is done by adding a child to the <code>viewerScroller</code> container. We’ve added the <code>viewerScroller</code> to each <code>Page</code> object as a parameter so that we can add it as a child by calling the <code>Show()</code> function of <code>Page</code>.</p>
<div>
<div id="highlighter_37856">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</td>
<td>
<div>
<div><code>public</code> <code>function</code> <code>Show():</code><code>void</code></div>
<div><code>{</code></div>
<div><code> </code><code>container.addChild(</code><code>this</code><code>);</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Return to the <code>Canvas</code> class and call the Load() and Show() functions when we’d like to a show the user a page. In case the <code>Page</code> is already loaded, <code>Load()</code> will return directly so no unnecessary actions are done. The current <code>Page</code> we are showing is saved in the class as <code>page</code>. This reference will be important for page interaction.</p>
<div>
<div id="highlighter_583507">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
</td>
<td>
<div>
<div><code>private</code> <code>function</code> <code>ShowPage(nr:</code><code>int</code><code>):</code><code>void</code></div>
<div><code>{</code></div>
<div><code> </code><code>// hide old page</code></div>
<div><code> </code><code>if</code> <code>(page)</code></div>
<div><code> </code><code>page.Hide();</code></div>
<div><code> </code><code>// set new page</code></div>
<div><code> </code><code>page = pages[nr];</code></div>
<div><code> </code><code>page.Load();</code></div>
<div><code> </code><code>page.Show();</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr />
<h2>Step 13: Zoom Modes</h2>
<p>Now that we’ve created our page with images and text, it’s necessary  to scale it so it will fit inside our viewer region. We are using the  public static variables <code>zoom</code> and <code>magnifyStep</code> for this purpose. <code>magnifyStep</code> is an array holding all the different scale values of the camera and <code>zoom</code> is the current position of <code>magnifyStep</code> the camera is scaled to. To know which scaling value is needed to fit  the content inside the viewer  we need to know the ratio between the  content and viewer regions. To account for wrong aspect ratios we take  the minimal ratio between width and heights as follows:</p>
<div>
<div id="highlighter_42712">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
<div>2</div>
</td>
<td>
<div>
<div><code>// Set magnify steplist</code></div>
<div><code>magnifyStepList[</code><code>0</code><code>] = Math.min(viewerWidth / contentWidth, viewerHeight / contentHeight);</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>We’d like to zoom in when clicking on the canvas. Add a mouse event to the hitfield of <code>Page</code>. The hitfield is basically just the graphics in the background of <code>Page </code>and because it is a <code>Sprite</code> we can put mouse interaction on it.</p>
<div>
<div id="highlighter_947571">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>1</div>
</td>
<td>
<div>
<div><code>page.hitField.addEventListener(MouseEvent.MOUSE_DOWN, MouseZoomIn);</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Upon a mouse click we would like the camera to scale down to the position zoom in the <code>magnifyStepList</code> and move to the point on the canvas that we clicked. Remember from the  example that as the camera becomes smaller (scales down), the zoom on  the canvas becomes larger. This is why we decrease the integer zoom by  the value one. Getting the mouse position we clicked on the canvas is  easy by using <code>page.mouseX</code> and <code>page.mouseY</code>.  Flash automatically converts the numbers so that it appears local –  meaning that if the page is for example 2000 px scaled down by 50% and  you click halfway, it returns 1000 px, even though the mouse position on  scale coordinates is a lot smaller.</p>
<div>
<div id="highlighter_499564">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
</td>
<td>
<div>
<div><code>private</code> <code>function</code> <code>MouseZoomIn(e:MouseEvent):</code><code>void</code></div>
<div><code>{</code></div>
<div><code> </code><code>var</code> <code>pt:Point;</code></div>
<div><code> </code><code>if</code> <code>(!cam.bZooming &amp;&amp; zoom &gt; </code><code>0</code><code>)</code></div>
<div><code> </code><code>{</code></div>
<div><code> </code><code>// Zoom in one step</code></div>
<div><code> </code><code>zoom--;</code></div>
<div><code> </code><code>// New camera point. Correct bounds.</code></div>
<div><code> </code><code>pt = </code><code>new</code> <code>Point(page.mouseX, page.mouseY);</code></div>
<div><code> </code><code>CameraBounds(pt);</code></div>
<div><code> </code><code>cam.Zoom(pt.x, pt.y, magnifyStepList[zoom]);</code></div>
<div><code> </code><code>}</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr />
<h2>Step 14: Correcting Camera Position</h2>
<p>To keep the area of the camera inside the canvas we will need to  correct the position within bounds of the camera. Looking at the camera  example again for a demonstration of this. The camera is centered around  itself so the position horizontally for example will need to stay  within <code>0 + camera half-width</code> and <code>contentWidth - camera half-width</code>. A reliable way to calculate the width of the camera when zoomed in is <code>contentWidth/2 * magnifyStepList[zoom]</code>, because the camera in its initial unzoomed condition has the size <code>contentWidth</code> (same size as the canvas).</p>
<div>
<div id="highlighter_997271">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
</td>
<td>
<div>
<div><code>private</code> <code>function</code> <code>CameraBounds(pt:Point):</code><code>void</code></div>
<div><code>{</code></div>
<div><code> </code><code>// horizontally</code></div>
<div><code> </code><code>if</code> <code>(pt.x &lt; contentWidth/</code><code>2</code> <code>* magnifyStepList[zoom])</code></div>
<div><code> </code><code>pt.x = contentWidth/</code><code>2</code> <code>* magnifyStepList[zoom];</code></div>
<div><code> </code><code>else</code> <code>if</code> <code>(pt.x &gt; contentWidth - contentWidth/</code><code>2</code> <code>* magnifyStepList[zoom])</code></div>
<div><code> </code><code>pt.x = contentWidth - contentWidth/</code><code>2</code> <code>* magnifyStepList[zoom];</code></div>
<div><code> </code><code>// vertically</code></div>
<div><code> </code><code>if</code> <code>(pt.y &lt; contentHeight/</code><code>2</code> <code>* magnifyStepList[zoom])</code></div>
<div><code> </code><code>pt.y = contentHeight/</code><code>2</code> <code>* magnifyStepList[zoom];</code></div>
<div><code> </code><code>else</code> <code>if</code> <code>(pt.y &gt; contentHeight - contentHeight/</code><code>2</code> <code>* magnifyStepList[zoom])</code></div>
<div><code> </code><code>pt.y = contentHeight - contentHeight/</code><code>2</code> <code>* magnifyStepList[zoom];</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Shown in the image below is the camera and the canvas, zoomed in one  time. The red lines show the borders that the camera can not cross and  must stay within.</p>
<div><img src="http://d2fhka9tf2vaj2.cloudfront.net/tuts/222_canvasApp/tutorial/img7.jpg" alt="Camera bounds" /></div>
<hr />
<h2>Step 15: Making the Zoom Work</h2>
<p>Zooming is performed by adding scale to the camera. We are using the <code><a href="http://code.google.com/p/tweener/" target="_blank">Tweener</a></code> class and the <code>"easyOutQuint"</code> transition to make this happen in a smooth way. <code>bZooming</code> is a variable used to see if the camera is already zooming or not. You  cannot zoom on the page again while it is still busy scaling up or down.  At each update of the camera the function <code>Update</code> is called, which performs the scaling on the content.</p>
<div>
<div id="highlighter_255148">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
</td>
<td>
<div>
<div><code>public</code> <code>function</code> <code>Zoom(newx:</code><code>int</code><code>, newy:</code><code>int</code><code>, newscale:</code><code>Number</code><code>):</code><code>void</code></div>
<div><code>{</code></div>
<div><code> </code><code>bZooming = </code><code>true</code><code>;</code></div>
<div><code> </code><code>Tweener.addTween(</code><code>this</code><code>, { time:</code><code>2</code><code>, x:newx, y:newy, transition:</code><code>"easeOutQuint"</code><code>, scaleX:newscale, scaleY:newscale,</code></div>
<div><code> </code><code>onComplete:</code></div>
<div><code> </code><code>function</code><code>():</code><code>void</code></div>
<div><code> </code><code>{</code></div>
<div><code> </code><code>bZooming = </code><code>false</code><code>;</code></div>
<div><code> </code><code>},</code></div>
<div><code> </code><code>onUpdate: Update</code></div>
<div><code> </code><code>});</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<hr />
<h2>Step 16: A Closer Look at Pictures</h2>
<p>Remember that we added <code>MouseEvent</code> listeners to all the  pictures inside the page. What we’d like to do is zoom in on a picture  when one is clicked on and make sure it fits within the viewer region  well. Images smaller than the actual viewer region must not be scaled  beyond their resolution.</p>
<div>
<div id="highlighter_731060">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
<div>18</div>
<div>19</div>
<div>20</div>
<div>21</div>
</td>
<td>
<div>
<div><code>private</code> <code>function</code> <code>PictureMouseDown(e:MouseEvent):</code><code>void</code></div>
<div><code>{</code></div>
<div><code> </code><code>var</code> <code>newScale:</code><code>Number</code><code>;</code></div>
<div><code> </code><code>var</code> <code>screenRatio:</code><code>Number</code> <code>= Canvas.viewerWidth / Canvas.viewerHeight;</code></div>
<div><code> </code><code>var</code> <code>imgW:</code><code>Number</code> <code>= Math.max(e.target.width * </code><code>1.05</code><code>, Canvas.viewerWidth);</code></div>
<div><code> </code><code>var</code> <code>imgH:</code><code>Number</code> <code>= Math.max(e.target.height * </code><code>1.05</code><code>, Canvas.viewerHeight);</code></div>
<div><code> </code><code>var</code> <code>imgRatio:</code><code>Number</code> <code>= e.target.img.width / e.target.img.height</code></div>
<div><code> </code><code>// Calculate image scaling</code></div>
<div><code> </code><code>if</code> <code>(imgRatio &lt; </code><code>1</code><code>)</code></div>
<div><code> </code><code>newScale = imgH / Canvas.contentHeight;</code></div>
<div><code> </code><code>else</code></div>
<div><code> </code><code>newScale = imgW / Canvas.contentWidth;</code></div>
<div><code> </code><code>Canvas.cam.Zoom(e.target.x + e.target.width/</code><code>2</code><code>,</code></div>
<div><code> </code><code>e.target.y + e.target.height/</code><code>2</code><code>,</code></div>
<div><code> </code><code>newScale);</code></div>
<div><code> </code><code>Canvas.cam.bLocked = </code><code>true</code><code>;</code></div>
<div><code> </code><code>PictureMouseDisable();</code></div>
<div><code>}</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>The basic concept here is that the aspect ratio of an image must  first be determined. If the width of an image is higher than the height  then <code>imgRatio &lt; 1</code> will hold true and vice-versa if the  height is larger than the width. We will always scale to the largest  part of an image, meaning that if the image is for example 200x400px, we  will treat the image like a 400×400 square. Another addition here is  that we scale the image with 1.05 first, meaning the image becomes 5%  larger. This way the image does not touch the sides when zoomed in. To  calculate the scale of an image in comparison to the content size we  divide it by the height or width of the content.</p>
<p>Call the <code>Zoom</code> function of the camera and move to the middle of the picture we’re focussing on and apply the new scale that we’ve calculated.</p>
<p>Here is the image zooming process shown in action. Notice how the  camera is kept within the bounds of the page, and how the entire image  including description fits inside the screen perfectly.</p>
<div><img src="http://d2fhka9tf2vaj2.cloudfront.net/tuts/222_canvasApp/tutorial/img5.jpg" alt="Image zooming in action" /></div>
<hr />
<h2>Step 17: Scrolling the Page</h2>
<p>If you hadn’t noticed, when zoomed in on a page you can move the  mouse cursor to the edges of the screen to scroll around and view more  of the page. The code shown below may look a little bizarre to you; it  is something I’ve written a while ago for a RTS style game engine and  have been re-using it ever since for anything that needs scrolling.  Basic principles here is that you check where the mouse position is, and  in case it moves without a certain range around the sizes (<code>mouse_scroll_areax_reduced</code> and  <code>mouse_scroll_areay_reduced</code>)  then it will start moving to one side at a rate proportionate to how  far you are inside that range. When the mouse cursor is not inside the  range it will put a drag on the scrolling to slow it down eventually.</p>
<div>
<div id="highlighter_875287">
<div><a href="http://active.tutsplus.com/tutorials/actionscript/zoom-into-your-own-canvas-of-content/#">?</a></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<div>01</div>
<div>02</div>
<div>03</div>
<div>04</div>
<div>05</div>
<div>06</div>
<div>07</div>
<div>08</div>
<div>09</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
<div>18</div>
<div>19</div>
<div>20</div>
<div>21</div>
<div>22</div>
<div>23</div>
<div>24</div>
<div>25</div>
<div>26</div>
<div>27</div>
<div>28</div>
<div>29</div>
<div>30</div>
<div>31</div>
<div>32</div>
<div>33</div>
<div>34</div>
<div>35</div>
<div>36</div>
</td>
<td>
<div>
<div><code>// Get the amount of scolling needed based on the mouse position</code></div>
<div><code>mx = viewerContainer.mouseX;</code></div>
<div><code>my = viewerContainer.mouseY;</code></div>
<div><code>if</code> <code>(mx &lt; mouse_scroll_areax &amp;&amp; mx &gt; </code><code>0</code><code>)</code></div>
<div><code>{</code></div>
<div><code> </code><code>scrollAmountX = ((((mx - mouse_scroll_areax) / mouse_scroll_areax_reduced) * mouse_scroll_factor) + .</code><code>5</code><code>) &lt;&lt; </code><code>0</code><code>;</code></div>
<div><code>}</code></div>
<div><code>else</code> <code>if</code> <code>((viewerContainer.width - mx) &lt; mouse_scroll_areax &amp;&amp; mx &lt; viewerContainer.width)</code></div>
<div><code>{</code></div>
<div><code> </code><code>scrollAmountX = (((</code><code>1</code> <code>- (viewerContainer.width - mx) / mouse_scroll_areax_reduced) * mouse_scroll_factor) + .</code><code>5</code><code>) &lt;&lt; </code><code>0</code><code>;</code></div>
<div><code>}</code></div>
<div><code>if</code> <code>(my &lt; mouse_scroll_areay &amp;&amp; my &gt; </code><code>0</code><code>)</code></div>
<div><code>{</code></div>
<div><code> </code><code>scrollAmountY = ((((my - mouse_scroll_areay) / mouse_scroll_areay_reduced) * mouse_scroll_factor) + .</code><code>5</code><code>) &lt;&lt; </code><code>0</code><code>;</code></div>
<div><code>}</code></div>
<div><code>else</code> <code>if</code> <code>((viewerContainer.height - my) &lt; mouse_scroll_areay &amp;&amp; my &lt; viewerContainer.height)</code></div>
<div><code>{</code></div>
<div><code> </code><code>scrollAmountY = (((</code><code>1</code> <code>- (viewerContainer.height - my) / mouse_scroll_areay_reduced) * mouse_scroll_factor) + .</code><code>5</code><code>) &lt;&lt; </code><code>0</code><code>;</code></div>
<div><code>}</code></div>
<div><code>// Put drag on the scroll, so it does not keep on moving forever and slows down smoothly.</code></div>
<div><code>scollAmountX *= .</code><code>95</code><code>;</code></div>
<div><code>scrollAmountY *= .</code><code>95</code><code>;</code></div>
<div><code>// Update camera position</code></div>
<div><code>cam.x += </code><code>int</code><code>(scrollAmountX);</code></div>
<div><code>cam.y += </code><code>int</code><code>(scrollAmountY);</code></div>
<div><code>// Make sure the camera is within bounds</code></div>
<div><code>var</code> <code>pt:Point = </code><code>new</code> <code>Point(cam.x, cam.y);</code></div>
<div><code>CameraBounds(pt);</code></div>
<div><code>cam.x = pt.x;</code></div>
<div><code>cam.y = pt.y;</code></div>
<div><code>// Update the camera view</code></div>
<div><code>cam.Update();</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>Shown below is the area where mouse interaction for scrolling occurs. Remember that it can only happen when zoomed in.</p>
<div><img src="http://d2fhka9tf2vaj2.cloudfront.net/tuts/222_canvasApp/tutorial/img6.jpg" alt="The scrolling borders visualised." /></div>
<hr />
<h2>Conclusion</h2>
<p>I believe this sums up all the learning goals I set out for this  tutorial. Unfortunately, not everything shown in the application could  be discussed because of the scope of the tutorial, but I hope you  managed to learn the basics about XML data, page filling and camera  manipulation. Thanks for reading!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.4rwebsolutions.com/2011/01/zoom-into-your-own-canvas-of-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>You want to create a font?&#8230;</title>
		<link>http://www.blog.4rwebsolutions.com/2011/01/you-want-to-create-a-font/</link>
		<comments>http://www.blog.4rwebsolutions.com/2011/01/you-want-to-create-a-font/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 20:25:05 +0000</pubDate>
		<dc:creator>4rwebsolutions</dc:creator>
				<category><![CDATA[PoSt]]></category>
		<category><![CDATA[Graphic design]]></category>

		<guid isPermaLink="false">http://www.blog.4rwebsolutions.com/?p=515</guid>
		<description><![CDATA[So you’re a brilliant designer, a master calligrapher, and you’ve learned all about serifs, side-bearings, and kerning. Now you want to create your own font. (What! You haven’t learned all about serifs, side-bearings, and kerning? Well, make sure you read all of the articles on iLT before you embark on font creation! You’ll need all [...]]]></description>
			<content:encoded><![CDATA[<p>So you’re a brilliant designer, a master calligrapher, and you’ve learned all about serifs, side-bearings, and kerning. Now you want to create your own font. (What! You haven’t learned all about serifs, side-bearings, and kerning? Well, make sure you read all of the articles on iLT before you embark on font creation! You’ll need all of the knowledge you can get if you plan on being successful! And if you’re not a brilliant designer or a master calligrapher, well, don’t worry—you can still create some beautiful fonts with a little hard work, a lot of knowledge, and a little inspiration.)</p>
<p><span style="color: #ff6600;">The Crux: Font Editing Software</span></p>
<p><a rel="attachment wp-att-516" href="http://www.blog.4rwebsolutions.com/2011/01/you-want-to-create-a-font/fontlab-ajhand/"><img class="alignleft size-large wp-image-516" title="fontlab-ajhand" src="http://www.blog.4rwebsolutions.com/wp-content/uploads/2011/01/fontlab-ajhand-425x348.gif" alt="" width="425" height="348" /></a></p>
<p>All the brilliant design, precise calligraphic work, and deep knowledge of kerning won’t mean anything if you can’t translate your work into a computer-friendly format, which is why you’ll need a good piece of font editing software at your disposal. Font editing software comes in a variety of strengths and prices, and works on a variety of platforms. The major players are listed below:<br />
<span style="color: #ff6600;">Font Editing Programs</span></p>
<p>* FontLab Studio is what I use to make my fonts. It is more or less the industry standard, and, as such, isn’t exactly cheap, coming in at $649 (US). A 30-day free trial is available, if you want to try before you buy. It’s available for both PC and Mac. I’ve used FontLab Studio pretty extensively, and can vouch for its excellence, and the vibrancy of the user community.<br />
* FontForge can ostensibly do everything that FontLab can, and it’s free and open-source. That said, installing FontForge (at least under Windows) is not exactly a simple matter (you’ll need to install Cygwin first). Also, the program is not as well documented as FontLab. There was an interesting thread recently over at Typophile about FontForge that you might want to read, if you’re considering taking the open-source plunge. FontForge is available for PC, Mac, and Linux. (If you’re a Linux user, FontForge is more or less your only choice.)<br />
* For those rolling in cash, DTL FontMaster can do everything FontLab can, and more, but it’s quite expensive. FontMaster comes as seven different modules, which I find altogether cool and intimidating. It’s available for PC and Mac.<br />
* FontCreator is another choice, more affordable than FontLab. The program works only with TrueType and OpenType fonts—no Type 1 fonts—and is for Windows only.<br />
* TypeTool from FontLab is a more entry-level product along the same lines as FontCreator. The company says that TypeTool is “for students, hobby typographers and creative professionals who occasionally need to create or customize fonts”. PC and Mac.<br />
* The original king of font editing software is Fontographer which languished in non-development purgatory for years until FontLab bought the code and recently updated it for the Mac. The last version was really showing its age even in the late 1990s, so I’m hoping that Fontlab did an impressive rewrite for its new version. It’s half the price of FontLab Studio, but I can’t vouch for its new user interface, not having tried it. Fontographer is available for PC and Mac, though only Mac users get the latest version.</p>
<p>All of these programs operate on the same principles, differing in specifics, interface, and levels of options and power. So do some research before you buy—download and try some demos, read the rants and debates of other font creators out there, and figure out which font editor works best for you. One path I’ve read about some people taking is to start with TypeTool, see if this whole font-creation thing is something they genuinely love, and then eventually upgrade to FontLab Studio once the limitations of TypeTool become an issue.</p>
<p>Once you have a good font editing program, there are three basic routes to creating a font.<br />
<span style="color: #ff6600;">Method 1: Draw it on paper</span></p>
<p>Tools You’ll Need</p>
<p>* Good Pen<br />
* Good Paper<br />
* Ruler (Optional)<br />
* Scanner<br />
* Adobe Photoshop (or similar image editing software)<br />
* ScanFont<br />
* Font Editing software of your choice</p>
<p><a rel="attachment wp-att-517" href="http://www.blog.4rwebsolutions.com/2011/01/you-want-to-create-a-font/ajhand-drawn1/"><img class="alignnone size-large wp-image-517" title="ajhand-drawn1" src="http://www.blog.4rwebsolutions.com/wp-content/uploads/2011/01/ajhand-drawn1-425x260.gif" alt="" width="425" height="260" /></a></p>
<p>Are you artistic? Have cool handwriting? Well, get a good pen, a stack of good paper, and start drawing your alphabet. (Don’t overlook your choice of pen. Is your font going to be something thick and juicy? Try using a Sharpie. Or will it be calligraphic? Break out your calligraphy pen set. Will it be thin and delicate? Pick a fine-point precision pen for your work.) Draw big, so there’s plenty of detail to capture, and make sure your characters are all the appropriate height (you might want to add ruled lines in pencil to your paper before you begin). Don’t forget to draw all of the characters a good font needs! That means punctuation, tildes, accents, parentheses and brackets, and numerals. You’ll also want to include obscure characters like the thorn and eth. Create a new font in your font editor before you put pen to paper, and look at the standard glyph table it presents you with. There will be characters there you’ve never heard of, but there are typesetters out there who will be expecting to see those characters in your font!</p>
<p><a rel="attachment wp-att-518" href="http://www.blog.4rwebsolutions.com/2011/01/you-want-to-create-a-font/ajhand-bitmap-m/"><img class="alignnone size-large wp-image-518" title="ajhand-bitmap-m" src="http://www.blog.4rwebsolutions.com/wp-content/uploads/2011/01/ajhand-bitmap-m-425x390.gif" alt="" width="425" height="390" /></a></p>
<p>Scan your beautiful work into Photoshop, and then turn your image into a bitmap (black and white—no shades of grey).</p>
<p><a rel="attachment wp-att-519" href="http://www.blog.4rwebsolutions.com/2011/01/you-want-to-create-a-font/scanfont-m/"><img class="alignnone size-large wp-image-519" title="scanfont-m" src="http://www.blog.4rwebsolutions.com/wp-content/uploads/2011/01/scanfont-m-425x356.gif" alt="" width="425" height="356" /></a></p>
<p>Almost there. Open your bitmap image in FontLab’s ScanFont. This nifty little program (which comes bundled as part of the Mac version of FontLab Studio—lucky Mac users!) allows you to take bitmap images and convert them into font glyphs. (Font editing programs work with outlines, which are basically vectors like those used in Illusrator. Scanners and programs like Photoshop work with bitmaps. ScanFont bridges the gap between these two media.) Once this is accomplished, you can either save your font in ScanFont, or copy individual glyphs from ScanFont into FontLab Studio. (Hey, nobody said this would be easy!) And once you have all of your glyphs in FontLab, you can begin the long, arduous, fun process of editing your font towards perfection!<br />
<span style="color: #ff6600;">Method 2: Draw it on a tablet</span></p>
<p>Tools You’ll Need</p>
<p>* Wacom Tablet<br />
* Adobe Illustrator<br />
* Font Editing software of your choice</p>
<p>You can skip many of the above steps by using a Wacom tablet to draw your font glyphs directly into a vector graphics program like Adobe Illustrator. FontLab Studio, for one, supports copying and pasting directly from Illustrator. One cool thing about using Illustrator to draw your alphabet is that you have a wide range of brushes to choose from, so that you can change the style of your entire alphabet with a couple of mouse clicks. One thing I’ve discovered is that, as good as tablet technology has gotten, there’s really no substitute for pen and paper—an alphabet drawn on a tablet will be different from the same alphabet drawn on paper.</p>
<p><a rel="attachment wp-att-520" href="http://www.blog.4rwebsolutions.com/2011/01/you-want-to-create-a-font/illustrator-as11/"><img class="alignnone size-large wp-image-520" title="illustrator-as11" src="http://www.blog.4rwebsolutions.com/wp-content/uploads/2011/01/illustrator-as11-425x388.gif" alt="" width="425" height="388" /></a></p>
<p><span style="color: #ff6600;">Method 3: Draw it in your font editing software</span></p>
<p>Tools You’ll Need</p>
<p>* Mouse<br />
* Font Editing software of your choice<br />
* The Steady Hand and Patience of a Deity</p>
<p>I’ve created a couple of fonts entirely in FontLab Studio, with just my mouse, a steady hand, and a healthy amount of invoking the Undo command. It can definitely be done, and you’ll potentially be able to generate more precise fonts this way, as opposed to drawing your glyphs outside of your font editor and then importing them. There are, as you might expect, lots of tools in font editing programs that are geared to this process: tools that generate straight lines and perfect curves, and guides that help you align everything with the utmost precision.</p>
<p><a rel="attachment wp-att-521" href="http://www.blog.4rwebsolutions.com/2011/01/you-want-to-create-a-font/capital-a/"><img class="alignnone size-large wp-image-521" title="capital-a" src="http://www.blog.4rwebsolutions.com/wp-content/uploads/2011/01/capital-a-425x479.gif" alt="" width="425" height="479" /></a></p>
<p>Coming Up Next…</p>
<p>Now you’ve got the tools of the trade, the desire to create a font, and a basic idea of the process involved. Of course, the devil is in the details. In the next instalment I’ll address some of the specifics of font creation and editing. Read So You Want to Create a Font&#8211;part two.</p>
<p><strong>Source: http://bit.ly/9A6stB</strong></p>
<p><strong>Author: Alec Julien</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.4rwebsolutions.com/2011/01/you-want-to-create-a-font/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy New Year!</title>
		<link>http://www.blog.4rwebsolutions.com/2010/12/happy-new-year/</link>
		<comments>http://www.blog.4rwebsolutions.com/2010/12/happy-new-year/#comments</comments>
		<pubDate>Fri, 31 Dec 2010 15:07:27 +0000</pubDate>
		<dc:creator>4rwebsolutions</dc:creator>
				<category><![CDATA[PoSt]]></category>

		<guid isPermaLink="false">http://www.blog.4rwebsolutions.com/?p=496</guid>
		<description><![CDATA[I wanted to wish you all an outstanding New Years&#8221;&#8221; celebration and my best wishes for the year to come. Let it be filled with joy, work, love, and happiness. 4r Salutes you from Mariano Di Maggio on Vimeo. Note: I want to thank a very appreciated client who send this awesome salutation card I [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to wish you all an outstanding New Years&#8221;&#8221; celebration and my best wishes for the year to come.</p>
<p>Let it be filled with joy, work, love, and happiness.</p>
<p><iframe src="http://player.vimeo.com/video/18321355" width="400" height="225" frameborder="0"></iframe>
<p><a href="http://vimeo.com/18321355">4r Salutes you</a> from <a href="http://vimeo.com/user5328686">Mariano Di Maggio</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>Note: I want to thank a very appreciated client who send this awesome salutation card I am sharing with you. Thanks <strong>Ugur</strong>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.4rwebsolutions.com/2010/12/happy-new-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 Things to do After Installing WordPress</title>
		<link>http://www.blog.4rwebsolutions.com/2010/12/10-things-to-do-after-installing-wordpress/</link>
		<comments>http://www.blog.4rwebsolutions.com/2010/12/10-things-to-do-after-installing-wordpress/#comments</comments>
		<pubDate>Mon, 27 Dec 2010 19:08:22 +0000</pubDate>
		<dc:creator>4rwebsolutions</dc:creator>
				<category><![CDATA[PoSt]]></category>
		<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.blog.4rwebsolutions.com/?p=493</guid>
		<description><![CDATA[The WordPress 5-minute install is great, nothing complicated about getting your blog up and running (most of the time). But once you install WordPress there are a number of other steps that you need to take in order to get the most from your blog. Use the following as a to-do checklist for your future [...]]]></description>
			<content:encoded><![CDATA[<p>The WordPress <a href="http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install">5-minute install</a> is great, nothing complicated about getting your blog up and running  (most of the time). But once you install WordPress there are a number of  other steps that you need to take in order to get the most from your  blog.</p>
<p>Use the following as a to-do checklist for your future installations and you’ll keep yourself right.</p>
<h2>1. Change the Admin Password and Manage Your Authors</h2>
<p>WordPress gives you some random concoction of a password that you’re <em>*never*</em> going to remember so the first thing you need to do is change this to something memorable.</p>
<p>Manage your user settings via the <em>Users</em> panel, and you can add any additional blog authors here.</p>
<h2>2. Edit Permalinks</h2>
<p>By default your articles’ urls will look something like <a href="http://www.leemunroe.com/?p=396">www.leemunroe.com/?p=396</a>. This url structure is poor for SEO and poor for usability (makes no sense to your users).</p>
<p>By changing your url structure to something like <a href="http://www.leemunroe.com/25-hot-female-web-designers">www.leemunroe.com/25-hot-female-web-designers</a> you can include the post’s keywords in the url and it makes more sense to your users.</p>
<ol>
<li>Go to <em>Settings &gt; Permalinks </em></li>
<li>Under ‘Common settings’ choose ‘Custom Structure’</li>
<li>Enter <strong><em>%postname%/</em></strong> in the field</li>
<li>Or if you prefer to have the category in the url as well, enter <em>%category%/%postname%/ </em></li>
</ol>
<p><img src="http://www.problogdesign.com/wp-content/uploads/2009/01/windowslivewriter10thingstodoafterinstallingwordpress-103b8pro-permalinks-01ff8047-bf93-4262-b274-490855b2ac08.jpg" border="0" alt="pro-permalinks" width="500" height="90" /></p>
<h2>3. Upload Your Theme and Activate It</h2>
<ol>
<li><a href="http://wordpress.org/extend/themes/">Download a theme</a> or design your own</li>
<li>Unzip and upload it to <em>wp-content &gt; themes</em></li>
<li>Activate it via <em>Appearance &gt; Themes</em> (then just click on your theme)</li>
</ol>
<h2>4. Add Your Categories and Change the Default</h2>
<p>When you install WordPress the default category is ‘Uncategorized’  and this just looks ugly. Assume at some point you’re going to post an  article and forget to select a category – what would you want that post  to come under by default? I tend to use <strong>News</strong> or something general like that.</p>
<ol>
<li>Go to <em>Posts &gt; Categories</em></li>
<li>Click on ‘Uncategorized’ to edit it – change it to ‘<strong>News</strong>‘ or similar</li>
<li>Add your other blog categories</li>
</ol>
<h2>5. Activate Akismet</h2>
<p><a href="http://akismet.com/">Akismet</a> is a plugin that blocks comment spam and if your blog allows comments then trust me, you’re going to get spammed.</p>
<p>Fortunately Akismet comes with WordPress, you just need to activate it.</p>
<ol>
<li>Go to the Plugins page in the admin area and activate Akismet</li>
<li>To complete Akismet activation, WordPress requires an API key. You can get this by registering on <a href="http://wordpress.com/">WordPress.com</a> then viewing your <a href="http://wordpress.com/profile/">profile</a>.</li>
<li>Now go to <em>Plugins &gt; Akismet Configuration</em>, and paste in your key.</li>
</ol>
<p><img src="http://www.problogdesign.com/wp-content/uploads/2009/01/windowslivewriter10thingstodoafterinstallingwordpress-103b8pro-akismet-66f038b4-2f72-4e0a-baaa-bc85c83596ac.jpg" border="0" alt="pro-akismet" width="450" height="125" /></p>
<h2>6. Install Google XML Sitemaps</h2>
<p><a href="http://wordpress.org/extend/plugins/google-sitemap-generator/">Google XML Sitemaps</a> generates a compliant XML-Sitemap for your site, allowing the major  search engines (Google, Yahoo, Ask, MSN) to easily index your site.  Every time you edit or add a post, the sitemap will modify itself.</p>
<p><a href="http://wordpress.org/extend/plugins/google-sitemap-generator/">Click here for Google XML Sitemaps plugin.</a></p>
<p>Now go to <a href="https://www.google.com/webmasters/tools/">Google Webmaster Central</a> and log in with your Google Account. On the first page, there will be a  link to “Verify” your site. Follow the instructions there.</p>
<p>Once that’s done, you can then click the “Add Sitemap” link from the  first page and put in the URL to your sitemap, which will be <em>http://www.yoursite.com/sitemap.xml</em></p>
<p><img src="http://www.problogdesign.com/wp-content/uploads/2009/01/windowslivewriter10thingstodoafterinstallingwordpress-103b8pro-sitemaps-943e6cde-2f91-4473-ac14-10cb05f27435.jpg" border="0" alt="pro-sitemaps" width="450" height="140" /></p>
<h2>7. Install WordPress Database Backup</h2>
<p>Always good to have a backup in place. Things may go wrong with your server, or you could even make a mistake yourself.</p>
<p><a href="http://wordpress.org/extend/plugins/wp-db-backup/">WordPress Database Backup</a> will backup your WordPress blog, and you can even set it so it will  email you a backup on a weekly basis, so you don’t have to do anything  yourself but activate it.</p>
<p><a href="http://wordpress.org/extend/plugins/wp-db-backup/">Click here for WordPress Database Backup plugin</a>, or read a complete <a href="http://www.problogdesign.com/wordpress/the-perfect-hands-free-database-backup/">guide to automatic backups</a> on Pro Blog Design.</p>
<p><img src="http://www.problogdesign.com/wp-content/uploads/2009/01/windowslivewriter10thingstodoafterinstallingwordpress-103b8pro-backup-e1e45961-0cca-4db3-9a67-040099f7b152.jpg" border="0" alt="pro-backup" width="450" height="120" /></p>
<h2>8. Test Your Blog With Dummy Content</h2>
<p>You’ll not know what your blog will truly look like until you have  thoroughly tested it with multiple posts and all types of formatting  applied.</p>
<p>Save yourself some time by using this <a href="http://wpcandy.com/articles/easier-theme-development-with-the-sample-post-collection.html">sample post collection from WP Candy</a>.</p>
<p>Import the sample post collection (<em>Tools &gt; Import &gt; WordPress</em>)  and your blog will compile with sample posts including comments,  parent/child categories and formatting, allowing you to thoroughly test  it and make any theme alterations.</p>
<h2>9. Add your RSS feed to Feedburner</h2>
<p>First edit your RSS settings. <em>Settings &gt; Reading</em> and you can edit how many posts you want to show in your RSS feed and whether they should show the full post or not.</p>
<p>Now you want to burn your feed with <a href="http://www.feedburner.com/">Feedburner</a>.  Feedburner will provide you with stats on your feeds and automatically  ping services so your new content is updated immediately along with a  whole host of other services.</p>
<p>Once you have signed up to Feedburner, change your feed subscription  link in your theme. Place the following code between the head tags.</p>
<div>
<table>
<tbody>
<tr>
<td>
<pre>1
</pre>
</td>
<td>
<pre>&lt;link rel="alternate" type="application/rss+xml" title="Feed Title" href="YOUR FEEDBURNER URL" /&gt;</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p><img src="http://www.problogdesign.com/wp-content/uploads/2009/01/windowslivewriter10thingstodoafterinstallingwordpress-103b8pro-feedburner-5981e3cc-1cbe-40a9-9661-407e2c6dc72a.jpg" border="0" alt="pro-feedburner" width="450" height="150" /></p>
<h2>10. Activate your Analytics</h2>
<p>Keep track of your users and traffic. I recommend <a href="http://www.google.com/analytics/">Google Analytics</a>. Other good analytic services available include <a href="http://haveamint.com/">Mint</a> and <a href="http://statcounter.com/">StatCounter</a>.</p>
<h2>Optional</h2>
<p>Here’s a few optional to-dos. Not as major as the above but you still might need to check them.</p>
<h3>Change your Media image sizes</h3>
<p>Change your image sizes depending on the size of your content area.</p>
<p><em>Settings &gt; Media</em></p>
<h3>Change your blog tagline</h3>
<p>Your tagline may or may not be included in your theme but it’s most likely included in your RSS feed.</p>
<p><em>Settings &gt; General</em></p>
<p><em>Source: </em>http://bit.ly/9ZWLoq</p>
<p><em>Author: </em><strong>Michael Martin</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.4rwebsolutions.com/2010/12/10-things-to-do-after-installing-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exploring new input types in HTML 5</title>
		<link>http://www.blog.4rwebsolutions.com/2010/12/exploring-new-input-types-in-html-5/</link>
		<comments>http://www.blog.4rwebsolutions.com/2010/12/exploring-new-input-types-in-html-5/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 18:09:44 +0000</pubDate>
		<dc:creator>4rwebsolutions</dc:creator>
				<category><![CDATA[PoSt]]></category>
		<category><![CDATA[Mark-up]]></category>

		<guid isPermaLink="false">http://www.blog.4rwebsolutions.com/?p=489</guid>
		<description><![CDATA[Source: http://bit.ly/bh9dsC HTML 5 is not only about the endless possibilities of the &#60;canvas&#62; element or the awesome multimedia support with the &#60;video&#62; tag. HTML 5 offers a wide new range of input types for specific situations, such as url, email, date, etc. In this post we will explore these new HTML 5 input types, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Source: http://bit.ly/bh9dsC</strong></p>
<p>HTML 5 is not only about the endless possibilities of the <strong>&lt;canvas&gt;</strong> element or the awesome multimedia support with the <strong>&lt;video&gt;</strong> tag. HTML 5 offers a wide new range of input types for specific  situations, such as url, email, date, etc. In this post we will explore  these new HTML 5 input types, along with the <strong>&lt;datalist&gt;</strong> element, a welcome addition to most input fields that your users will love.</p>
<p>We have talked in the past about the outstanding <a title="Pocket guide to HTML 5 video" href="http://www.ilovecolors.com.ar/html5-video/" target="_blank">video capabilities in HTML </a>5, but video elements are not even close to be as ubiquitous as web forms. Even the most simple <strong>search</strong> field is a form and  web applications based in HTML 5 are all about  forms. Forms are our way to interact with the web and fortunately, the  new HTML 5 specification has some very good enhancements to web forms.</p>
<p>For the correctly display of the demo, you should open the demo page  in Opera and Chrome. Firefox and Safari lacks support for most new input  types. Chrome supports only a few and Opera supports most features.</p>
<p>We’re going to go through each form so load up the demo in a separate tab and let’s start exploring the new input types.</p>
<p><a title="HTML 5 New Input Types - ilovecolors" href="http://www.ilovecolors.com.ar/wp-content/uploads/html5-new-input-types.html" target="_blank">Launch HTML 5 new input types example</a></p>
<p>There’s no additional stylesheet applied to the forms so you can see what they look like out-of-the-box.</p>
<h2>Sliders</h2>
<p>The first new type acts like a slider. The type name is <strong>range</strong> and you can set the minimum value, the maximum value and the step.</p>
<pre>&lt;fieldset&gt;
 &lt;legend&gt;Sliders&lt;/legend&gt;
 &lt;label for="radioactivity"&gt;Radioactivity Level&lt;/label&gt;
 &lt;input id="radioactivity" name="radioactivity" type="range" min="-100" max="100" value="0" step="20"&gt;
 &lt;label for="slider2"&gt;Bigger step&lt;/label&gt;
 &lt;input id="slider2" name="slider2" type="range" min="-100" max="100" value="0" step="50"&gt;
&lt;/fieldset&gt;</pre>
<p>Opera renders tick marks according to the step size, so you can see  they are far more spaced in the second slider since the value is more  than twice the top one.</p>
<h2>Steps</h2>
<p>Another new input type in HTML 5 is <strong>number</strong>. When an  input is defined as such, it will display arrows pointing up and down to  increment the number displayed in the field. You can also set minumum  and maximum value as well as the step.</p>
<pre>
<div><code>&lt;</code><code>fieldset</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>legend</code><code>&gt;Steps&lt;/</code><code>legend</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>label</code> <code>for</code><code>=</code><code>"step"</code><code>&gt;How old are you?&lt;/</code><code>label</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>input</code> <code>id</code><code>=</code><code>"step"</code> <code>name</code><code>=</code><code>"step"</code> <code>type</code><code>=</code><code>"number"</code> <code>min</code><code>=</code><code>"1"</code> <code>value</code><code>=</code><code>"25"</code> <code>max</code><code>=</code><code>"99"</code><code>&gt; &lt;</code><code>span</code><code>&gt;years old&lt;/</code><code>span</code><code>&gt;&lt;</code><code>br</code><code>/&gt;&lt;</code><code>br</code><code>/&gt;</code></div>
<div><code> </code><code>&lt;</code><code>label</code> <code>for</code><code>=</code><code>"step2"</code><code>&gt;Floating numbers too!&lt;/</code><code>label</code><code>&gt;</code></div>
<div><code> </code><code>&lt;</code><code>input</code> <code>id</code><code>=</code><code>"step2"</code> <code>name</code><code>=</code><code>"step2"</code> <code>type</code><code>=</code><code>"number"</code> <code>min</code><code>=</code><code>"1.5"</code> <code>value</code><code>=</code><code>"25.5"</code> <code>max</code><code>=</code><code>"30.5"</code> <code>step</code><code>=</code><code>"0.5"</code><code>&gt; &lt;</code><code>span</code><code>&gt;years old&lt;/</code><code>span</code><code>&gt;</code></div>
<div><code>&lt;/</code><code>fieldset</code><code>&gt;</code></div>
</pre>
<div>
<p>The field supports floating point numbers, but the values must be  entered as floating point numbers. This input currently works in the  same way for both Opera and Chrome</p>
<h2>Date and time</h2>
<p>We now have new input types for date and time. The terms for each type shown in the example are:</p>
<ul>
<li>time</li>
<li>date</li>
<li>week</li>
<li>month</li>
<li>datetime</li>
</ul>
</div>
<pre>&lt;fieldset&gt;
 &lt;legend&gt;Date and time&lt;/legend&gt;
 &lt;label for="time"&gt;Time&lt;/label&gt;
 &lt;input id="time" name="time" type="time" value="12:00"&gt;&lt;br/&gt;&lt;br/&gt;
 &lt;label for="date"&gt;Date&lt;/label&gt;
 &lt;input id="date" name="date" type="date" value="2010-11-02"&gt;
 &lt;label for="week"&gt;Week&lt;/label&gt;
 &lt;input id="week" name="week" type="week" value="2010-W45"&gt;
 &lt;label for="month"&gt;Month&lt;/label&gt;
 &lt;input id="month" name="month" type="month" value="2010-11"&gt;&lt;br/&gt;&lt;br/&gt;
 &lt;label for="datetime"&gt;Datetime&lt;/label&gt;
 &lt;input id="datetime" name="datetime" type="datetime" value="1997-08-29T02:14Z"&gt;&lt;br/&gt;&lt;br/&gt;
&lt;/fieldset&gt;</pre>
<div>
<p>Strangely enough there is no <strong>year</strong> type. Check this example with Opera, since it’s not implemented in Chrome. In Opera, the <strong>time</strong> type is shown with step arrows like the previous field and a complete calendar is displayed the <strong>date</strong>, <strong>week</strong>, <strong>month</strong>, <strong>datetime</strong> types.</p>
<p>The drawback is that the control is not customizable through CSS so  if you want a custom calendar you will have to use a calendar based in <a href="http://ilovecolors.com.ar/category/jquery/" target="_blank">jQuery</a>.  The advantage is that since the control is in the browser, it is  localized, as you can see in the leading image for this article, where  I’ve left the calendar as shown in Opera in spanish.</p>
<h2>Email, URL, Telephone, Search and Color</h2>
<p>HTML 5 now include special input types to handle each one of these  data. And even if they look right now like any other common input field,  browsers could add different user input functionality depending on  which one is selected, providing an optimal <a href="http://ilovecolors.com.ar/tag/user-experience/" target="_blank">user experience</a>. For example, the email field supports an additional <strong>multiple</strong> boolean attribute that indicates that the field will be populated with many email addresses.</p>
<pre>&lt;fieldset&gt;
 &lt;legend&gt;email, url, tel and search&lt;/legend&gt;
 &lt;label for="email"&gt;Email address&lt;/label&gt;
 &lt;input id="email" name="email" type="email"&gt;
 &lt;label for="website"&gt;Website&lt;/label&gt;
 &lt;input id="website" name="website" type="url" placeholder="http://"&gt;&lt;br/&gt;&lt;br/&gt;
 &lt;label for="query"&gt;Search&lt;/label&gt;
 &lt;input id="query" name="query" type="search" size="30" placeholder="type your search and hit enter"&gt;&lt;br/&gt;&lt;br/&gt;
 &lt;label for="phone"&gt;Telephone&lt;/label&gt;
 &lt;input id="phone" name="phone" type="tel" autofocus&gt;&lt;br/&gt;&lt;br/&gt;
 &lt;label for="bgcolor"&gt;Color&lt;/label&gt;
 &lt;input id="bgcolor" name="bgcolor" type="color"&gt; &lt;span&gt;(Not yet implemented by any browser)&lt;/span&gt;
&lt;/fieldset&gt;</pre>
<p>You will also notice a <strong>placeholder</strong> attribute for  some of the input fields. To see it rendered, visit the page using  Chrome, since it’s not yet implemented in Opera. It’s simply the default  value for the text input, that we once coded using <a href="http://ilovecolors.com.ar/tag/javascript" target="_blank">JavaScript</a>, now easier than ever to set up.</p>
<h2>The new Datalist element</h2>
<p>If you clicked inside the email field in the demo in Opera, you surely noticed the autocomplete list that is displayed. The <strong>datalist</strong> element is a source of data for one particular field and accepts a  value and a label as attributes. Let’s see the full markup for the email  field in the demo:</p>
<pre>&lt;label for="email"&gt;Email address&lt;/label&gt;
&lt;input id="email" name="email" type="email" multiple="multiple" list="addresses"&gt; &lt;span&gt;To add multiple addresses, type a comma after selecting an address.&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;
&lt;datalist id="addresses"&gt;
 &lt;option value="sconnor@sky.net" label="Sarah Connor"&gt;
 &lt;option value="jconner@sky.net" label="John Connor"&gt;
 &lt;option value="kreese@sky.net" label="Kyle Reese"&gt;
 &lt;option value="cphillips@sky.net" label="Cameron Phillips"&gt;
&lt;/datalist&gt;</pre>
<p>Notice the <strong>list</strong> attribute in the email input. It’s set to <em>addresses</em>, which is the <em>id</em> of the <strong>datalist</strong> element. The <strong>datalist</strong> element is then populated with different <strong>option</strong> elements, each one with their value, which is mandatory, and a label, which is not required.</p>
<h2>The future of web forms</h2>
<p>There are a number of other new attributes supported by forms, such as <strong>autofocus</strong>, that will put the focus on the field where it is applied when the page is loaded, and <strong>required</strong>, that will allow us to forget about jQuery form fields validation.</p>
<p>Moreover, we will have pseudo selectors like</p>
<div>
<pre><code>input[type=email]:required{ </code><code>background-color</code><code>: </code><code>#F6F6CC</code> <code>}</code></pre>
</div>
<div>
<div id="highlighter_640302">
<table style="height: 2px;" border="0" cellspacing="0" cellpadding="0" width="4">
<tbody>
<tr>
<td>
<div>
<div><code><br />
</code></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>for easy form styling.</p>
<p>As HTML 5 gains more momentum, each one of its features are being  enhanced. Web applications will surely benefit from working with  standard controls like the upcoming <strong>color</strong> input type.  This will reduce the weight of applications, since they do no longer  have to download jQuery, stylesheets and images to create and stylize  the control.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.4rwebsolutions.com/2010/12/exploring-new-input-types-in-html-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drop-Shadows and Gradients: Be Consistent in Your Visual Metaphors</title>
		<link>http://www.blog.4rwebsolutions.com/2010/12/drop-shadows-and-gradients-be-consistent-in-your-visual-metaphors/</link>
		<comments>http://www.blog.4rwebsolutions.com/2010/12/drop-shadows-and-gradients-be-consistent-in-your-visual-metaphors/#comments</comments>
		<pubDate>Tue, 14 Dec 2010 13:02:41 +0000</pubDate>
		<dc:creator>4rwebsolutions</dc:creator>
				<category><![CDATA[PoSt]]></category>

		<guid isPermaLink="false">http://www.blog.4rwebsolutions.com/?p=486</guid>
		<description><![CDATA[Drop-shadows and gradients are two of the most common design elements on the web. You’ll find them accompanying many different styles. They’re handy effects for web designers because they’re attractive, useful and easy to create with any graphics program. But they have a dark side: they’re frequently abused. Using amateurish drop-shadows or gradients is almost [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Drop-shadows and gradients</strong> are two of the most common design elements on the web.</p>
<p>You’ll  find them accompanying many different styles. They’re handy effects for  web designers because they’re attractive, useful and easy to create  with any graphics program. But they have a dark side: <strong>they’re frequently abused</strong>.</p>
<p>Using  amateurish drop-shadows or gradients is almost as bad as affixing a  scarlet letter to your shirt to let the world know you’re a beginner or a  hack. Even subtle, barely noticeable mistakes can create tensions that  undermine otherwise beautiful and effective designs.</p>
<p>In this article, we’ll look at <strong>what</strong> <strong>drop-shadows and gradients do</strong>, we’ll talk about <strong>how to use them effectively</strong> and we’ll look at some examples of mistakes and how to fix them.</p>
<div id="top-ads-block">
<div id="bsap_1251693"><a id="bsa_591912" title="WordPress Themes" href="http://stats.buysellads.com/click.go?z=1251693&amp;b=591912&amp;g=&amp;s=&amp;sw=1579&amp;sh=1263&amp;br=firefox,3.6,win&amp;r=0.25145320486595313&amp;link=http://www.templatesold.com" target="_blank"><img src="http://s3.buysellads.com/1251693/37783-1285646981.jpg" alt="WordPress Themes" width="500" height="80" /></a></div>
</div>
<h2>What Do Drop-Shadows and Gradients Do?</h2>
<p>The job of a web designer is to create <strong>patterns of color for glowing two-dimensional screens</strong>.  (There are a few exceptions to this: websites can be viewed on, say, a  Kindle screen, which doesn’t glow; and websites can be printed out on  paper.) These screens do not reflect the real world; they’re not even  very much <em>like</em> the real world. For this reason, we have no real  imperative to make the patterns on our websites bear any relationship  to objects in the three-dimensional world we live in.</p>
<p>Operating  systems like Unix and DOS have an interface that is nothing but colored  text on a screen. Others, like Windows and Mac OS X, are filled with the  illusions of real objects. OS X, for instance, has a dock that looks  like a table with a shiny surface that recedes in the distance, a menu  bar whose beveled edges make it look like it bulges out slightly, and  scroll bars that appear to have translucent lozenges.</p>
<p><img src="http://netdna.webdesignerdepot.com/uploads/drop_shadows_gradients/2.jpg" alt="" /></p>
<p>All  of these effects are metaphors. They treat certain elements that we can  interact with on screen as though they were three-dimensional objects  that interact with light sources in the way that objects in the  non-digital world do. It’s a funny thing to do, in a way: all of these  light sources and edges and shapes are pure fantasy. Because the objects  on the screen are imaginary, why should we relate them to the objects  in the real world?</p>
<p><strong>The illusion of space connects the imaginary to a world we are comfortable living in.</strong></p>
<p>The  most important reason why we relate imaginary objects to real-world  ones is that we are experts at interacting with objects in our  three-dimensional world. We have experience in dealing with  three-dimensional objects, and we have accumulated knowledge of the  visual code that tells us about the relationships of objects to each  other in space.</p>
<p>It’s partially because the feat of interpreting  light is so remarkable that we take such pleasure in illusion, or in  creating the <em>appearance</em> of objects. We are often more engaged  by dramatically life-like paintings of common objects like houses and  apples than we are by the objects themselves. We humans have created  drawings for thousands of years that are intended to present the <em>ideas</em> of objects. Illusory lozenges and tables on the screen are nothing but the most recent manifestation of this long tradition.</p>
<p>There’s more to it than pleasure, though. Shape and position give us <strong>information</strong> about how objects relate to each other. The long vertical lozenge shape  of the scroll bar in the Safari window, for instance, creates the  illusion that it sits “higher,” or closer, to me than the elements  surrounding it. This gives it greater importance in the design, which is  appropriate because the scroll bar is an essential interface element  for navigating the page.</p>
<p><strong>Visual metaphors create perceived affordance.</strong></p>
<p>By appearing as an object, the scroll bar creates “perceived <a rel="nofollow" href="http://en.wikipedia.org/wiki/Affordance">affordance</a>.”  That is, it links itself by way of metaphor to the properties of real  objects that lend themselves to particular uses. A beveled button on a  web page, for instance, communicates that it <strong>affords pressing</strong>.  We can make anything on a page clickable, but associating a clickable  element with the image of something pressable suggests its function in a  clear, obvious and even pleasing way.</p>
<p><strong>Drop-shadows and gradients are basic tools for creating the illusion of space.</strong></p>
<p>Drop-shadows  and gradients are two tools that help create the illusion of  three-dimensionality and suggest the spatial relationships of objects on  the page. When done well, this three-dimensional information makes a  design more beautiful and more understandable.</p>
<p>In the real world, drop-shadows are created when an object blocks a light source from striking a surface that is <em>behind</em> it. This is one of the reasons why people say that drop-shadows make  two-dimensional designs “pop”: because they make objects appear to stick  out from, or float above, other elements.</p>
<p>Gradients appear when  one part of an object is closer to a light source than another part. As a  result, the closer part appears lighter, and the farther part appears  darker. (Gradients get more complex, of course, when multiple light  sources interact or when light sources have different colors.)</p>
<p>So, by mimicking the effects of light in the real world, drop-shadows and gradients <strong>communicate information about metaphorical objects, imaginary light sources and their relationships.</strong></p>
<p><strong><br />
</strong></p>
<h2>How To Use Drop-Shadows and Gradients Effectively</h2>
<p><strong>Here is one possibility: don’t use drop-shadows or gradients at all.</strong></p>
<p>I  mean this, seriously. This is the surest way to avoid drop-shadow and  gradient mistakes, and the option should always be considered.</p>
<p>Because  tossing drop-shadows on random objects is so easy, they can be an  excuse to avoid simpler, better solutions to problems. For bits of text  that need to be more prominent, for example, designers will often  neglect color, size, weight of the type and many other elements in favor  of a drop-shadow.</p>
<p>Similarly, designers often use gradients to  make a field of color seem less boring, without figuring out why the  overall composition is not dynamic.</p>
<p>If you’re working on a comp for a website, <strong>save three-dimensional touches such as drop-shadows and gradients for the end</strong>,  if at all possible. Use spacing, placement and color to make the design  effective before adding the final layer of polish. If you focus on  making your designs work without these tricks, you may find that you  don’t need them as often, and that they are more effective when you do  use them.</p>
<p>Before you plop in a drop-shadow or a gradient, ask yourself, “<strong>Is a three-dimensional metaphor necessary for this design?”</strong> Am I using it to add useful information about the way objects are  related or as an effective component of a sound aesthetic approach, or  am I using it as an excuse?”</p>
<h2>The Subtler, the Better</h2>
<p><strong>For drop-shadows</strong>,  almost never use Photoshop’s default settings. Photoshop’s default  drop-shadow is very dark and is cast to the lower-right corner of an  object (the default global light source being 120°, in the upper-left).</p>
<p><img src="http://netdna.webdesignerdepot.com/uploads/drop_shadows_gradients/1.jpg" alt="" width="300" height="190" /></p>
<p>Shadows  tell you about the light in your environment. Suppose you’re in a dark  room with no windows, and you turn on a flashlight. Any object that you  shine it on will cast a shadow that’s almost black. That’s because the  object is blocking light from the only light source, meaning that no  other light is coming from anywhere else to brighten that area.</p>
<p>Now, the shadow won’t be <em>completely</em> black because of the reflected light. Some of the light from your  flashlight will bounce off the walls and hit the shadowed area from a  direction that’s not blocked by the object. And if you turn on a lamp in  another corner of the room, the shadow will brighten considerably. The  object will cast a second shadow: the new shadow will appear where the  light from the lamp is blocked but will be filled with the light from  the flashlight, while the area of the first shadow will still be blocked  by the light from the flashlight but will be filled with the light from  the lamp.</p>
<p>When we add drop-shadows to our designs, we suggest an  imaginary environment for our web page. Dark, hard-edged drop-shadows  suggest a dark room with a single light source. Light, soft-edged  drop-shadows suggest a room rich with diffuse light.</p>
<p>A well-lit  room is the most comfortable environment for users, because it is  similar to the kind of environment where we use our computers: an office  or study. Unless we deliberately want to avoid that comfort zone, we  should bring the drop-shadow settings in Photoshop way down from their  defaults. Bring the opacity down to 30 or 40%, or even lower.</p>
<p>Also,  keep things simple so that people understand the metaphor without  thinking about it. A light source at 120° does not makes much sense. Mac  OS X, for instance, puts its light source at 90°, or straight above,  which seems more logical. I like to make it even simpler and put the  light source directly perpendicular to the screen. To do this, just  bring the distance setting on your drop-shadow to zero (this represents  the distance from the object that casts the drop-shadow to the object  beneath it). At this point, global light doesn’t matter: it’s simply as  if a big diffuse light source is coming from behind the user to  illuminate the design.</p>
<p>This effect is very common in <em>“trompe-l’œil” </em>designs,  the most common of which features the background image or frame of a  desk surface, as if one were looking at it from straight above. Film  directors such as Alfred Hitchcock, Martin Scorcese and <a rel="nofollow" href="http://www.thehousenextdooronline.com/2009/04/wes-anderson-substance-of-style-pt-2.html">Wes Anderson</a> employ the same effect for their signature God’s-eye-view shots. Such  web designs have a kind of effortless comprehensibility, and maintaining  consistency across a design becomes easier for the designer.</p>
<p>If  you’ve brought the distance setting down to 0 and the opacity down to  about 30%, you’re at a good starting point for a drop-shadow. Play  around with the size to change how far the surface of the object appears  to be from the background on which it sits. Setting the size to 1  pixel, for example, gives you a beautiful effect that’s almost invisible  but quite pleasing. Designer <a rel="nofollow" href="http://simplebits.com/">Dan Cederholm</a> has made small, simple effects like this an integral part of his style  (as demonstrated in his seminal A List Apart article on “<a rel="nofollow" href="http://www.alistapart.com/articles/mountaintop/">Mountaintop Corners</a>“).</p>
<p>You  can certainly bring the opacity up if the effect is invisible, but  starting subtle and then dialing it up is much better than the opposite.  The effect should not be the slightest bit more overt than it needs to  be.</p>
<p><strong>For gradients,</strong> Photoshop has a lot of fancy  defaults. These may have some good uses, but they certainly have  unlimited poor uses, so steering clear of them is usually wise.</p>
<p>Instead, select the default black-to-white gradient. Then select both the black and the white and make them <em>both</em> the base color of your element. Now that you have a base, pick either the dark side or the light side and adjust it to be <em>just slightly</em> darker or lighter. Again, <strong>the subtler, the better</strong>.  (Some of the best gradients I’ve come across I had to verify with the  eyedropper tool in Photoshop to make sure they were there at all!)</p>
<p>The  greater the contrast between the light and dark, the rounder the  surface will appear. For some things, such as navigation menus and  buttons, some roundness is appropriate. But for objects that should  appear flat, keep the contrast low.</p>
<p>And remember, the lighter side should face the direction of your light source.</p>
<p>This  kind of gradient is wonderful because it mimics the gradients we see  around us all the time. Nothing in the real world is truly a single  color field, because it always has some kind of relationship to a light  source. Look carefully at the pages in a book or at the ceiling around  your overhead light: you’ll find gradients everywhere.</p>
<h2>Examples of Mistakes and How to Fix Them</h2>
<p>The  web has many obviously ugly gradients, but these are not usually done  by professional designers. Rather than show egregious mistakes, I’ll  illustrate a few ways in which subtle errors can create tensions in  otherwise excellent designs.</p>
<h3>Uniform Shadows for Overlapping Objects</h3>
<p><img src="http://netdna.webdesignerdepot.com/uploads/drop_shadows_gradients/uniformdrop1.gif" alt="" width="615" height="300" /></p>
<p>Overlapping  objects imply a difference in their distance from you (determined  partly by their thickness). Designers, though, frequently use identical  drop-shadows for overlapping objects. So, the information conveyed by  the drop-shadows conflicts with the information conveyed by the overlap,  undermining the illusion of dimensionality.</p>
<p>Seeing conflicts such  as these makes me uneasy, and the more I focus on them, the more my  head hurts. Users should take pleasure in your design, not feel pain!</p>
<p><img src="http://netdna.webdesignerdepot.com/uploads/drop_shadows_gradients/uniformdrop2.gif" alt="" width="615" height="300" /></p>
<p>You can read more about this issue in “<a rel="nofollow" href="http://desktoppub.about.com/od/creategraphics/ss/dropshadows_3.htm">Build a Better Drop-Shadow</a>,” a guide by Jacci Howard Bear on About.com.</p>
<h3>Abrupt Edges</h3>
<p>The  corners of real drop-shadows wouldn’t have hard edges unless they had  absolutely no reflected light—which would be a very unusual situation.  Rather, their corners are usually rounded by the rays of light that  creep around them.</p>
<p>Here’s a drop-shadow with an unrealistically hard edge:</p>
<p><a title="Reuters" rel="nofollow" href="http://www.reuters.com/"><img src="http://netdna.webdesignerdepot.com/uploads/drop_shadows_gradients/reuters1.jpg" alt="" width="615" height="425" /></a></p>
<p><img src="http://netdna.webdesignerdepot.com/uploads/drop_shadows_gradients/reuters3b.jpg" alt="" width="88" height="87" /></p>
<p>This  otherwise lovely design has almost no dimensional illusion anywhere but  has a drop-shadow along the right sidebar. The designer perhaps wanted  to lower the sidebar’s hierarchy on the page, an effect that its blue  background helps achieve. Not only is it unnecessarily dark, though, but  the implausibly hard edge stares the visitor in the face.</p>
<p>At the  bottom of the sidebar, you can see a rounded transition, where the  designer has created a more plausible effect. But you can see why he  didn’t repeat it at the top, because it would jar with the clean  horizontal line set by the well-aligned top elements. Rather than demand  the realism of this rounded transition, let’s fix it by toning down the  drop-shadow as much as possible.</p>
<p><img src="http://netdna.webdesignerdepot.com/uploads/drop_shadows_gradients/reuters4.jpg" alt="" width="615" height="272" /></p>
<p>Here,  I have made the drop-shadow so light that it does little more than  suggest it is sitting farther back. Because it’s so light, the clean  line of transition isn’t ugly or distracting.</p>
<h3>What the heck is going on behind that object?</h3>
<p>Sometimes, a drop-shadow goes nuts for no obvious reason, as with the blue box surrounding the W3C logo below.</p>
<p><a rel="nofollow" href="http://www.w3.org/"><img src="http://netdna.webdesignerdepot.com/uploads/drop_shadows_gradients/w3c.jpg" alt="" width="615" height="246" /></a></p>
<p>Why  is the drop-shadow so far back from the object, and so rounded? The  more I try to understand the story being told by this drop-shadow, the  more confused I get. My guess is that the designer wanted to give more  prominence and weight to the logo, which the drop-shadow helps  accomplish, but it disrupts the harmony of the page so much that it’s  not worth it.</p>
<h3>Don’t let your gradients suggest different light sources.</h3>
<p>In  this otherwise excellent design for WolframAlpha, objects on the page  have gradients ranging from white to pale orange. The problem is that  the gradient in the header region has white at the top, implying light  from above, while the page elements lower down have white at the bottom,  implying light from below.</p>
<p><a rel="nofollow" href="http://www.wolframalpha.com/"><img src="http://netdna.webdesignerdepot.com/uploads/drop_shadows_gradients/wolfram1.gif" alt="" width="615" height="246" /></a></p>
<p>You  could argue that I’m over-thinking this, that gradients don’t have to  match up with light sources. That’s possible, but subtle gradients like  these have an inherent metaphorical relationship to the gradients we see  in the real world. Let’s switch the direction of the gradients lower  down on the page so that they imply a light source from above:</p>
<p><img src="http://netdna.webdesignerdepot.com/uploads/drop_shadows_gradients/wolfram2.gif" alt="" width="615" height="246" /></p>
<p>And we get light source harmony.</p>
<h2>Ultimately, you’re free to do as you please.</h2>
<p>Because  the objects on a web page relate to real objects only by metaphor,  their effectiveness is essentially subjective. The connection between an  image of a button and an actual button has no reality beyond the mind  of the user.</p>
<p>We designers are not required to make our metaphors  consistent with reality, but being thoughtful and careful about the many  levels of communication in a design helps us make our websites more  harmonious.</p>
<p>And our care and consistency helps make the user’s experience of the website comfortable and even delightful.</p>
<p>Author: Nate Eagle</p>
<p>Source: http://bit.ly/6tWhXV</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.4rwebsolutions.com/2010/12/drop-shadows-and-gradients-be-consistent-in-your-visual-metaphors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 for Beginners – Migrating from Flash 8 to Flash CS3 Professional</title>
		<link>http://www.blog.4rwebsolutions.com/2010/12/as3-for-beginners-migrating-from-flash-8-to-flash-cs3-professional/</link>
		<comments>http://www.blog.4rwebsolutions.com/2010/12/as3-for-beginners-migrating-from-flash-8-to-flash-cs3-professional/#comments</comments>
		<pubDate>Mon, 06 Dec 2010 14:41:37 +0000</pubDate>
		<dc:creator>4rwebsolutions</dc:creator>
				<category><![CDATA[PoSt]]></category>

		<guid isPermaLink="false">http://www.blog.4rwebsolutions.com/?p=469</guid>
		<description><![CDATA[Here is a very nice tutorial for everyone migrating from flash 8 to flash cs3 by Jen deHaan @ Adobe: Adobe® Flash® CS3 Professional introduces many new and changed elements in the workspace that improve the way you work with Flash. It also features new tools you can use to create exciting new applications, or [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>Here is a very nice tutorial for everyone  migrating from flash 8 to flash cs3 by Jen deHaan @ Adobe: Adobe® Flash®  CS3 Professional introduces many new and changed elements in the  workspace that improve the way you work with Flash. It also features new  tools you can use to create exciting new applications, or [...]</p>
</div>
<p>Here is a very nice tutorial for everyone migrating from flash 8 to flash cs3 by Jen deHaan @ Adobe:</p>
<p><em>Adobe® Flash® CS3 Professional introduces many new and changed  elements in the workspace that improve the way you work with Flash. It  also features new tools you can use to create exciting new applications,  or integrate with other components of Adobe Creative Suite 3.</em></p>
<p><em>This article discusses the new features in Flash CS3 Professional  and how they compare to similar features in Flash 8, or how they have  changed. Therefore, it’s written with the assumption that you’re already  somewhat familiar with Flash. If you are a Flashthusiast ready to  update to Flash CS3, read on. You will learn about the changes you need  to know about when starting out with the latest version of Flash,  whether you want to draw with the enhanced Pen tool or write  ActionScript™ 3.0 code. Specifically, this article covers:</em> <em></em></p>
<p><em>- Changes made to the Flash workspace, such as new ways to  manipulate panels and great new interface features. You also learn how  to optimize your workspace to make working with Flash easier.</em> <em></em></p>
<p><em>- New features in the Flash authoring tool, such as control over  the color of your bounding boxes, new copy-and-paste functionality, and  changes to 9-slice scaling.</em> <em></em></p>
<p><em>- Improvements made to file import, such as support for PSD and  AI files. You also learn about new ways to integrate products, such as  the enhanced workflow between Flash and Adobe® Device Central CS3.</em> <em></em></p>
<p><em>- Improvements to the drawing tools in Flash, such as enhancements  to the Pen tool, and the brand new primitive drawing tools that let you  create shapes easier.</em> <em></em></p>
<p><em>- Improvements to the video components and cue points in Flash and Flash Video Encoder.</em> <em></em></p>
<p><em>- The new ActionScript 3.0 components, including how they compare  to the V2 Components found in Flash 8. You will also see a side-by-side  comparison of how to create the same components application in  ActionScript 2.0 and ActionScript 3.0.</em> <em></em></p>
<p><em>- Improvements to the debugger and coding tools in Flash, and  changes to ActionScript. You will find a side-by-side comparison of  ActionScript 2.0 code and ActionScript 3.0 code. You’ll also learn  about, and how to use, a document class in an ActionScript 3.0  application.</em></p>
<p>Source: http://bit.ly/h1KaZY</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.4rwebsolutions.com/2010/12/as3-for-beginners-migrating-from-flash-8-to-flash-cs3-professional/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Guide to creating 3D Text in Adobe Illustrator</title>
		<link>http://www.blog.4rwebsolutions.com/2010/12/a-guide-to-creating-3d-text-in-adobe-illustrator/</link>
		<comments>http://www.blog.4rwebsolutions.com/2010/12/a-guide-to-creating-3d-text-in-adobe-illustrator/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 17:25:06 +0000</pubDate>
		<dc:creator>4rwebsolutions</dc:creator>
				<category><![CDATA[PoSt]]></category>
		<category><![CDATA[Graphic design]]></category>

		<guid isPermaLink="false">http://www.blog.4rwebsolutions.com/?p=466</guid>
		<description><![CDATA[By Tyler Denis Source: http://bit.ly/d32lM2 It isn’t always necessary to use a 3D program to create 3D text — they’re expensive and overkill if you just occasionally use 3D elements. Adobe Illustrator is more than adequate in allowing us to create some 3D objects with some basic shading for our text. In this tutorial, we [...]]]></description>
			<content:encoded><![CDATA[<p>By <a title="Posts by Tyler Denis" href="http://designinstruct.com/author/tyler-denis/">Tyler Denis</a></p>
<p>Source: http://bit.ly/d32lM2</p>
<p>It isn’t always necessary to use a 3D program to create 3D text —  they’re expensive and overkill if you just occasionally use 3D elements.  Adobe Illustrator is more than adequate in allowing us to create some  3D objects with some basic shading for our text. In this tutorial, we  are going to learn how to make some 3D text using Adobe Illustrator, and  also discuss techniques of shading the text to give it a clean,  consistent, and stylized look.</p>
<h2>Preview</h2>
<p>Here is what we’ll be constructing in this tutorial. Click on the image below to see it in <a href="http://cdn.designinstruct.com/files/78-3d_text_illustrator/final_full.jpg">full scale</a>.</p>
<p><a href="http://cdn.designinstruct.com/files/78-3d_text_illustrator/final_full.jpg"><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/final.jpg" alt="Preview" width="600" height="175" /></a></p>
<h2>Step 1: Adding the Text</h2>
<p>We are going to start off by typing out some text. Click on your Type  Tool (T), click and drag a box on the artboard for your text, then type  out &#8220;DESIGN TEXT&#8221; in two lines. This will give us the shape we are  looking for. You can adjust the size of the text by opening up the  Character Panel (Window &gt; Type &gt; Character or press Ctrl/Cmd + T).  The font I am using is Adelle Basic Bold, but you can use another  similar font if you prefer.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/01.jpg" alt="Adding the Text" width="600" height="342" /></p>
<h2>Step 2: Convert Text to Paths</h2>
<p>Now we are going to covert the text to shapes so it will be easier to  work with. Using your Selection Tool (V), click on the text and then go  to Type &gt; Create Outlines (Shift + Ctrl/Cmd + O).</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/02.jpg" alt="Convert Text to Paths" width="600" height="300" /></p>
<h2>Step 3: Adjusting the Kerning and Leading</h2>
<p>The kerning (space in between the letters) and leading (space in  between the top word and bottom word) of the text should be adjusted to  make everything fit tighter.</p>
<p>First, we need to ungroup the text, so go to Object &gt; Ungroup  (Shift + Ctrl/Cmd + G). This will make it so we can click on each letter  on its own.</p>
<p>Click and drag a box around &#8220;TEXT&#8221; with the Selection Tool (V) to select just that word, and then move it up closer to &#8220;DESIGN&#8221;.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/03.jpg" alt="Adjusting the Kerning and Leading" width="600" height="264" /></p>
<p>To fix the kerning of &#8220;DESIGN&#8221;, we want to drag a box around &#8220;DESIG&#8221; —  excluding &#8220;N&#8221;, the last letter — with the Selection Tool (V). Since we  want the &#8220;N&#8221; of &#8220;DESIGN&#8221; and the &#8220;T&#8221; of &#8220;TEXT&#8221; to stay lined up, move  the slected letters in towards the right by a space or two. Repeat this  with &#8220;DESI&#8221;, &#8220;DES&#8221; and so on until the text is tightened up evenly.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/03_2.jpg" alt="Adjusting the Kerning and Leading" width="600" height="185" /></p>
<h2>Step 4: Adding Color</h2>
<p>Since it will be easier to see the sides of the 3D text, we are going  to add color to the letters. First select all the letters of &#8220;DESIGN&#8221;  and fill it with a yellow.</p>
<p><strong>Note:</strong> If you don’t see the Color Panel open, you can  go to Window &gt; Color (F6). And if you don’t have RGB set up as your  color mode, you can click on the arrow at the top right of the Panel,  then click on RGB in the options.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/04.jpg" alt="Adding Color" width="600" height="400" /></p>
<p>We are going to do the same with the &#8220;TEXT&#8221;, but it will be a light blue.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/04_2.jpg" alt="Adding Color" width="600" height="400" /></p>
<p>You can put the colors in your Swatches Panel (Window &gt; Swatches  if you don’t see it) by simply clicking and dragging your color into it  from the Color Panel.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/04_3.jpg" alt="Adding Color" width="600" height="500" /></p>
<h2>Step 5: Adjusting Size</h2>
<p>We can start working on the 3D text now. First, though, we should  make the text fill up the artboard a little bit more. Select both words,  hold down Shift (to keep the text from distorting), and then drag a  corner anchor out to make it larger.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/05.jpg" alt="Adjusting Size" width="600" height="300" /></p>
<h2>Step 6: Getting into the 3D Text</h2>
<p>Let’s start working on the 3D text. First, group the letters by  choosing Object &gt; Group (Ctrl/Cmd + G) so that when we make our text  three-dimensional, the letters stay as one shape instead of becoming  individual 3D shapes.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/06.jpg" alt="Getting into the 3D Text" width="600" height="524" /></p>
<p>Next, choose Effect &gt; 3D &gt; Extrude &amp; Bevel, which will open  an Options dialog window. In the 3D Extrude &amp; Bevel Options dialog  window, click on the Preview option check box to see how the text is  going to look.</p>
<p>These are your default settings whenever you open up these options.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/06_2.jpg" alt="Getting into the 3D Text" width="600" height="500" /></p>
<h2>Step 7: Adjusting the 3D Text</h2>
<p>Let’s start playing around with the 3D Extrude &amp; Bevel options.  The blue square on the 3D box in the options dialog window is the face  of the text. You can click and drag each edge of the cube and see how  they change your 3D text.</p>
<p>For our text, we want to make the words look like they are lying down  on the ground, so tweak the Position options in such a way that your  text looks like it’s flat on its back.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/07.jpg" alt="Adjusting the 3D Text" width="600" height="500" /></p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/07_2.jpg" alt="Adjusting the 3D Text" width="600" height="276" /></p>
<h2>Step 8: Adjusting Perspective</h2>
<p>The top right corner of &#8220;DESIGN&#8221; looks out of place and not really  within the perspective. To fix this, we can adjust the Perspective to  about 50<sup>o</sup> for our text.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/08.jpg" alt="Adjusting Perspective" width="600" height="500" /></p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/08_2.jpg" alt="Adjusting Perspective" width="600" height="323" /></p>
<h2>Step 9: Adjusting Height</h2>
<p>Finally, we are going to adjust the height of the sides of the text with Extrude Depth to make them slightly shorter (to 40pt).</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/09.jpg" alt="Adjusting Height" width="600" height="500" /></p>
<p>For our purposes, those are the only options that we need to change on the text, so push OK to commit the settings.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/09_2.jpg" alt="Adjusting Height" width="600" height="271" /></p>
<h2>Step 10: Converting the 3D Text to Paths</h2>
<p>The text looks OK: it has some basic shading, but overall, it’s  pretty dark and pretty bland. Besides, we want to add some stylized  shading onto it to make it more interesting.</p>
<p>To start editing the text, go to Object &gt; Expand Appearance. This will take the 2D text and make paths for the 3D text.</p>
<p>We need to ungroup the text so we can start working on different parts of it.</p>
<p><strong>Tip:</strong> Grouping and ungrouping objects are two common  Illustrator commands. I suggest getting used to the keyboard shortcuts  for them — Ctrl/Cmd + G (Group) and Ctrl/Cmd + Shift + G (Ungroup). In  this instance, the keyboard shortcut will be easier because we are going  to have to ungroup quite a few times to make sure everything is  ungrouped.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/10.jpg" alt="Converting the 3D Text to Paths" width="600" height="237" /></p>
<h2>Step 11: Adjusting the Text Face Color</h2>
<p>Select the face of the &#8220;DESIGN&#8221; letters by clicking on one face,  holding down Shift, and clicking on the others to select them all at  once. To apply the color, click on the yellow swatch that we put into  the Swatches Panel.</p>
<p>Do the same with the &#8220;TEXT&#8221; and the blue color we chose.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/11.jpg" alt="Adjusting the Text Face Color" width="600" height="258" /></p>
<h2>Step 12: Creating the Shadow Colors</h2>
<p>To shade the sides of the text, we need to create more colors. We want to have two more yellows: a dark one and a dark<em>er</em> one.</p>
<p>To make the other two yellows, click on the original yellow color  that we used for the &#8220;DESIGN&#8221; face in the Swatches Panel and subtract 40  from R and G (e.g. 247, 187, 14 becomes 207, 147, 14). Click and drag  this yellow into the Swatches Panel and create another yellow by  subtracting another 40 from R and G so it becomes 167, 107, 14. These  will be our 3 yellows.</p>
<p>Repeat this for the blues as well, subtracting 40 from G and B so it becomes 113, 146, 170 and 113, 106, 130.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/12.jpg" alt="Creating the Shadow Colors" width="600" height="500" /></p>
<h2>Step 13: Simplifying the Curves</h2>
<p>You’ll notice that when you click on some of the curved shapes, they  are split into two pieces. We want to make these two pieces into one, so  open up the Pathfinder Panel if you don’t have it open (Shift +  Ctrl/Cmd + F9). Click on one part of the side, and then holding down  Shift, click on the other one.</p>
<p>Click the Unite command in the Pathfider Panel, then click Expand.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/13.jpg" alt="Simplifying the Curves" width="600" height="500" /></p>
<p>This will combine the two shapes into one. Do this with all of the curved shapes that are separated.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/13_2.jpg" alt="Simplifying the Curves" width="600" height="339" /></p>
<h2>Step 14: Adding Dark Shadows</h2>
<p>Now we need to decide which sides are going to get our light source  and which sides aren’t. Since the light source is already set up on the  right, we’ll use that. Therefore, the bottom parts of the text and the  left sides of the text are going to be the dark yellow, with the left  sides the darkest. So let’s use our darkest yellow and blue on the left  edges of the text.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/14.jpg" alt="Adding Dark Shadows" width="600" height="267" /></p>
<h2>Step 15: Adding Lighter Shadows</h2>
<p>Use the middle blue and yellow shades on the rest of the sides of the text.</p>
<p>Now, we can stop here and stay with this block shading, or we can go a  step further and add some color gradients to make the shading richer.  For this tutorial’s sake, let’s go ahead and add in some gradients.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/15.jpg" alt="Adding Lighter Shadows" width="600" height="204" /></p>
<h2>Step 16: Creating Shadow Gradients</h2>
<p>Let’s create some gradients now. Open up the Gradient Panel (Ctrl/Cmd + F9) if you haven’t already.</p>
<p>Click and drag the brightest yellow color swatch to the left side of  the gradient, and the second yellow to the right side of the gradient.  Now click and drag the gradient into the Swatches Panel. Create a  gradient the same way as the first one using the middle yellow and the  dark yellows. You should now have two yellow gradients. To apply the  gradients to particular pieces, you just select that piece and click on  the gradient color swatch.</p>
<p>Repeat this with the blue gradients.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/16.jpg" alt="Creating Shadow Gradients" width="600" height="500" /></p>
<h2>Step 17: Adding Gradients to the Lighter Shadows</h2>
<p>Now, remember our light source is coming from the right, so the  shapes are going to cast a shadow from right to left. With that in mind,  click on the lighter text sides and then click on the lighter gradient.</p>
<p>To adjust the gradient, click on the Gradient Tool (G) from the Tools  Panel. You can click and drag across the shape to adjust the gradient.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/17.jpg" alt="Adding Gradients to the Lighter Shadows" width="600" height="381" /></p>
<h2>Step 18: Finishing Up the Lighter Shadow Gradient</h2>
<p>Continue adding a gradient to the lighter areas of both the words.  There is no exact science to the way we’re adding in the color  gradients, it’s just a matter of getting a difference in color between  the different pieces, making things stand out more, and giving them   subtle variations in lighting.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/18.jpg" alt="Finishing the Lighter Shadow Gradient" width="600" height="225" /></p>
<h2>Step 19: Adding the Darker Shadow Gradients</h2>
<p>Repeat what we did with the lighter areas and add dark gradients to  the darker areas. The darker areas are going to be lightest at the top  and darkest at the bottom (where there is the least amount of light).</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/19.jpg" alt="Adding the Darker Shadow Gradients" width="600" height="318" /></p>
<h2>Step 20: Lightening the Text Faces</h2>
<p>We can call it good as-is, but if we want to make the text faces a  little more visible, we can click on each letter face (holding down  Shift to select the invidual pieces together), then Ctrl/Cmd + C (Copy),  and then Ctrl/Cmd + F (Paste in Front).</p>
<p>Fill these copied letters with white. Open up the Transparency Panel  (Shift + Ctrl/Cmd + F10). Change the Blend Mode to Overlay and the  Opacity to 30%.</p>
<p><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/20.jpg" alt="Lightening the Text Faces" width="600" height="303" /></p>
<h2>Tutorial Summary</h2>
<p>That’s it folks. This tutorial went over some techniques for making  great 3D text with accurate shadings. We didn’t use 3D-rendering  software — just Illustrator. The great thing about constructing 3D  objects in Adobe Illustrator is that you can adjust the size of the  lettering so that it can be as big or as small as you want (because it  is, after all, a vector object) and import them easily into other Adobe  Creative or Production Suite software as well as third-party products.</p>
<p><a href="http://cdn.designinstruct.com/files/78-3d_text_illustrator/final_full.jpg"><img src="http://cdn.designinstruct.com/files/78-3d_text_illustrator/final.jpg" alt="Preview" width="600" height="175" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.4rwebsolutions.com/2010/12/a-guide-to-creating-3d-text-in-adobe-illustrator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TOP 5 Typography Crimes</title>
		<link>http://www.blog.4rwebsolutions.com/2010/11/top-5-typography-crimes/</link>
		<comments>http://www.blog.4rwebsolutions.com/2010/11/top-5-typography-crimes/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 12:39:53 +0000</pubDate>
		<dc:creator>4rwebsolutions</dc:creator>
				<category><![CDATA[PoSt]]></category>

		<guid isPermaLink="false">http://www.blog.4rwebsolutions.com/?p=456</guid>
		<description><![CDATA[Typography is not just crunching a keyboard in Word, making a few words bold and few words red. Now that we have that established, here are what I’ve experienced as the Top Five Typography Crimes, in order of what I consider to be the worst offenses. 1. Double Spaces “But I was always taught to [...]]]></description>
			<content:encoded><![CDATA[<p>Typography is not just crunching a keyboard in Word, making a few words <strong>bold</strong> and few words red.  Now that we have that established, here are what I’ve experienced as  the Top Five Typography Crimes, in order of what I consider to be the  worst offenses.</p>
<div>
<div><img src="http://www.digitaria.com/sites/default/files/u13/Top_Five_Typography_Crimes_Blog_Post_Paragraph_Double_Spaces-02.jpg" alt="" width="217" height="196" /></div>
<div>
<p>1. Double Spaces</p>
<p>“But I was always taught to put two spaces after periods.&#8221; Unless you  plan on pulling out the old typewriter and white out, get rid of the  double spaces. To give you some perspective, when this practice was the  standard, they also taught you that ducking under your desk in the event  of an atomic bomb attack would save your life. Spaces are our writing  system’s method of telling our brain to pause for that split second.  Having an extra space causes the brain to stall for an unnecessary  amount of time, which could cause you to lose your audience. They also  create holes of white space in your paragraph, which is not  aesthetically pleasing in the least.</p>
</div>
</div>
<div>
<div><img src="http://www.digitaria.com/sites/default/files/u13/Top_Five_Typography_Crimes_Blog_Post_Paragraph_InappropriatelySized-02.jpg" alt="" width="217" height="196" /></div>
<div>
<p>2. Inappropriately Sized Type (Too Big or Too Small)</p>
<p>There is a theory that the larger the type, the more attention it  grabs. That is partially true, but only in the same way that ugly things  grab a lot of attention. In my experience, nearly everyone sets their  type too big. It must be legible, but fonts set too large cause the mind  to process it slower, which could cause you to lose your audience.</p>
<p>Two things to keep in mind: All fonts are slightly different sizes  and weights, so two fonts could match when one is set at size 10 and the  other size 11. And you must know your audience &#8211; An invitation for a 50  year high school reunion will undoubtedly need a larger font size than a  10 year, for obvious optical reasons.</p>
</div>
</div>
<div>
<div><img src="http://www.digitaria.com/sites/default/files/u13/Top_Five_Typography_Crimes_Blog_Post_Paragraph_WidowAndOrphan-01-02_0.jpg" alt="" width="217" height="120" /><img src="http://www.digitaria.com/sites/default/files/u13/Top_Five_Typography_Crimes_Blog_Post_Paragraph_WidowAndOrphan-02-02.jpg" alt="" width="217" height="92" /></div>
<div>
<p>3. Widows and Orphans</p>
<p>Appropriately named, widows are single words that exist alone on the  last line of a paragraph and orphans live by themselves on the first  line of a page. They create visual holes in the flow of text, which  could again cause you to lose your audience. Save these poor souls by  slightly increasing your column width or editing your text to fit them  on the previous line.</p>
</div>
</div>
<div>
<div><img src="http://www.digitaria.com/sites/default/files/u13/Top_Five_Typography_Crimes_Blog_Post_Paragraph_computerstyling-02.jpg" alt="" width="217" height="196" /></div>
<div>
<p>4. Computer Styling</p>
<p>Fonts are not Silly Putty, so don’t treat them as such &#8211; do NOT  stretch, condense, expand, slant, or otherwise compromise the integrity  of the art form that someone years back created by hand drawing every  curve. If you need your type to be more condensed or expanded, choose a  font that has a condensed or expanded typeface.</p>
<p>Example difference between font and typeface:</p>
<p>Font = Helvetica. Typeface = Helvetica Bold or Helvetica Condensed.</p>
</div>
</div>
<div>
<div><img src="http://www.digitaria.com/sites/default/files/u13/Top_Five_Typography_Crimes_Blog_Post_Paragraph_nokerning-02.jpg" alt="" width="217" height="196" /></div>
<div>
<p>5. No Kerning</p>
<p>“You mean the computer doesn’t do that for you??” If it could  simultaneously do the Charleston and make you a sandwich maybe, but for  now, computers do not automatically make the spacing between every  letter perfect. Because every letter is shaped differently, too much or  too little space between letters is often created. Remedy this by  individually increasing or decreasing spacing between letters, but  relax, type under size 24 is generally considered small enough to not  need scrutinized kerning.</p>
</div>
</div>
<p>Hope this was enlightening for you all. If you take these notes to  heart, please keep these in mind when you produce your content. And my  apologies in advance for pointing these out, as they will now probably  annoy you everyday as you notice all the bad typography that litters our  world.</p>
<p><strong>Source: http://bit.ly/auJOkN</strong></p>
<p><strong>Author:  Zack Travis</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.4rwebsolutions.com/2010/11/top-5-typography-crimes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fantastic New File Transfer Site</title>
		<link>http://www.blog.4rwebsolutions.com/2010/11/fantastic-new-file-transfer-site/</link>
		<comments>http://www.blog.4rwebsolutions.com/2010/11/fantastic-new-file-transfer-site/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 17:06:09 +0000</pubDate>
		<dc:creator>4rwebsolutions</dc:creator>
				<category><![CDATA[PoSt]]></category>
		<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.blog.4rwebsolutions.com/?p=445</guid>
		<description><![CDATA[Source: http://bit.ly/fUyz2u Author: Bernardo Carvalho Thanks for sharing Bernardo!&#8230; We love companies that help our everyday lives: WeTransfer have launched a beautiful easy-to-use file transfer service. As creative designers, we often need to send large files to our clients and colleagues. This service features 2GB allowance, 2 weeks availability, 20 receivers for downloads and its FREE without [...]]]></description>
			<content:encoded><![CDATA[<div>
<div>
<p style="text-align: center;"><span style="color: #800000;">Source: http://bit.ly/fUyz2u</span></p>
</div>
<div>
<p style="text-align: center;"><span style="color: #800000;">Author: Bernardo Carvalho</span></p>
</div>
</div>
<div>
<p style="text-align: center;"><span style="color: #800000;">Thanks for sharing Bernardo!&#8230;</span></p>
</div>
<div>
<p>We love companies that help our everyday lives: <a href="http://www.wetransfer.com/">WeTransfer</a> have launched a beautiful easy-to-use file transfer service.</p>
</div>
<div>
<p>As  creative designers, we often need to send large files to our clients  and colleagues. This service features 2GB allowance, 2 weeks  availability, 20 receivers for downloads and its FREE without the need  for registration.</p>
</div>
<div>
<p>But  the best of all in our view, is the well-designed email confirmation  that gets sent to our clients, and the gorgeous site interface, with its  full screen background imagery advertising.</p>
</div>
<div>
<p><a rel="attachment wp-att-446" href="http://www.blog.4rwebsolutions.com/2010/11/fantastic-new-file-transfer-site/wetransfer/"><img class="alignnone size-full wp-image-446" title="wetransfer" src="http://www.blog.4rwebsolutions.com/wp-content/uploads/2010/11/wetransfer.png" alt="" width="320" height="239" /></a></p>
</div>
<div>
<p>So we thought we let our readers know about this. Enjoy!</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.4rwebsolutions.com/2010/11/fantastic-new-file-transfer-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

