Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-15-2008, 12:55 PM   #1
Registered User
Join Date: Nov 2008
Location: Fort Lauderdale
Posts: 14
Default The StyleName Property

Alright, this it my first post/question about Flex:

What is the purpose of setting the styleName property of a component inside a custom MXML component to the same name of the custom component?

<mx:canvas styleName="nameOfComponent" etc...>

I'm guessing it it to flush default styles, but I'm not 100% sure. Thanks.
YAOMK is offline   Reply With Quote
Old 11-15-2008, 01:17 PM   #2
Paintball Freak
fx.barrett's Avatar
Join Date: Jul 2008
Location: Romania, TM
Posts: 467
Send a message via MSN to fx.barrett Send a message via Skype™ to fx.barrett

Quoted from the Flex 3 Help file:

The class style used by this component. This can be a String, CSSStyleDeclaration or an IStyleClient.

If this is a String, it is the name of a class declaration in an mx:Style tag or CSS file. You do not include the period in the styleName. For example, if you have a class style named ".bigText", set the styleName property to "bigText" (no period).

If this is an IStyleClient (typically a UIComponent), all styles in the styleName object are used by this component.

The default value is null.
It is used to associated certain styles with certain components. If that certain style is applied to only 1 component than it would be normal to name it as the component to avoid confusion ( it would be cofusing if a component is named ContactForm and it's style name is "blackDog"... ok, the example might not be bright, but I hope you got the idea ). In case the style is applied to more than 1 component ( which doesn't happen too often ) than you should give it a more generalized name like "menuBarStyles" or something like that.
FLASHFORUM.RO - You must speak Romanian in order to join.
BLOG.WISEBISOFT.COM - Share and Experiment.
fx.barrett is offline   Reply With Quote
Old 11-15-2008, 01:40 PM   #3
Registered User
Join Date: Nov 2008
Location: Fort Lauderdale
Posts: 14

Thanks fx.barrett, something tells me I'll be hearing more from you...
I looked at documentation under "canvas" but styleName was not even listed as a property there ... I guess I should have looked a bit harder. I'm following a MVCS example from the Adobe Developer Center. I been trying to figureout how to apply the OOP principles in Flex and that little detail is thrown me off for a couple hours. Thanks a lot for your help and your rather clear example.
YAOMK is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot use styleName and fontStyle property together in Label? nsurendiran Flex 2, 3 & 4 3 09-19-2008 02:53 PM
1120: Access of undefined property videofile yodasw16 Components 5 04-21-2008 06:28 PM
A Class Error from PopUpManager Class. anandkanatt Components 17 03-12-2007 07:44 AM
Director style property lists in Flash blankfist ActionScript 2.0 2 06-08-2005 06:18 PM
Detecting drag and drop funkydesigner ActionScript 1.0 (and below) 4 04-11-2001 05:32 PM

All times are GMT. The time now is 09:01 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.