I have started to program a new Flash game and wanted to add a splash screen for XlanderSoftware. The requirements where to display an image that when clicked would open a new browser window to my website.

This is pretty easy to do in Flash. The only tricky part was bitmaps can not have mouse events attached to them so you need to have your logo bitmap inside a sprite. This makes it very easy to make a custom sprite class that shows your logo and when clicked takes opens a new browser window to your website.

Here is an example class.

import flash.display.Sprite;
import flash.display.Bitmap;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;
 
public class XlanderLogo extends Sprite
{
   private var logo:Bitmap;
 
   public function XlanderLogo()
   {
      logo = new Resources.XlanderLogo();
      addChild(logo);
      this.addEventListener(MouseEvent.CLICK, LogoClicked);
   }
 
      private function LogoClicked(event:MouseEvent) : void
      {
         var url:URLRequest = new URLRequest(Resources.XlanderSoftwareURL);
         navigateToURL(url, "_blank");
      }
}



Related Posts:
Chicken Farmer
A game about breeding chickens, selling eggs and making profit! The main aim of the...
Your Ad Here