1

I have been given the unenviable task of displaying a logo on a flex 3.2 form on our website. I'm learning flex as I go, and I can embed a logo now.

The problem is, I need to display a different logo, depending on which client the user works for. And I need to have it working by end of day, Friday, August 30th. As in, this Friday.

This is the code I have for embedding the logo:

<mx:GridRow width="100%" height="100%">
    <mx:GridItem width="100%" height="100%" colSpan="6">
        <mx:Image width="180" source="@Embed('/assets/images/logo.JPG')"/>
    </mx:GridItem>
</mx:GridRow>

So, what I need to know is, is there any way to get Flex 3.2 to display a different logo for each client? The above code obviously isn't going to do it.

As a further bit of info, we do have the logos as blobs in the Oracle database.

Thanks for any help.

Kevin
  • 153
  • 1
  • 3
  • 10

2 Answers2

2

You need not embed, you can give path to the images on the server. like

 <mx:Image width="180" source="http://somedomain.com/images/logo.JPG" 
id='image'/>

OR, using the id of the image component, you can assign the logo dynamically, like the following

private function onCreationcomplete(e:FlexEvent):void
{
if(client ='xxyy'){
 image.source = 'http://somedomain.com/images/xxyy.JPG ';
}
}
Zeus
  • 6,386
  • 6
  • 54
  • 89
  • 1
    Techincally, the OP could also embed every logo needed and then use some code to determine which one to display. That will, probably, bloat the size of his SWF if he has a lot of logos. +1 from me. – JeffryHouser Aug 27 '13 at 04:45
  • Thanks, Zeus and Reboog711. I'm going to do a combination of your approaches. There are only 3 logos, fairly small, but I'll load all 3 dynamically, then use the visible attribute to display the one we want. – Kevin Aug 27 '13 at 16:56
1

If you are familiar with BlazeDS, then you could try this approach: BLOB from Java to Flex via BlazeDS.

For the approach from @Zeus I would recommend to write an image servlet which delivers the client logo at request from your database blob.

splash
  • 13,037
  • 1
  • 44
  • 67
  • Splash, I like the image servlet. I'm not advanced enough in java yet, to feel comfortable that I could get it to work in time. But I've bookmarked the page, and will revisit the logo issue the next time they want to add a new logo. – Kevin Aug 27 '13 at 16:58
  • Oh, I should add that the reason I'm not sure I can get it working in time is that I have to do the same sort of thing in a different website, that I haven't worked with yet. By Friday EOD. – Kevin Aug 27 '13 at 17:01