I'm building a somewhat large Flex project that includes several modules (a single Flex project that produces multiple SWFs)
Right now, I have a single css file, being loaded in the main SWF tag:
<s:Application ... >
<fx:Style source="css/main.css" />
...
</s:Application>
In the CSS file:
/* CSS file */
@namespace s "library://ns.adobe.com/flex/spark";
s|Panel {
skinClass: ClassReference("com.skins.DefaultPanelSkin");
}
s|Button {
skinClass: ClassReference("com.skins.DefaultButtonSkin");
}
The CSS file is not referenced anywhere else.
I have currently 6 modules (plus the main SWF, a total of 7 SWFs). I've noticed that the number of warnings is correlated to the number of modules...every time I add a module, I get more warnings. Right now, I get 6 warnings for every entry in the CSS file, so:
CSS type selectors are not supported in components: 'Panel'
CSS type selectors are not supported in components: 'Panel'
CSS type selectors are not supported in components: 'Panel'
CSS type selectors are not supported in components: 'Panel'
CSS type selectors are not supported in components: 'Panel'
CSS type selectors are not supported in components: 'Panel'
And repeat for Button, TextArea, etc etc. I have so many useless warnings, it is impossible to see if there are any valid ones.
Is this warning caused by something I'm doing wrong? The styles are all being applied correctly and appears to work just the way I want at runtime. If I'm doing nothing wrong, can I tell the compiler to ignore this warning?
NOTE: I've tried the -show-unused-type-selector-warnings=false
compiler flag, and it does not work...that's for a similar but different warning.
Use just * {margin:0; box-sizing: border-box;} as your Quick Reset.
The asterisk (*) is known as the CSS universal selectors. It can be used to select any and all types of elements in an HTML page. The asterisk can also be followed by a selector while using to select a child object. This selector is useful when we want to select all the elements on the page.
A CSS selector is the first part of a CSS Rule. It is a pattern of elements and other terms that tell the browser which HTML elements should be selected to have the CSS property values inside the rule applied to them.
The Universal Selector is the * in CSS. Literally the asterisk character. It is essentially a type selector that matches any type. Type meaning an HTML tag like <div> , <body> , <button> , or literally any of the others. A common use is in the universal reset, like this: * { margin: 0; padding: 0; }
If you're looking at the warnings in FlexBuilder, you should be able to use Eclipse's problem filtering GUI. Assuming Flex 4 is sufficiently similar to Flex 3 in this regard, on the problems tag at the top right, there's a button with the tooltip "Configure the filters to be applied to this view". It's the one with the arrows.
In the filters dialog, on the default filter, set description to "doesn't contain" and the text under it to "CSS type selectors are not supported in components".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With