<?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>Swedish fika &#187; Simon</title>
	<atom:link href="http://www.swedishfika.com/author/simon/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.swedishfika.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 25 Jul 2010 21:57:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>What what? Haven&#8217;t read CSS Mastery?</title>
		<link>http://www.swedishfika.com/2010/07/17/what-what-havent-read-css-mastery/</link>
		<comments>http://www.swedishfika.com/2010/07/17/what-what-havent-read-css-mastery/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 17:18:23 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Reviews]]></category>

		<guid isPermaLink="false">http://www.swedishfika.com/?p=1620</guid>
		<description><![CDATA[If you haven&#8217;t read the book CSS Mastery I really think you should. In my opinion it&#8217;s probably one of the best books out there that covers CSS. If you&#8217;re new at CSS this book will probably teach you a lot of things and if you&#8217;ve been writing CSS for years, you can probably learn [...]]]></description>
			<content:encoded><![CDATA[<p>If you haven&#8217;t read the book CSS Mastery I really think you should. In my opinion it&#8217;s probably one of the best books out there that covers CSS. If you&#8217;re new at CSS this book will probably teach you a lot of things and if you&#8217;ve been writing CSS for years, you can probably learn something new from it. </p>
<p><span id="more-1620"></span>So this is my recommendation if you want a book to read this summer! And yes, there&#8217;s a &#8217;second edition&#8217; of the book and that&#8217;s the one you should go for. </p>
<p>Have a really nice summer everyone!</p>
<p>Best regards,<br />
Simon</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2010/07/17/what-what-havent-read-css-mastery/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Thoughts on Magento Mobile</title>
		<link>http://www.swedishfika.com/2010/06/05/thoughts-on-magento-mobile/</link>
		<comments>http://www.swedishfika.com/2010/06/05/thoughts-on-magento-mobile/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 12:45:22 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.swedishfika.com/?p=1530</guid>
		<description><![CDATA[Recently, the Magento team announced the launch of Magento Mobile. It&#8217;s perhaps not so cool to use the word cool but Magento Mobile is without doubt, one of the coolest new features in the world of e-commerce!
This short quote from the guys and girls over at Varien pretty much sums it up:

&#8220;With Magento mobile, you [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, the Magento team announced the launch of Magento Mobile. It&#8217;s perhaps not so cool to use the word cool but Magento Mobile is without doubt, one of the coolest new features in the world of e-commerce!</p>
<p>This short quote from the guys and girls over at Varien pretty much sums it up:</p>
<p><span id="more-1530"></span><br />
<em>&#8220;With Magento mobile, you can easily create branded, native storefront applications that are deeply integrated with Magento’s market-leading eCommerce platform.&#8221; </em></p>
<p>There&#8217;s no reason for me to write more about it, go check it out, watch a demo and read more about it <a href="http://www.magentocommerce.com/blog/comments/announcing-the-launch-of-magento-mobile/">here</a>. </p>
<p>// Simon</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2010/06/05/thoughts-on-magento-mobile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Role Will Domain Names Play in the Future of the Web?</title>
		<link>http://www.swedishfika.com/2010/05/15/what-role-will-domain-names-play-in-the-future-of-the-web/</link>
		<comments>http://www.swedishfika.com/2010/05/15/what-role-will-domain-names-play-in-the-future-of-the-web/#comments</comments>
		<pubDate>Sat, 15 May 2010 12:45:20 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.swedishfika.com/?p=1464</guid>
		<description><![CDATA[During the last couple of years there&#8217;s been a gold rush for domain names. You know what I&#8217;m talking about. Most often you need a domain name and you know exactly what domain name you&#8217;d really want but no-no, the name is already registered and you have to settle with a name that don&#8217;t feel [...]]]></description>
			<content:encoded><![CDATA[<p>During the last couple of years there&#8217;s been a gold rush for domain names. You know what I&#8217;m talking about. Most often you need a domain name and you know exactly what domain name you&#8217;d really want but no-no, the name is already registered and you have to settle with a name that don&#8217;t feel that great or not even is close to your initial idea. Bummer.</p>
<p><span id="more-1464"></span><br />
You&#8217;ve probably ran in to the companies out there who do nothing except register domain names and sell them to a much higher price than what they bought them for. In the media you can read about global corporations that spend millions of dollars on domain names. You probably regret that you didn&#8217;t foresee this hype for ten-fifteen years ago which would have made you a millionaire if you&#8217;d have played your cards well back then.</p>
<p>I guess that theese names actually can be worth all that money today but what I wonder is if they will be worth it tomorrow? What we experience more and more on the web is that the content on your site is what&#8217;s important, not the address to your site. </p>
<p>According to Wikipedia, the actual purpose of a domain name is to &#8220;&#8230;provide easily recognizable and memorizable names to numerically addressed Internet resources&#8221;. That&#8217;s true, it is much easier to remember a domain than an IP-adress. According to <a href="http://www.domaintools.com/internet-statistics/">http://www.domaintools.com/internet-statistics/</a> you can see that there&#8217;s over 100 million different registered domain names today (I haven&#8217;t double-checked the numbers, we all know there&#8217;s many domain names registered and that&#8217;s enough to prove my point (= ). That amount is only including the major top-level domains. No wonder it&#8217;s hard to find an available domain name and many sites gets a domain name that don&#8217;t really reflect what their company name is or not even that they do. </p>
<p>Because of the increasing amount of different domain names and the massive increase of content on the web no one really remember the domain names anymore (maybe except from big corp sites such as facebook, youtube and so on). Many just use a search engine to find what they&#8217;re looking for and I see that more an more people actually google for sites they know the address to. </p>
<p>Domain names are important to search engines today but if the web is going where we think it&#8217;s going we can really wonder if domain names will be as important in the future as they are today. Will they even still be used in twenty years from now? </p>
<p>/Simon</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2010/05/15/what-role-will-domain-names-play-in-the-future-of-the-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The European Web Browser Choice</title>
		<link>http://www.swedishfika.com/2010/03/03/the-european-web-browser-choice/</link>
		<comments>http://www.swedishfika.com/2010/03/03/the-european-web-browser-choice/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 20:55:22 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://swedishfika.com/?p=1156</guid>
		<description><![CDATA[Many of you have probably already heard about the European Web Browser Choice that&#8217;s going on in, yes you guessed right, Europe right now. 
The Web Browser Choice is according to the European Commission a deal between The European Commission and Microsoft. The European Commission believes that Microsoft has taken advantage of their predominant position [...]]]></description>
			<content:encoded><![CDATA[<p>Many of you have probably already heard about the European Web Browser Choice that&#8217;s going on in, yes you guessed right, Europe right now. </p>
<p>The Web Browser Choice is according to the European Commission a deal between The European Commission and Microsoft. The European Commission believes that Microsoft has taken advantage of their predominant position on the European market by providing Internet Explorer as the standard browser on Windows. </p>
<p><span id="more-1156"></span><br />
Therefore, Microsoft users that use XP, Vista and Windows 7 and has choosen Internet Explorer as their standard web browser will  after a windows-update, be provided with a browser choice screen where they can decide that they want to use another browser than Internet Explorer if they want to. </p>
<p>As a web developer I really like this decision, since it can get us further away from IE6 and make unaware Internet users more aware of different browsers. I&#8217;m not sure how much effect this will have, I guess most users will wonder, what is this? Do I dare to click on this or will my computer explode if I do so?! I know a few persons that will have this reaction&#8230;</p>
<p>Event though I like it I don&#8217;t really like the idea that the European Commission can tell Microsoft they have to do this, even though they have a point. It&#8217;s not that you actually can&#8217;t use another browser than Explorer on Windows. There&#8217;s nothing that&#8217;s stopping you to install whatever browser you&#8217;d like on your windows machine. Why shouldn&#8217;t Microsoft be allowed to ship Internet Explorer with their OS? Why don&#8217;t the European Commission tell Apple to also provide this web browser choice window-thing? </p>
<p>Maybe we&#8217;re just not there yet or what do you think?</p>
<p>/Simon</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2010/03/03/the-european-web-browser-choice/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Prep Your Design for a Web Developer</title>
		<link>http://www.swedishfika.com/2010/02/12/how-to-prep-your-design-for-a-web-developer/</link>
		<comments>http://www.swedishfika.com/2010/02/12/how-to-prep-your-design-for-a-web-developer/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 22:23:18 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://swedishfika.com/?p=1037</guid>
		<description><![CDATA[Hey ya&#8217;ll photoshop-/color-/typo-addicted designers out there! Have you just finished that brand new awesome web design and just shipped it off to the web agency that will convert it into a website? Are you stoked on how awesome your design will look in a browser when you press the big green go-live button? (I&#8217;ve always [...]]]></description>
			<content:encoded><![CDATA[<p>Hey ya&#8217;ll photoshop-/color-/typo-addicted designers out there! Have you just finished that brand new awesome web design and just shipped it off to the web agency that will convert it into a website? Are you stoked on how awesome your design will look in a browser when you press the big green go-live button? (I&#8217;ve always wanted one of those buttons) Have you built up your customer&#8217;s expectations through the roof and said something like &#8220;Huell yeah! This will be the most awesome website of the entire Universe!!!&#8221;? </p>
<p>Do you want to know how the web developer will grade your work and how you can improve the end-result of the entire project and cut costs? Read on.</p>
<p><span id="more-1037"></span></p>
<h3>Background</h3>
<p>As many of you know, when you convert a design into a web site, the developer needs to be able to separate almost everything in your design into pieces. Like show and hide things, merge stuff there and here and so on. This has to be done to be able to extract the graphical elements that the web developer will use in the markup/css. This is, for instance, one of the main reasons why web developers don&#8217;t like to get the design as .jpegs. Stop sending us .jpegs! </p>
<p>If the .psd (or whatever it is you&#8217;ve made your design in) is logically divided into grouped layers with descriptive names (such as header, footer, search form, btn-background) etc where you easily can show and hide groups and layers and swap between your two-column and one-column layout with just a click or two this can make a huge impact on the final result. </p>
<h3>What can happen if i fail?</h3>
<p>If you don&#8217;t succeed with this it can, for example, lead to the following unwanted things:</p>
<p>a) When most developers budget their work they reckon that the design is easy to work with. If you&#8217;ve made a poor job the developer will need to spend more time on converting your design which will increase the total cost of your project. If you&#8217;re on a tight schedule (which you most often are) the launch of the website will be postponed. Which in turn will lead to a disappointed customer. </p>
<p>b) The end result. How your design actually will look and behave like in a browser. If the end result differs to much from your design the customer will be disappointed. </p>
<p>c) Your reputation as web designer amongst web agencies. If web agencies think you know how to design for the web they&#8217;ll want to continue working with you. If not, they might seek help elsewhere. Every webdesigner should have common knowledge of how to build a website. If not you&#8217;re just guessing how to do things and people will start screaming &#8220;Fake! He&#8217;s a fake!&#8221; when they meet you out on the town on a friday-night. </p>
<p>I&#8217;ve come across a wide variety of designs and there&#8217;s a lot of examples of what you shouldn&#8217;t do.</p>
<h3>Example #1</h3>
<p>Sometimes you get a .psd where the layers has no structure or logic whatsoever. All layers have been named Layer 1, Layer 2 and so on and they haven&#8217;t even been placed in layered comps. That is just crazy and the web developer will rip his/her hair off trying to figure out where to find what and say &#8220;WTF? Has the designer gone bonkers?!&#8221;</p>
<h3>Example #2</h3>
<p>One other example is when you get this .psd with a lot of layered comps but the actual structure of the layers is all spread out. You can swap between different views by using the layered comps but as soon as you need to hide a layer or something you have no idea of where to look. This is also crazy. Don&#8217;t do this! </p>
<h3>What should I do?</h3>
<p>So we&#8217;ve talked a lot about how you shouldn&#8217;t do but you might say, &#8220;Well, how should I do?&#8221;</p>
<p>My personal opinion is that you should use your common sense. Ask yourself the question &#8220;How should I do this to make it easy to understand and easy to work with for others?&#8221; If you structure your layers into logical sections you won&#8217;t need layered comps. I don&#8217;t say you shouldn&#8217;t use them, there are a situations where they come-in-handy,  but think of them as a supplement. </p>
<p>It should be mentioned that many designers does a great job and has great skills when it comes to do this.</p>
<p>If you have any other ideas or think I&#8217;m crazy, please comment!</p>
<p>/Simon</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2010/02/12/how-to-prep-your-design-for-a-web-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Putting a Button on Top of Another Button is a Bad Idea</title>
		<link>http://www.swedishfika.com/2009/11/07/why-putting-a-button-on-top-of-another-button-is-a-bad-idea/</link>
		<comments>http://www.swedishfika.com/2009/11/07/why-putting-a-button-on-top-of-another-button-is-a-bad-idea/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 17:14:45 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://swedishfika.com/?p=638</guid>
		<description><![CDATA[I&#8217;ve been using Coda as my main web development tool the last few months and I must say that it&#8217;s a great development tool that makes me work more efficient. It&#8217;s easy to use, you can easily search through all files in a big project and you can publish all your changes to the server [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Coda as my main web development tool the last few months and I must say that it&#8217;s a great development tool that makes me work more efficient. It&#8217;s easy to use, you can easily search through all files in a big project and you can publish all your changes to the server with just a click or two. When I need to debug server-side code I just swap to Komodo.  </p>
<p><span id="more-638"></span>Coda has a fully featured file browser for your local file system and with just a click you can browse the remote file system on the server. You can easily swap between your local and remote file system by clicking on one of two tabs (one tab for the local file system and one tab for the remote). This is a great feature, it&#8217;s by no means groundbraking since a lot of different tools also has this feature but it really works smoothly in Coda. </p>
<p>There&#8217;s just one thing that bugs me. They&#8217;ve placed a small button on top of the tab for the remote file-system that disconnects the connection to the remote server when you click on it. </p>
<p>It might just be me but it&#8217;s been more than one time that I by mistake has disconnected the remote connection when all I wanted to do was to browse the remote file system. </p>
<p>I guess this is where design, once again, has inflicted on user-friendliness. Coda is in a big perspective a great example on really good user-friendly design and this small flaw is perhaps not so bad. </p>
<p>Anyone else that has thought about this or has another example?</p>
<p>/Simon</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2009/11/07/why-putting-a-button-on-top-of-another-button-is-a-bad-idea/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Use your own ActionScript 3.0 classes and custom events in Adobe Flash (Part 2)</title>
		<link>http://www.swedishfika.com/2009/07/17/use-your-own-actionscript-30-classes-and-custom-events-in-adobe-flash-part-2/</link>
		<comments>http://www.swedishfika.com/2009/07/17/use-your-own-actionscript-30-classes-and-custom-events-in-adobe-flash-part-2/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 22:18:57 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://swedishfika.com/?p=450</guid>
		<description><![CDATA[This is the last part in this short serie of two where we use real world examples to show you how you can create and use your own custom event classes to write customizable and reusable code that you can use in your ActionScript 3.0 projects from time to time.
In this second part we&#8217;ll take [...]]]></description>
			<content:encoded><![CDATA[<p>This is the last part in this short serie of two where we use real world examples to show you how you can create and use your own custom event classes to write customizable and reusable code that you can use in your ActionScript 3.0 projects from time to time.</p>
<p>In this second part we&#8217;ll take part one a step further and write classes to load images using the XML-file we loaded in part one. </p>
<p><span id="more-450"></span></p>
<p>If you don&#8217;t remember anything about part one or never read it, you can find it <a href="http://swedishfika.com/2009/05/02/use-your-own-actionscript-30-classes-and-custom-events-in-adobe-flash-part-1/">here</a>.</p>
<p>So what we&#8217;re going to do is to take the contents of the XML-file we loaded in part one and extract each of the image-url:s in that file and use them to load the corresponding images. To do this we just need to create two classes and update our document class a bit. The first class that we&#8217;ll create will be called ImageLoader and the other  will be called ImageLoaderEvent. The ImageLoader-class will be used to actually load the images and the ImageLoaderEvent-class will be used to handle the events thats used when loading the images. </p>
<h3>Create the ImageLoader-class</h3>
<p>In Adobe Flash, choose File->New->ActionScript file and add the following code to the file that you save as ImageLoader.as in the com-folder.<br />
<code>package com<br />
{<br />
  import flash.display.Sprite;<br />
  import flash.events.Event;<br />
  import flash.events.IOErrorEvent;<br />
  import flash.events.ProgressEvent;<br />
  import flash.display.Loader;<br />
  import flash.net.URLRequest;<br />
  import flash.display.Bitmap;<br />
  public class ImageLoader extends Sprite<br />
  {<br />
    private var index:int;<br />
    public function ImageLoader(url:String, index:int)<br />
    {<br />
      // This value will be used to know which image<br />
     // in the xml-file that's actually been loaded.<br />
      this.index = index;<br />
      // Load the image<br />
      var loader:Loader = new Loader();<br />
      loader.load(new URLRequest(url));<br />
      // Complete listener<br />
      loader.contentLoaderInfo.addEventListener(Event.COMPLETE,<br />
        onComplete);<br />
    }<br />
    public function onComplete(e:Event):void<br />
    {<br />
      // Dispatch the complete event when the image<br />
      // has been loaded<br />
      this.dispatchEvent(new ImageLoaderEvent(<br />
        ImageLoaderEvent.COMPLETE, false,<br />
        false, e.target.content, this.index));<br />
    }<br />
  }<br />
}</code></p>
<h3>Create the ImageLoaderEvent-class</h3>
<p>Now we need to create our custom event class that we&#8217;ll use to handle the events that we use when we load the images.</p>
<p>In Adobe Flash, choose File->New->ActionScript file and add the following code to the file that you save as ImageLoaderEvent.as in the com-folder.<br />
<code>package com<br />
{<br />
  import flash.events.Event;<br />
  import flash.display.Bitmap;<br />
  public class ImageLoaderEvent extends Event<br />
  {<br />
    public static const COMPLETE:String = "complete";<br />
    public var image:Bitmap;<br />
    public var index:int;<br />
    public function ImageLoaderEvent(type:String,<br />
      bubbles:Boolean = false, cancelable:Boolean = false,<br />
      image:Bitmap = null, index:int = -1)<br />
    {<br />
      super(type, bubbles, cancelable);<br />
      this.image = image;<br />
      this.index = index;<br />
     }<br />
  }<br />
}</code></p>
<h3>Last step is to update our document class</h3>
<p>So now we have the classes we need to be able to load the images. As you can see we&#8217;ve added an index-value that the ImageLoader-class takes as an argument and that it&#8217;s passed to the event-class when the image has been loaded. We&#8217;ll explain what this value will be used for in just a moment. First off we need to update our document class (Main.as) so it looks like this.<br />
<code>package<br />
{<br />
  import flash.display.MovieClip;<br />
  import com.XMLLoader;<br />
  import com.XMLLoaderEvent;<br />
  import com.ImageLoader;<br />
  import com.ImageLoaderEvent;<br />
  public class Main extends MovieClip<br />
  {<br />
    public function Main()<br />
    {<br />
      var url:String = "xml/images.xml";<br />
      var xl:XMLLoader = new XMLLoader(url);<br />
      xl.addEventListener(XMLLoaderEvent.COMPLETE,<br />
       onXMLLoaded);<br />
    }<br />
    public function onXMLLoaded(e:XMLLoaderEvent):void<br />
    {<br />
      var imageXML:XML = e.xml;<br />
      // Get a list of all the image-nodes<br />
      var images:XMLList = imageXML..image;<br />
      var numImages:int = images.length();<br />
      var imageLoader:ImageLoader;<br />
      // Loop through each image and load it<br />
      for(var i:int = 0; i < numImages; i++)<br />
      {<br />
        // Get the url from the current image-node<br />
        // in our XMLList<br />
        var urlStr:String = images[i].url;<br />
        imageLoader = new ImageLoader(urlStr, i);<br />
        imageLoader.addEventListener(ImageLoaderEvent.COMPLETE,<br />
          onImageLoaded);<br />
      }<br />
    }<br />
    public function onImageLoaded(e:ImageLoaderEvent):void<br />
    {<br />
      // The image<br />
      trace(e.image);<br />
      // With this value we know which image<br />
      // in the XML-list that's actually been loaded<br />
      trace(e.index);<br />
    }<br />
  }<br />
}</code><br />
As we've said we've added the index-value. This index-value is just there so we can know which one of the images in the XML-file that's been loaded. It's just a nice feature that can come in handy if you need to know this. You might have some information to your image that's listed in the image-node and if you have this index-value you can easily extract that information from the XML-file and present it along with the correct image. </p>
<p>Before you run your code you need to create a folder in your project folder (CustomEvents) that you call images. In this folder you need to add three jpg-images called image1.jpg, image2.jpg and image3.jpg. </p>
<p>The output from executing the code should look something like this:<br />
<img src="http://swedishfika.com/wp-content/uploads/custom_events_2_output.jpg" alt="The output from the code" /></p>
<p>So what's just happened? What we now do in our document class is that we load the XML. When the XML has been loaded we load each image that's listed in that file and when each image has been loaded we just trace the contents of what's been loaded. We could just as easily have added theese images to be displayed on the stage but for the simplicity of this article we've just traced the contents.</p>
<p>When you get the hang of using your own custom event classes you can get more in control of your code and write larger and more powerful applications. You'll also get a collection of classes that you can reuse in many projects and this will most probably save you precious development-time.</p>
<p>That's it, if you have any ideas about how you could improve this code please write a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2009/07/17/use-your-own-actionscript-30-classes-and-custom-events-in-adobe-flash-part-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Use your own ActionScript 3.0 classes and custom events in Adobe Flash (Part 1)</title>
		<link>http://www.swedishfika.com/2009/05/02/use-your-own-actionscript-30-classes-and-custom-events-in-adobe-flash-part-1/</link>
		<comments>http://www.swedishfika.com/2009/05/02/use-your-own-actionscript-30-classes-and-custom-events-in-adobe-flash-part-1/#comments</comments>
		<pubDate>Sat, 02 May 2009 12:37:20 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://swedishfika.com/?p=295</guid>
		<description><![CDATA[If you get the hang of using your own custom events in ActionScript 3.0 you can streamline your development and get more control of your code. This is the first part in a serie of two where we&#8217;re going to show you how you can create and use your own custom events. 
In this first [...]]]></description>
			<content:encoded><![CDATA[<p>If you get the hang of using your own custom events in ActionScript 3.0 you can streamline your development and get more control of your code. This is the first part in a serie of two where we&#8217;re going to show you how you can create and use your own custom events. </p>
<p>In this first part we&#8217;re going to use a real-world example and use a custom event-class to load <a href="http://www.w3schools.com/xml/default.asp">XML</a> more smoothly. We&#8217;ll also go through how you create a document class and how you link it to your flash document. </p>
<p><span id="more-295"></span></p>
<h3>1. Everything starts somewhere</h3>
<p>First off, create a folder on your desktop that you call CustomEvents where you can put all the files corresponding to this tutorial. This will be our project directory.</p>
<h3>2. Create the flash document:</h3>
<p>Open up Adobe Flash (in this case we use Adobe Flash CS4 but the approach is similar if you use another version such as Adobe Flash CS3), choose File->New->Flash File (ActionScript 3.0) and save it as Main.fla in your current project directory.</p>
<h3>3. Create the XML-file:</h3>
<p>Create a folder in your project directory that you call xml. Add the following code to a file called images.xml and save it in the xml-folder in your project directory. This is the file that we are going to load with the help of our custom event class.<br />
<code>&lt;?xml version="1.0" encoding="utf-8"?&gt;<br />
&lt;images&gt;<br />
  &lt;image&gt;<br />
    &lt;url&gt;images/image1.jpg&lt;/url&gt;<br />
  &lt;/image&gt;<br />
  &lt;image&gt;<br />
    &lt;url&gt;images/image2.jpg&lt;/url&gt;<br />
  &lt;/image&gt;<br />
  &lt;image&gt;<br />
    &lt;url&gt;images/image3.jpg&lt;/url&gt;<br />
  &lt;/image&gt;<br />
&lt;/images&gt;</code><br />
This file is pretty straight-forward. It contains three image-nodes that each of them contain a url-node that specifies the location of each image.</p>
<h3>4. Create the custom event class</h3>
<p>To be able to streamline and make it easy to use our ActionScript-classes it&#8217;s nice (so far it&#8217;s possible) to make general classes that you can reuse from project to project. So create a new folder on your desktop that you call AS3Classes and create another folder in that directory that you call com. We&#8217;ll get back to how you customize your flash document so it can use the classes you put in this folder. But first off, let&#8217;s create the classes. </p>
<p>In Adobe Flash, choose File->New->ActionScript file and add the following code to the file that you save as XMLoaderEvent.as in the com-folder.<br />
<code>package com<br />
{<br />
  import flash.events.Event;<br />
  public class XMLLoaderEvent extends Event<br />
  {<br />
    public var xml:XML;<br />
    public static const COMPLETE:String = "complete";<br />
    public function XMLLoaderEvent(type:String,<br />
      bubbles:Boolean = false, cancelable:Boolean = false,<br />
      xml:XML = null)<br />
    {<br />
      super(type, bubbles, cancelable);<br />
      this.xml = xml;<br />
    }<br />
  }<br />
}</code><br />
You don&#8217;t need to create your own event class to be able to listen to all the events you can listen to when you load files but it&#8217;s a nice thing to do because you get more control of your code. As you can see the event class doesn&#8217;t actually load a file, it just has a few properties that you can use when you load a file. We&#8217;ll create  a specific class later on that actually do all the loading but we&#8217;ll get back to that soon.</p>
<h3>5. Create a document class</h3>
<p>You can start your code by adding ActionScript directly on the first frame in your main timeline but since we write all our code in classes it&#8217;s nice to keep on doing this and that&#8217;s why we now need to create our document class. </p>
<p>Choose File->New->ActionScript file, add the following code to it and save it as Main.as in your current project directory.<br />
<code>package<br />
{<br />
  import flash.display.MovieClip;<br />
  public class Main extends MovieClip<br />
  {<br />
    public function Main()<br />
    {<br />
      // This is the constructor of our document class. This<br />
      //is where our code will start.<br />
      trace("Hello world!");<br />
    }<br />
  }<br />
}</code><br />
Now we need to tell our flash document that we want this class to be the document class. Choose File->Publish settings->Flash (the tab)->Settings. At the top of that popup-window you can tell your flash document the name of your document class that in this case is Main. So just write Main in this input and save all your changes.</p>
<p>If you now press CTRL+Enter you will publish your flash document and if you don&#8217;t get any error and in the output-window can read the text (&#8220;Hello world!&#8221;) that we trace in the constructor in our document class everything is set up correctly.</p>
<h3>6. Create our XMLLoader class</h3>
<p>We want to load XML and we want to write reusable code that we might want to use on other projects so let&#8217;s create a general class that we can use each time we want to load XML.</p>
<p>Choose File->New->ActionScript file, add the following code to the class and save it as XMLLoader.as in your com-folder:<br />
<code>package com<br />
{<br />
  import flash.display.Sprite;<br />
  import flash.events.Event;<br />
  import flash.events.IOErrorEvent;<br />
  import flash.events.ProgressEvent;<br />
  import flash.net.URLLoader;<br />
  import flash.net.URLRequest;<br />
  public class XMLLoader extends Sprite<br />
  {<br />
    public function XMLLoader(url:String)<br />
    {<br />
      // Load the XML<br />
      var urlR:URLRequest = new URLRequest(url);<br />
      var l:URLLoader = new URLLoader(urlR);<br />
      // Add listeners<br />
      l.addEventListener(Event.COMPLETE, onComplete);<br />
    }<br />
    public function onComplete(e:Event):void<br />
    {<br />
      // Dispatch the complete event when the XML is loaded<br />
      this.dispatchEvent(new XMLLoaderEvent(<br />
       XMLLoaderEvent.COMPLETE, false, false,<br />
       XML(e.target.data)));<br />
    }<br />
  }<br />
}</code></p>
<p>This class takes a url to the xml-file as argument and starts to load the XML and dispatches our own XMLLoaderEvent.COMPLETE-event when the XML has been loaded.</p>
<h3>7. Tell our flash document where it can find our custom classes that we save in our AS3Classes-folder</h3>
<p>To be able to use our classes that we put in our AS3Classes-folder we need to tell our document that this folder exists. You do that by choosing File->Publish settings->Flash (the tab)->Settings. There are a couple of new tabs and you should add the source path to your AS3Classes-folder here. Do that and save your changes.</p>
<h3>8. Wrap it all together</h3>
<p>Our next and final step is to instanciate our XMLLoader-class and trace the XML when it&#8217;s been loaded. So add some code to our document class so it&#8217;ll look like this:<br />
<code>package<br />
{<br />
  import flash.display.MovieClip;<br />
  import com.XMLLoader;<br />
  import com.XMLLoaderEvent;<br />
  public class Main extends MovieClip<br />
  {<br />
    public function Main()<br />
    {<br />
      trace("Hello world!");<br />
      var url:String = "xml/images.xml";<br />
      var xl:XMLLoader = new XMLLoader(url);<br />
      xl.addEventListener(XMLLoaderEvent.COMPLETE,<br />
       onXMLLoaded);<br />
    }<br />
    public function onXMLLoaded(e:XMLLoaderEvent):void<br />
    {<br />
     trace(e.xml);<br />
    }<br />
  }<br />
}</code></p>
<p>Now the code is ready to go so press CTRL+Enter and if everything is set up correctly you will now be able to read the contents of the XML-file in your output window.</p>
<p>This was more of an introduction to how you can write and use your custom events. In part 2 we’re going to take this code a step further and write code to load images more smoothly and more in-depth descripe how event classes work and how you can customize them.</p>
<p>/Simon</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2009/05/02/use-your-own-actionscript-30-classes-and-custom-events-in-adobe-flash-part-1/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Need to test your website in IE6? It&#8217;s easy with IETester!</title>
		<link>http://www.swedishfika.com/2009/03/29/need-to-test-your-website-in-ie6-its-easy-with-ietester/</link>
		<comments>http://www.swedishfika.com/2009/03/29/need-to-test-your-website-in-ie6-its-easy-with-ietester/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 11:49:40 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Resources]]></category>

		<guid isPermaLink="false">http://swedishfika.com/?p=248</guid>
		<description><![CDATA[As many of you know, IE6 is an outdated browser that interprets websites in mysterious ways. It more or less forces us developers to add redundant code to our websites so IE6-users won&#8217;t lack user-experience. IE6 is also less secure than modern browsers and if you still use it as your main browser we strongly [...]]]></description>
			<content:encoded><![CDATA[<p>As many of you know, IE6 is an outdated browser that interprets websites in mysterious ways. It more or less forces us developers to add redundant code to our websites so IE6-users won&#8217;t lack user-experience. IE6 is also less secure than modern browsers and if you still use it as your main browser we strongly recommend you to update as soon as possible (see list of more suitable browsers below). Unfortunately there are still many people out there who use IE6 which in most cases mean that we need to test our websites in that browser. This is where IETester come in handy.</p>
<p>&#8220;IETester is a free WebBrowser that allows you to have the rendering and javascript engines of IE8, IE7 IE 6 and IE5.5 on Vista and XP, as well as the installed IE in the same process.&#8221;</p>
<p><span id="more-248"></span></p>
<p>You can download IETester at <a href="http://www.my-debugbar.com/wiki/IETester/HomePage">http://www.my-debugbar.com/wiki/IETester/HomePage</a><br />
<h3>What do I do if I can&#8217;t see flash on my site with IETester?:</h3>
<p>We&#8217;ve noticed that if you run Vista on your machine you must run IETester as administrator to be able to view flash.<br />
<h3>List of modern browsers</h3>
<p><a href="http://www.getfirefox.com">Firefox</a><br />
<a href="http://www.apple.com/safari/">Safari</a><br />
<a href="http://www.opera.com/">Opera</a><br />
<a href="http://www.google.com/chrome">Chrome</a><br />
<a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer 7</a><br />
<a href="http://www.microsoft.com/windows/internet-explorer/default.aspx">Internet Explorer 8</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2009/03/29/need-to-test-your-website-in-ie6-its-easy-with-ietester/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to listen to events from links within TextFields in ActionScript 3</title>
		<link>http://www.swedishfika.com/2008/06/27/how-to-listen-to-events-from-links-within-textfields-in-actionscript-3/</link>
		<comments>http://www.swedishfika.com/2008/06/27/how-to-listen-to-events-from-links-within-textfields-in-actionscript-3/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 18:43:04 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>

		<guid isPermaLink="false">http://swedishfika.com/?p=84</guid>
		<description><![CDATA[There are many times when you want to listen to link events from TextFields in ActionScript 3. You might want to perform a certain task when the user clicks on a link and if so the new feature in ActionScript 3 that&#8217;s called &#8220;link events&#8221; come in handy. 

This class describes how you can use [...]]]></description>
			<content:encoded><![CDATA[<p>There are many times when you want to listen to link events from TextFields in ActionScript 3. You might want to perform a certain task when the user clicks on a link and if so the new feature in ActionScript 3 that&#8217;s called &#8220;link events&#8221; come in handy. </p>
<p><span id="more-84"></span></p>
<h3>This class describes how you can use link events:</h3>
<p><code>package {<br />
  import flash.display.Sprite;<br />
  import flash.text.TextField;<br />
  import flash.text.TextFormat;<br />
  import flash.events.TextEvent;<br />
  public class LinkEventTest extends Sprite<br />
  {<br />
    public function LinkEventTest()<br />
    {<br />
      // Create a TextField<br />
      var txt:TextField = new TextField();<br />
      /* Due to the width of our column on swedishfika.com<br />
      we save our link in a separate variable. */<br />
      var ourLink:String = "&lt;a href=\"event:Hello World!\"&gt;";<br />
      ourLink += "Trace \"Hello world!\"&lt;/a&gt;";<br />
      // Add the link<br />
      txt.htmlText = ourLink;<br />
      // Add the listener<br />
      txt.addEventListener(TextEvent.LINK, onClick);<br />
      // Add the textfield to the display list<br />
      addChild(txt);<br />
    }<br />
    private function onClick(e:TextEvent):void<br />
    {<br />
      /* Is triggered when the user clicks on the link<br />
      we declared above. */<br />
      // Traces "Hello World!"<br />
      trace(e.text);<br />
    }<br />
  }<br />
}</code></p>
<p>When the user clicks on the link the TextEvent.LINK event is triggered and the onClick-handler is executed and traces the string &#8220;Hello world!&#8221;. </p>
<p>This is a really neat new feature that solves a lot of problems! </p>
<p>/Simon Kjellberg</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swedishfika.com/2008/06/27/how-to-listen-to-events-from-links-within-textfields-in-actionscript-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
