?
Solved

re-skinning Flex based on user name

Posted on 2011-04-28
9
Medium Priority
?
237 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
0
Comment
Question by:Sideas
  • 5
  • 4
9 Comments
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 35482609
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
 
LVL 2

Author Comment

by:Sideas
ID: 35483038

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
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 35483399
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 2

Author Comment

by:Sideas
ID: 35483465

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
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 35483472
What type of server are you using? Java, PHP, Asp, ...?
0
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 35483499
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
 
LVL 2

Author Comment

by:Sideas
ID: 35483955
Yeah we would use PHP to connect to mySQL

Cheers
0
 
LVL 20

Accepted Solution

by:
ChristoferDutz earned 2000 total points
ID: 35484343
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
 
LVL 2

Author Comment

by:Sideas
ID: 35484365

Aaah cool, thanks a lot for your help.

Cheers
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to how to record live broadcast.

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question