1 Reply Latest reply on Oct 28, 2011 10:50 AM by alinator11

    how to change company logo dynamically using login information of the user in flex4 CSS styl method?

    Venkatesan Balasubramanian Level 1

      hi all,

       

       

      I am doing mxml flex4 web application. i am using a login in my application. this login for multi user  purpose.

       

      My need is when a user login using his username and password his company logo should show the top of my application and his copyright details show the bottom of my application

       

      if another user login means his company logo and copywrights should show in my application.

       

      This logo and copyrights details should change dynamically based on the login information.

       

      I want to create this using CSS file (skins and sparks)

       

      How to do this,i am struck in this place,

       

      Looking for useful and helpful suggession or snippet code,

       

       

      Thanks in advance,

       

      Cheers,

       

      B.Venkatesan.

        • 1. Re: how to change company logo dynamically using login information of the user in flex4 CSS styl method?
          alinator11

          If the user is logging in, presumably you are having the user hit a back end web-server and database and using something like Blaze to connect? Right?

           

          I personally would not do this with CSS. I would map the company icons to the users in the DB, retrieve the proper company icon and then pass it down (or embed it in the app) when the user logs in. Then, I would just set the source of the icon to be what I passed down:

           

           

          Add your image where you want it to go:

          <s:Image id="emptyImage" x="locationx" y="locationy".../>

           

          Then in your ActionScript, when the user logs in and you know what company the user belongs you could do this:

           

          private function loginUserBlazeResponse(resultEvent:ResultEvent):void {

          var bytes:ByteArray = ByteArray(resultEvent.target);

          emptyImage.source = bytes;

          addElement(img);

          img.visible = false;

          img.addEventListener(FlexEvent.UPDATE_COMPLETE, imageLoaded);

          ...