Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 01-16-2009, 02:04 AM   #1
Registered User
Join Date: Jun 2008
Posts: 2
Default Embeding Images in the swf file?


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?

Here is the swf by the way: http://www.uniandino.com/oraria/huecos.swf

Thanks in advance!!!
andres625 is offline   Reply With Quote
Old 01-16-2009, 04:13 PM   #2
Peter Cowling
quantum tunneler
Join Date: Sep 2008
Location: London, UK
Posts: 882

Yes you can embed images in a .swf file. Just search for flex embed assets, and the first result should be an Adobe article to get you started.
Peter Cowling is offline   Reply With Quote
Old 01-16-2009, 04:47 PM   #3
Join Date: Aug 2008
Location: Sidney, NE
Posts: 66
Default Embed image

You can put something like this in the section with your variable definitions:

[Embed(source="assets/badges/MCII.png")] public var MCII:Class;
In my instance, I then do this:

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.
charlesshoults is offline   Reply With Quote
Old 01-16-2009, 04:56 PM   #4
Join Date: Aug 2007
Location: San Diego, CA
Posts: 434

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").
AllureFX LLC
Twitter Facebook LinkedIn
Sekhar is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Programs to Write Programs pingnak Flex 2, 3 & 4 0 09-23-2008 09:31 PM
detecting if the mouse is inside swf file 77ball ActionScript 2.0 7 09-05-2008 08:34 PM
positioning swf file frank51 ActionScript 2.0 7 09-03-2008 12:28 AM
setting stage focus to another swf file GoneNuts ActionScript 3.0 1 02-15-2008 07:17 AM
swf in swf file appear time by time sumcwan ActionScript 2.0 1 04-20-2007 07:25 AM

All times are GMT. The time now is 01:23 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.