Posts

Showing posts with the label image

Flex Image Map

I thought since I mentioned it way back when in a tweet, I should post the code for my selectable map component. I thought this was going to be super tough, but once I found the ImageMap component in flexlib it wasn't bad at all. Here is the example with view source enabled. This example also shows how to create a custom event, which I also mentioned in a previous post .

Flex embed an image as a Class

// Embed the image once and refer to the Class [Bindable] [Embed(source="../assets/images/myImageFile.png")] public var myImage:Class; This is helpful if you're using the same image in several places, this way you only have to embed it once, and if you change the image file name you only have to change it in one place. You can also create a Class that holds all the images and you can get an instance of that Class to refer to your images. For example: package com.view {  import mx.binding.utils.BindingUtils;  [Bindable]  public class AssetImporter  {   private static var instance : AssetImporter;   //return singleton instance of AssetImporter   public static function getInstance() : AssetImporter  &nbsp{    if (instance == null)    instance = new AssetImporter();    return instance;   }   //put your images here   //One   [Embed(source="/assets/imag...