Return-Path: X-Original-To: apmail-flex-dev-archive@www.apache.org Delivered-To: apmail-flex-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5409DF94F for ; Wed, 10 Apr 2013 22:07:41 +0000 (UTC) Received: (qmail 83782 invoked by uid 500); 10 Apr 2013 22:07:40 -0000 Delivered-To: apmail-flex-dev-archive@flex.apache.org Received: (qmail 83757 invoked by uid 500); 10 Apr 2013 22:07:40 -0000 Mailing-List: contact dev-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list dev@flex.apache.org Received: (qmail 83749 invoked by uid 99); 10 Apr 2013 22:07:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Apr 2013 22:07:40 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of aharui@adobe.com designates 64.18.1.23 as permitted sender) Received: from [64.18.1.23] (HELO exprod6og109.obsmtp.com) (64.18.1.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Apr 2013 22:07:34 +0000 Received: from outbound-smtp-1.corp.adobe.com ([192.150.11.134]) by exprod6ob109.postini.com ([64.18.5.12]) with SMTP ID DSNKUWXikgpMG/dyXlQl3ce6JTtxJnoMUkAK@postini.com; Wed, 10 Apr 2013 15:07:14 PDT Received: from inner-relay-1.corp.adobe.com ([153.32.1.51]) by outbound-smtp-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id r3AM431v012444 for ; Wed, 10 Apr 2013 15:04:03 -0700 (PDT) Received: from nacas01.corp.adobe.com (nacas01.corp.adobe.com [10.8.189.99]) by inner-relay-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id r3AM34AY023850 for ; Wed, 10 Apr 2013 15:07:13 -0700 (PDT) Received: from NAMBX02.corp.adobe.com ([10.8.127.96]) by nacas01.corp.adobe.com ([10.8.189.99]) with mapi; Wed, 10 Apr 2013 15:02:43 -0700 From: Alex Harui To: "dev@flex.apache.org" Date: Wed, 10 Apr 2013 15:02:42 -0700 Subject: Re: SVG button with skin states and JS Thread-Topic: SVG button with skin states and JS Thread-Index: Ac42NAkZLUVEilrLSaCk6JjY8E8BCAAAxZr5 Message-ID: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-Entourage/13.16.0.130206 acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org On 4/10/13 2:39 PM, "OmPrakash Muppirala" wrote: >>> It is not a limitation of the SVG background-images. The same flicker >>> happens when you use a .png or a .jpg as background. It seems like the >>> images are lazy loaded and I am not sure if we can force the images to = be >>> loaded into memory without resorting to hacks. >> Again, we want to identify the best implementation and encapsulate it. >> Howe >> are other frameworks skinning buttons? >=20 >=20 >=20 > The widely acceptable solutions seem to be: > a) Preload the images using in an onLoad javascript function > b) Use a sprite sheet. So, it would look something like (copy-pasta from > [1]): >=20 > /* "rollover-sprite.png" file contains images for both states side by sid= e. */ > A { > background: url(rollover-sprite.png) no-repeat;} > /* Width of image for each state is supposed to be 100px here > (sprite will be ~200px wide). */A:hover { > background-position: -100px 0;} >=20 >=20 >=20 > What I am doing is a modification of the sprite sheet solution. Except > that I am toggling visibility of states instead of translating the sprite > sheet. >=20 > Again, I wouldn't want to go this route because it limits us to built in > pseudo-selectors/states. For example, we wont be able to do a three-stat= e > checkbox (selected, unselected, partially selected) with this approach. >=20 > [1] > http://stackoverflow.com/questions/13015603/css3-background-transition-fl= icker > s-on-first-hover Well, if sprite-sheets are the best practice, why not use the same techniqu= e for SVG? Otherwise, how does the designer express what they want without code? I'm not clear that spritesheets truly have a psuedo-state limitation. CSS usually allows for extensibility in most places, and/or you might alter the class selector name. How would you do a toggle-button bar if there weren't separate hover visuals for selected-and-hovered? --=20 Alex Harui Flex SDK Team Adobe Systems, Inc. http://blogs.adobe.com/aharui