I am using a Canvas with a background image. At first I gave it an absolute path: http://uniandino.com/oraria/fondo1.jpg. The image isn't very big (50K), but it does take a few seconds to load when I view the swf in my browser. I then tried to pass it as a relative path: fondo1.jpg, but it still takes a few seconds to load. I was wondering if there was any way to include the image within the swf so that it wouldn't have to wait a few seconds while it loads it from an external file. Is there any way to do this? Or is there anything better than using the background image of Canvas to do this?
You can put something like this in the section with your variable definitions:
Code:
[Embed(source="assets/badges/MCII.png")] public var MCII:Class;
In my instance, I then do this:
Code:
private function init():void {
catLogo.source = MCII;
Although, I would take it easy with embedding images. It seems like if there are lot of images or large images, editing with Flex really starts to crawl.
Last edited by charlesshoults; 01-16-2009 at 04:49 PM.
Reason: Added note.
50K is nothing, are you sure it's the image that's slowing down the startup? There're many ways to speed up the start, the Flex docs have a full section. At the minimum, make sure you're not creating all your components at startup, but just the ones that're visible ("deferred creation").