OK, I am soooooo close. I think the only remaining compatibility issue
is that Flex 3 seems to auto-size a Button to match the dimensions of
its skin (very handy) but Flex 2 doesn't. I would like to avoid
setting the sizes of my default buttons because that will make things
much harder to restyle and makes runtime style switching a pretty huge
pain. If I don't provide sizes though, the Buttons look wonky in Flex 2.

Any suggestions? Is there a way to detect the dimensions of a
graphical skin?

Thanks,
Ben



--- In flexcoders@yahoogroups.com, "Gordon Smith" <[EMAIL PROTECTED]> wrote:
>
> Well, I'm pretty sure that Flex 2 didn't support having a defaults.css
> file inside a SWC, so that leaves the classConstruct() method if you
> want common code to support both Flex 2 and Flex 3. I don't follow your
> statement that this method "falls short of supporting the styleName path
> since its static and cannot reference instance properties". What
> instance properties, of what object, are you talking about needing to
> reference when you programmatically create CSSStyleDeclarations?
>  
> > In fact, shouldn't a Flex 2 SWC work in Flex 3? 
>  
> Some might, but others might not... we haven't made any effort to
> guarantee that kind of compatibility.
>  
> Gordon Smith
> Adobe Flex SDK Team
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of ben.clinkinbeard
> Sent: Wednesday, January 23, 2008 3:40 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Seriously, what is the 'right' way to do
> default styles?
> 
> 
> 
> I can deal with producing 2 SWCs but can you recommend an approach to
> do so with the least amount of differences in the code? Having to do
> some forking I can live with but if its defaultFactory for Flex 2 and
> defaults.css for Flex 3 thats not so doable. In fact, shouldn't a Flex
> 2 SWC work in Flex 3? I thought backwards compatibility was preserved
> in all but the most unavoidable of scenarios.
> 
> Ben
> 
> --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> , "Gordon Smith" <gosmith@> wrote:
> >
> > If you're trying to produce a single SWC that works with both Flex 2
> and
> > Flex 3, you're trying to do something that the SDK team doesn't try to
> > do. We don't guarantee that you can link a Flex 2 app against our Flex
> 3
> > SWCs, or vice versa, except that we try to support Flex 2 resource
> > bundle SWCs in Flex 3 apps. I'm afraid that I don't have any advice on
> > how to do what you want to do. My recommendation is to produce a Flex
> 2
> > SWC and a Flex 3 SWC if you have to support Flex 2.
> > 
> > Gordon Smith
> > Adobe Flex SDK Team
> > 
> > ________________________________
> > 
> > From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> ] On
> > Behalf Of ben.clinkinbeard
> > Sent: Wednesday, January 23, 2008 2:28 PM
> > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> > Subject: [flexcoders] Re: Seriously, what is the 'right' way to do
> > default styles?
> > 
> > 
> > 
> > Hehe, thanks for the reply Gordon. I wasn't referring to design view
> > problems as I don't use it either. I was referring to the fact that it
> > seems you are required to put a global selector in your defaults.css
> > that includes styles for an untold number of components if you want
> > the SWC to be compatible with Flex 2.x. as described here:
> > http://tech.groups.yahoo.com/group/flexcoders/message/99374.
> <http://tech.groups.yahoo.com/group/flexcoders/message/99374.> 
> > <http://tech.groups.yahoo.com/group/flexcoders/message/99374.
> <http://tech.groups.yahoo.com/group/flexcoders/message/99374.> > Is it
> > trying to use the defaults.css from my SWC to style the whole app?
> > 
> > I am not trying to create a whole new theme or anything, I just want
> > the styles for my component included, so I don't want to compile
> > repeatedly until I figure out exactly what has to be in my global
> > selector.
> > 
> > As for examples in the framework, I've had a hard time finding ones
> > that map to my scenario well as most of the style names specified in
> > other style selectors simply get applied to a subcomponent. I would be
> > more than happy to follow your lead if you can point me to some good
> > examples to reference.
> > 
> > Thanks,
> > Ben
> > 
> > --- In flexcoders@yahoogroups.com
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > , "Gordon Smith" <gosmith@> wrote:
> > >
> > > OK, I have to eat crow. : )
> > > 
> > > My fellow team members tell me that Flex Builder's design view
> doesn't
> > > process the default.css file in 3rd party SWCs. I wasn't aware of
> this
> > > because I'm on the SDK team, not the Flex Builder team, and when I
> use
> > > Flex Builder I don't use design view.
> > > 
> > > I'm going to go slink under my desk and let others opine on how to
> do
> > > styles correctly in a way that will make Flex Builder happy.
> > > 
> > > Gordon Smith
> > > Adobe Flex SDK Team
> > > 
> > > ________________________________
> > > 
> > > From: flexcoders@yahoogroups.com
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > [mailto:flexcoders@yahoogroups.com
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > ] On
> > > Behalf Of Gordon Smith
> > > Sent: Wednesday, January 23, 2008 1:43 PM
> > > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com> 
> > > Subject: RE: [flexcoders] Seriously, what is the 'right' way to do
> > > default styles?
> > > 
> > > 
> > > 
> > > > the lack of definitive info on this topic is pretty amazing to me
> > > 
> > > Ben, what could be more definitive than the approach that the Flex
> SDK
> > > team takes for its own components? You don't have to follow our
> lead,
> > > but I still think it counts as best practice.
> > > 
> > > Flex framework SWCs, such as framework.swc and airframework.swc,
> > contain
> > > a defaults.css file, and this file references embeddable assets that
> > are
> > > also in the SWC. The "host of problems" you are referring to (and I
> > > don't understand what they are) can't be any worse than those Flex
> > > developers encounter simply by using the standard Flex SWCs.
> > > 
> > > - Gordon
> > > 
> > > ________________________________
> > > 
> > > From: flexcoders@yahoogroups.com
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > [mailto:flexcoders@yahoogroups.com
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > ] On
> > > Behalf Of ben.clinkinbeard
> > > Sent: Wednesday, January 23, 2008 12:21 PM
> > > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com> 
> > > Subject: [flexcoders] Seriously, what is the 'right' way to do
> default
> > > styles?
> > > 
> > > 
> > > 
> > > OK, the lack of definitive info on this topic is pretty amazing to
> me
> > > so I would like to help get something out there once and for all.
> The
> > > problem to which I am referring is how to define default yet
> > > overridable styles for custom components, including times when those
> > > styles require embedded assets. This has been discussed before, but
> > > the threads seem to endorse differing methods and neither provides
> > > much in the way of concrete examples.
> > > 
> > >
> >
> http://tech.groups.yahoo.com/group/flexcoders/message/98546?threaded=1&p
> <http://tech.groups.yahoo.com/group/flexcoders/message/98546?threaded=1&;
> p> 
> >
> <http://tech.groups.yahoo.com/group/flexcoders/message/98546?threaded=1&;
> <http://tech.groups.yahoo.com/group/flexcoders/message/98546?threaded=1&;
> > 
> > p> 
> > > =8
> > >
> >
> <http://tech.groups.yahoo.com/group/flexcoders/message/98546?threaded=1&;
> <http://tech.groups.yahoo.com/group/flexcoders/message/98546?threaded=1&;
> > 
> >
> <http://tech.groups.yahoo.com/group/flexcoders/message/98546?threaded=1&;
> <http://tech.groups.yahoo.com/group/flexcoders/message/98546?threaded=1&;
> > 
> > > 
> > > p=8> 
> > > http://tech.groups.yahoo.com/group/flexcoders/message/94547
> <http://tech.groups.yahoo.com/group/flexcoders/message/94547> 
> > <http://tech.groups.yahoo.com/group/flexcoders/message/94547
> <http://tech.groups.yahoo.com/group/flexcoders/message/94547> > 
> > > <http://tech.groups.yahoo.com/group/flexcoders/message/94547
> <http://tech.groups.yahoo.com/group/flexcoders/message/94547> 
> > <http://tech.groups.yahoo.com/group/flexcoders/message/94547
> <http://tech.groups.yahoo.com/group/flexcoders/message/94547> > > 
> > > 
> > > I will use my personal efforts as an example here because its fairly
> > > complex and I think if we can define a solution for it then most
> other
> > > scenarios will be covered in the process. I have a component,
> > > MDIWindow. I want its style to point to other styles (as seen in
> Panel
> > > with titleStyleName and various other places in the Flex framework)
> > > with properties named focusStyleName and noFocusStyleName. Those
> > > "second-level" styles will then embed assets and contain a
> > > ClassReference directive. The end user should be able to define a
> > > MDIWindow style in their CSS but should also be able to specify
> > > styleName on an instance and have it point to alternate styles (all
> > > MDIWindow instances should not have to be styled the same).
> > > 
> > > The classConstruct() static method + AS and defaultFactory()
> > > (mentioned by Alex above as probably the best option) works well for
> > > defining the MDIWindow type selector styles but falls short of
> > > supporting the styleName path since its static and cannot reference
> > > instance properties.
> > > 
> > > The CSS approach (recommended by Gordon above) has issues when it
> > > comes to embedding assets in the resulting SWC (I think) unless you
> > > use the defaults.css approach, but that comes with its own host of
> > > problems
> (http://tech.groups.yahoo.com/group/flexcoders/message/99374
> <http://tech.groups.yahoo.com/group/flexcoders/message/99374> 
> > <http://tech.groups.yahoo.com/group/flexcoders/message/99374
> <http://tech.groups.yahoo.com/group/flexcoders/message/99374> > 
> > > <http://tech.groups.yahoo.com/group/flexcoders/message/99374
> <http://tech.groups.yahoo.com/group/flexcoders/message/99374> 
> > <http://tech.groups.yahoo.com/group/flexcoders/message/99374
> <http://tech.groups.yahoo.com/group/flexcoders/message/99374> > > ).
> > > 
> > > I (and many others I think) are simply looking for an approach that
> is
> > > flexible, compatible with Flex 2.x and preferably has the
> "recommended
> > > by Adobe" stamp. I figure at the very least maybe we can get two of
> > > the SDK engineers to duke it out (Deepa, you're in charge of
> > > photgraphing), and hopefully whoever can still use a keyboard
> > > afterwards will post a wonderfully detailed diatribe on the "right"
> > > way to do default styles.
> > > 
> > > Thanks!
> > > Ben
> > >
> >
>


Reply via email to