I believe the fully qualified name is now used to find the type-selector.  
Namespaces allow you to specify the fully-qualified name with less typing.

So, if your component is in package foo, then declare the namespace foo and use 
it to qualify the type-selector.


On 8/29/10 11:33 AM, "Angelo Anolin" <[email protected]> wrote:






Wesley,

I did not quite understand what you meant here (my less than expertise in CSS 
and designing in general is a hindrance in tackling this quite simple problem, 
perhaps).

Previously in Flex3, when you declare a CSS style named after a component, that 
component would get the styles you have declared automatically.  Say you have a 
component myButton, then creating a default css file and naming a style 
myButton, that style is carried by the component all throughout the application.

But in Flex4, they made some changes to that. It gives you a warning (or 
error?) that you have to qualify the CSS declaration.

Now, what I did was to rename the CSS style to .myButton{}. Notice the dot 
before the CSS name.

I want this style to be used by myButton component (ActionScript) but I am lost 
where to declare or to even make the component know that it needs to use that 
style. How do I actually that style for the component whereas previously, there 
wasn't much of a problem.

I think I may also need to understand the logic why Flex decided to go on this 
path.  Certainly, if you got a lot of components and the styling is declared in 
a centralized CSS file, and then you moved to Flex4, you got to have an AWFUL 
lot of changes you need to make to your codes.

Thanks a lot.

________________________________
From: Wes! ley Acheson <[email protected]>
To: [email protected]
Sent: Fri, 27 August, 2010 14:03:14
Subject: Re: [flexcoders] Where To Declare CSS Style Name in AS Component




I think the issue is that you need to namespace all of the styles. So depending 
on which component your myButton was based off a spark component or a Halo 
component.

See the following link for more details.

http://cookbooks.adobe.com/post_How_to_use_the_new_CSS_syntax_in_Flex_4-15726.html

Another good way to do this is to use the style manager built into flash 
builder, you can apply a style to an instance of a button directly, click the 
convert to css button and see what the markup for the css looks like.

Hope this has been some help,

Wes

On Fri, Aug 27, 2010 at 10:42 PM, Angelo Anolin <[email protected]> wrote:





Anybody?

Having so much hard time trying to move flex3 to flex4.

Basically this is a styling issue which is far beyond my expertise.

If you have a component created named myButton.as, and you created a CSS file 
with a style named myButton, that CSS declaration would span all instances 
where you used the myButton component.  But since Flex4 does not like that 
naming convention of CSS, I have had to rename my CSS declaration to 
.myButton{}.

Now, how do I declare the same in my AS component to utilize that style?

Thanks a lot for any inputs on this.

________________________________
From: Angelo Anolin <[email protected]>
To: [email protected]
Sent: Fri, 27 August, 2010 10:51:02
Subject: [flexcoders] Where To Declare CSS Style Name in AS Component




Dear FlexCoders,

In Flex 3, you can simply name your CSS style to the name of the component you 
created.  For example, you created an AS component named MyNewButton, hence, in 
your CSS file, you can declare a style with name MyNewButton and the component 
automatically picks up that style.

But when you use Flex 4, you get an error saying: CSS type selectors are not 
supported in components: MyNewButton.

Modifying the CSS file, let us say the style name MyNewButton has been now 
declare as .MyNewButton{}.  How do I reference the new style name to be used by 
the component? How do I declare it in the AS file?

Thanks for your inputs.

Angelo


















--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Reply via email to