Return-Path: X-Original-To: apmail-flex-users-archive@www.apache.org Delivered-To: apmail-flex-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E68B9101F3 for ; Thu, 15 Aug 2013 22:35:28 +0000 (UTC) Received: (qmail 31785 invoked by uid 500); 15 Aug 2013 22:34:00 -0000 Delivered-To: apmail-flex-users-archive@flex.apache.org Received: (qmail 31697 invoked by uid 500); 15 Aug 2013 22:33:58 -0000 Mailing-List: contact users-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@flex.apache.org Delivered-To: mailing list users@flex.apache.org Received: (qmail 31638 invoked by uid 99); 15 Aug 2013 22:33:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Aug 2013 22:33:40 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of arne.broedel@googlemail.com designates 209.85.216.49 as permitted sender) Received: from [209.85.216.49] (HELO mail-qa0-f49.google.com) (209.85.216.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Aug 2013 22:33:34 +0000 Received: by mail-qa0-f49.google.com with SMTP id cr7so163965qab.1 for ; Thu, 15 Aug 2013 15:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=/iQKXcSKJtuD/zSvx8XWYK8AIniY8Jetx5yKCHhy3lE=; b=Uw/KM7Q+gzC16NuQqR5OxSjf+Ka4JxIYF8WqmqgZPTjV+LOhxcCIgxG6kguljFZgAI Ru2sQHdnW8UXz48XNo0JB28dfDT78Xen1z7Vt6cd1HgLrv4z7icK1rdo3cILvSCeJh7B WnQcOhqF8vved0AEVu3skou2+Oi4vx5gsCvPgVzkHMzi6lWW9BK/N9xL/1gVrynv6kkt JKWzpibm7cdyaIlNDjJ9XWvGVRkft3zmIYzLFxSWQns1cwmf8ThCTDADC1nB2JLG4d1P nkUIBtq/DIJiGCQuEsDl0HTxGV6TAuUlEmW7t7B1KnJcMdSalawrUVb2S19xdY8VJ6sp bTmA== MIME-Version: 1.0 X-Received: by 10.229.103.73 with SMTP id j9mr5097292qco.33.1376605994008; Thu, 15 Aug 2013 15:33:14 -0700 (PDT) Received: by 10.49.127.6 with HTTP; Thu, 15 Aug 2013 15:33:13 -0700 (PDT) In-Reply-To: References: Date: Fri, 16 Aug 2013 00:33:13 +0200 Message-ID: Subject: Re: Resizable Component that manages to keep its proportions From: Arne Broedel To: users@flex.apache.org Content-Type: multipart/alternative; boundary=001a1133417044c43d04e4040f75 X-Virus-Checked: Checked by ClamAV on apache.org --001a1133417044c43d04e4040f75 Content-Type: text/plain; charset=ISO-8859-1 thank you 2013/8/16 Alex Harui > Measure() would be called whenever invalidateSize() is called, which is > not just when added to the container. But you are right that > invalidateSize() isn't called when width or height is set. You could use > event handlers or override the setters. > > Sounds like you got it working though. > > On 8/15/13 2:58 PM, "Arne Broedel" wrote: > > >but the measure method will only be invoked when adding the object to a > >container. So it wont work on resize, does it? > >The only way I could get it working is this script in my Button-Skin: > > > > protected function > >sparkbuttonskin1_initializeHandler(event:FlexEvent):void > >{ > >this.hostComponent.addEventListener("widthChanged",sizeChangeHandler); > >this.hostComponent.addEventListener("heightChanged",sizeChangeHandler); > > } > > > > protected function sizeChangeHandler(event:Event):void > >{ > >switch (event.type) > >{ > >case "widthChanged": > >if(this.hostComponent.height!=this.hostComponent.width*2) > >{ > >this.hostComponent.height=this.hostComponent.width*2; > >} > >break; > >case "heightChanged": > >if(this.hostComponent.width!=this.hostComponent.height/2) > >{ > >this.hostComponent.width=this.hostComponent.height/2; > >} > > } > > > >} > > > >The propertyChanged Event, that I was trying to listen to in the first > >place, is not dispatched by changing width and height. So it has to be > >"widthChanged" and "heightChanged". > >Moreover, and I dont know why, this only works on the hostComponent. > > > > > >2013/8/15 Alex Harui > > > >> In theory, in the measure() method, you would set measuredWidth or > >> measuredHeight based on explicitHeight and/or explicitWidth > >> > >> On 8/15/13 11:43 AM, "Arne Broedel" wrote: > >> > >> >Hi Flex-Community, > >> >I am skinning a Button with an icon. The Button should be sizable but > >>keep > >> >its proportions. > >> >Its proportions width to height is 2 to 1. So every time the width is > >> >changed the height shall change to width/2 and every time the height is > >> >changed the width shall change to height*2. > >> >Anyone can tell me a proper solution. > >> >Thans > >> > >> > > --001a1133417044c43d04e4040f75--