We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

re-skinning Flex based on user name

Sideas
Sideas asked
on
Medium Priority
277 Views
Last Modified: 2012-05-11
Hi, I've found lots of re-skinning examples but not one that gives an example of loading different skins based on which  user is logging in.

If anyone knows a tutorial or could knock up a quick example that would be great.

Cheers, Paul
Comment
Watch Question

Well in my application I have different Skin-Modules (Skin SWCs) and as soon as a client connects to the server the server sends back which skin module the client should use ... In my case this is more for using different skins for different types of clients, but I think it should also work for you.
Unfortunately I haven't written a tutorial for this yet, but mabe the crutial code-element will help you :-)
    protected function initSkin(skinName:String):void {
        styleManager.loadStyleDeclarations(skinName,
                true, false, ApplicationDomain.currentDomain);
    }

Open in new window

In my code I call "initSkin" as soon as the server responds with the skin name. This causes the styleManager to load the Style-declaration module into the current domain (In my case this is the root application domain to make the styles take effect globally).

Author

Commented:

Hi, sorry, that's great but we're new to this!

Do you mean that the username and password would be checked against mySQL records and if correct a 'Company Name = Whatever' kind of thing would be passed back??

We'd be really greatful if you could give a sample of the database kind of query for that...

Thanks again, Paul
Oh well in order to give you such an example I would need to know based upon which conditions you want to use different skins.

Author

Commented:

Hi, well our skins would be changed on a client per client basis.  

Different names and passwords belonging to different clients and so changing a logo and overall background colour...that sort of thing.

Cheers, Paul
What type of server are you using? Java, PHP, Asp, ...?
In general I would have these files on my webserver:

index.html (Loading application.swf)
application.swf (containing the application)
company-a-skin.swf (containing the individual skin for company A)
company-b-skin.swf (containing the individual skin for company B)
company-c-skin.swf (containing the individual skin for company C)
company-d-skin.swf (containing the individual skin for company D)

depending on the result I would call the following code in my result function:
              initSkin(companyName + "-a-skin.swf");

Open in new window

Author

Commented:
Yeah we would use PHP to connect to mySQL

Cheers
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:

Aaah cool, thanks a lot for your help.

Cheers
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.