• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

re-skinning Flex based on user name

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
0
Sideas
Asked:
Sideas
  • 5
  • 4
1 Solution
 
ChristoferDutzCommented:
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).
0
 
SideasAuthor 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
0
 
ChristoferDutzCommented:
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.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
SideasAuthor 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
0
 
ChristoferDutzCommented:
What type of server are you using? Java, PHP, Asp, ...?
0
 
ChristoferDutzCommented:
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

0
 
SideasAuthor Commented:
Yeah we would use PHP to connect to mySQL

Cheers
0
 
ChristoferDutzCommented:
I'm no PHP guy ... so mabe this link helps:
http://www.vipercreations.com/tutorials/Adobe%20Flex/28/

Especially this Page http://www.vipercreations.com/tutorials.php?t=28&page=3&c=Adobe%20Flex

Here you could return the skin name if the login was valid an nothing if it was invalid instead of "yes" and "no". You could then do something like this:
private function checkLogin(evt:ResultEvent):void {
	if(evt.result.loginsuccess != "") {
            styleManager.loadStyleDeclarations(evt.result.loginsuccess + "-skin.swf",
                        true, false, ApplicationDomain.currentDomain);
	}
}

Open in new window

0
 
SideasAuthor Commented:

Aaah cool, thanks a lot for your help.

Cheers
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now