[flexcoders] embedding multiple images programmatically
Hi all, I have an array of image names (of PNGs on my server), and I want to load these all up in an object list of images so I can show them when needed in my application. I've found an oddity where some of these, sometimes, don't load properly for whatever reason and are blank when I need to show them. So I am thinking I should just embed them. But since I have 50+ images, I'd like to run a loop to embed each one, and all the examples of embedding show doing something like: [Embed(source=logo.gif)] [Bindable] public var imgCls:Class; and then mapping to an image. I'd rather not fill up my code with 50 separate variable defines, any easy way to iterate through this? thanks!
Re: [flexcoders] embedding multiple images programmatically
Embedding the image in your application would increase the application filesize. I would rather suggest you to think of loading these images on runtime. You can load images on runtime using mx;Image or any other class (Loader etc)... -abdul On 4/28/07, dougco2000 [EMAIL PROTECTED] wrote: Hi all, I have an array of image names (of PNGs on my server), and I want to load these all up in an object list of images so I can show them when needed in my application. I've found an oddity where some of these, sometimes, don't load properly for whatever reason and are blank when I need to show them. So I am thinking I should just embed them. But since I have 50+ images, I'd like to run a loop to embed each one, and all the examples of embedding show doing something like: [Embed(source=logo.gif)] [Bindable] public var imgCls:Class; and then mapping to an image. I'd rather not fill up my code with 50 separate variable defines, any easy way to iterate through this? thanks!
Re: [flexcoders] embedding multiple images programmatically
mx:Image source=http//server/image.png / var image:Image = new Image (); container.addChild (image); image.source = http://foo.com/test.png;; -abdul On 4/28/07, Abdul Qabiz [EMAIL PROTECTED] wrote: Embedding the image in your application would increase the application filesize. I would rather suggest you to think of loading these images on runtime. You can load images on runtime using mx;Image or any other class (Loader etc)... -abdul On 4/28/07, dougco2000 [EMAIL PROTECTED] wrote: Hi all, I have an array of image names (of PNGs on my server), and I want to load these all up in an object list of images so I can show them when needed in my application. I've found an oddity where some of these, sometimes, don't load properly for whatever reason and are blank when I need to show them. So I am thinking I should just embed them. But since I have 50+ images, I'd like to run a loop to embed each one, and all the examples of embedding show doing something like: [Embed(source=logo.gif)] [Bindable] public var imgCls:Class; and then mapping to an image. I'd rather not fill up my code with 50 separate variable defines, any easy way to iterate through this? thanks!
Re: [flexcoders] embedding multiple images programmatically
On 4/28/07, dougco2000 [EMAIL PROTECTED] wrote: So I am thinking I should just embed them. But since I have 50+ images, I'd like to run a loop to embed each one, and all the examples of embedding show doing something like: [Embed(source=logo.gif)] [Bindable] public var imgCls:Class; There's no way to embed 50+ images without actually writing out the embed tags in your code.
Re: [flexcoders] embedding multiple images programmatically
On 4/28/07, Manish Jethani [EMAIL PROTECTED] wrote: On 4/28/07, dougco2000 [EMAIL PROTECTED] wrote: So I am thinking I should just embed them. But since I have 50+ images, I'd like to run a loop to embed each one, and all the examples of embedding show doing something like: [Embed(source=logo.gif)] [Bindable] public var imgCls:Class; There's no way to embed 50+ images without actually writing out the embed tags in your code. You could of course auto-generate the code through a script (make it part of your biuld process) and include the generated file into the main .as file. But, as Abdul says, it'll still bloat your output SWF significantly depending on the sizes of the images.