Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It certainly is. Add the images you want to include in your Flex app, then embed them in your code like this:</p> <pre><code>&lt;fx:Script&gt; &lt;![CDATA[ [Embed(source="assets/images/yes.jpg")] [Bindable] public var YesIcon:Class; ]]&gt; &lt;/fx:Script&gt; &lt;mx:Image source="{YesIcon}" /&gt; </code></pre> <p>If you really want to use this in a toolTip, here's a good article on how to do that: <a href="http://blog.flexmp.com/2008/09/10/flex-custom-tooltip-speech-bubble/" rel="nofollow">http://blog.flexmp.com/2008/09/10/flex-custom-tooltip-speech-bubble/</a></p> <p><strong>EDIT:</strong> Here's a quick and dirty example of how to preload your images into an ArrayCollection when your application starts. You'll want to add some code to make sure all of your images are loaded before enabling the application or performing some other action, but again this should get you started.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="creationCompleteHandler(event)"&gt; &lt;fx:Script&gt; &lt;![CDATA[ import mx.collections.ArrayCollection; import mx.events.FlexEvent; private var imageArray:ArrayCollection = new ArrayCollection(); private var imageArrayIndex:int = 0; private var imagesToLoad:ArrayCollection = new ArrayCollection(); protected function creationCompleteHandler(event:FlexEvent):void { // Load your XML into the "imagesToLoad" ArrayCollection. // This should contain your list of images we need to load. PreloadImages(); } protected function PreloadImages():void { var request:URLRequest = new URLRequest(imageArray[imageArrayIndex]); var imageLoader:Loader = new Loader(); var loaderContext:LoaderContext = new LoaderContext(); loaderContext.checkPolicyFile = true; imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, PreloadImage_CompleteHandler); imageLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, PreloadImage_ErrorHandler); imageLoader.load(request,loaderContext); } // Called when the Loader we declared in PreloadImages() is done loading the image. protected function PreloadImage_CompleteHandler(event:Event):void { imageArray[imageArrayIndex] = new Bitmap(Bitmap(event.currentTarget.content).bitmapData); // Check to see if there's still images that need to be loaded. if (imageArrayIndex &lt; imagesToLoad.length - 1) { imageArrayIndex = imageArrayIndex + 1; PreloadImages(); } } // Called when the Loader we declared in PreloadImages() encountered an error trying to load the image. protected function PreloadImage_ErrorHandler(event:Event):void { Alert.show(imageArray[imageArrayIndex].toString() + " could not be loaded.\n\nPlease make sure the file exists."); // Check to see if there's still images that need to be loaded. if (imageArrayIndex &lt; imageArray.length - 1) { imageArrayIndex = imageArrayIndex + 1; PreloadImages(); } } ]]&gt; &lt;/fx:Script&gt; &lt;/s:Group&gt; </code></pre> <p>Another good component you may want to check out is the Flex BulkLoader created by Arthur Debert. It may also work well for your needs. </p> <p><a href="https://github.com/arthur-debert/BulkLoader" rel="nofollow">https://github.com/arthur-debert/BulkLoader</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload