Load an external style sheet into Flex
I’m surprised I haven’t tried this before but you can’t load an external style sheet into Flex. The Adobe documentation mentions loading external CSS files, but they always mean loading a style sheet before you compile your SWF which isn’t what I’d call a true external style sheet.
Thankfully Ruben has written a class that will do just that.
Flex’s implementation of style sheets is really wacky, every time I set paddingTop, paddingLeft, paddingBottom, paddingRight all to say 10px I go mildly insane because a) why can’t I just write it once ‘padding: 10px’? and b) why deviate from the CSS the rest of the world is used to, ‘padding-top’ etc.?
This entry was written by
Alastair, posted on
January 28, 2008 at 7:19 pm, filed under
ActionScript,
CSS,
Flex. Bookmark the
permalink. Follow any comments here with the
RSS feed for this post.
or leave a trackback:
Trackback URL.
© Copyright 2006 - 2012 Alastair Dawson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
2 Comments
Just for a bit of sanity, you can indeed use padding-top, padding-left, etc in Flex. It mostly converts dashes into camel case for you
But I do agree with the non-shortcut madness. Drives me batty!
Hey Kyle, Sweet! I didn’t know about the dash conversion, still within a MXML tag it will bug out (I guess one more reason to put everything in styles)