Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EEC45200B58 for ; Wed, 27 Jul 2016 22:27:27 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id ED89E160A90; Wed, 27 Jul 2016 20:27:27 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2022A160A6F for ; Wed, 27 Jul 2016 22:27:26 +0200 (CEST) Received: (qmail 32226 invoked by uid 500); 27 Jul 2016 20:27:26 -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 32214 invoked by uid 99); 27 Jul 2016 20:27:25 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jul 2016 20:27:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 63965C0C99 for ; Wed, 27 Jul 2016 20:27:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.821 X-Spam-Level: X-Spam-Status: No, score=-0.821 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 3Kc5mzWceQIk for ; Wed, 27 Jul 2016 20:27:24 +0000 (UTC) Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 742525FDE1 for ; Wed, 27 Jul 2016 20:27:23 +0000 (UTC) Received: by mail-wm0-f50.google.com with SMTP id q128so226548216wma.1 for ; Wed, 27 Jul 2016 13:27:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=7Bb0YKNVtUUCPKxDok8yx73cly/DvX3FyrZvOJbQDE0=; b=wWRGs82cMIUZ93Yy+hxrpk+E9SWx50EhgLLrN2So1NlO+mG/UW5w12U+crAUY96SDc oN2dsKp7WDcx7+sQfEK4ksIMBL964oZveqcAdMUI6vkTinxCLGsPoMsIHTvp58vZbdAk d8UFWyjZjGmde4wRar3oqWXON+HWtHKwJmvhtFJ429JTgp7x1ZHm75b+8KUztCY8KAR6 jgl6DXsZdopgKsIJ3STg51gGMJa93RVenCP3EJnaAk0YAvpcbYjzEEN6cJz2EY54doH6 bdK4bYRQXchluUzz0/51i25sh8hTiq/DYZJzDQnyKFdaAHsU1XgJUOWBECnNnMvc0r1i uHSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=7Bb0YKNVtUUCPKxDok8yx73cly/DvX3FyrZvOJbQDE0=; b=gwIy5srIo2t+1pGfkzolftvNlGvJbIkLhQdSrTbbgnB3btj96PjTLWE/VWXz0FTFaB SRrjR/phkAJSwie4m2UDhimFwUeNiFeuP76Etn8GSDnKRv9Xo7w9OYyXfOXuUQVPjM1R v7rg8gfEmxxGlX+Y77z8mPE3TZRPpCe/uHHitVaQEj49KqSIgztqTAaJLkt7hEwJdjKA tsNos3IgwgeBitfSWm4rwTg6qNRHHnTzPNjYGeTXT3diA0/t453xudB8gvhYBD3y4L5c cMXaoIaiPWpK6/R/o8kycxrPvOo5ofTNMnqxTS89oW1wL1KJpVa8O0RfR96GTGvygg0v xgrQ== X-Gm-Message-State: AEkoous0PyJS5F17SfcWKr7w2nWCCwKL3i4qYdvIGx7C5VjGgyDDZMyjFdDf0+LH5oF8Iw== X-Received: by 10.194.79.161 with SMTP id k1mr20512311wjx.119.1469651227044; Wed, 27 Jul 2016 13:27:07 -0700 (PDT) Received: from [127.0.0.1] ([185.120.124.27]) by smtp.gmail.com with ESMTPSA id za2sm8001345wjb.34.2016.07.27.13.27.05 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Jul 2016 13:27:06 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: [FlexJS] HTMLElementWrapper extending Sprite From: Harbs In-Reply-To: Date: Wed, 27 Jul 2016 23:27:01 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <247BE937-7474-4ED9-825E-8CFE2CF2282E@gmail.com> References: <57064EB8-471B-4628-B7BF-F27B79D0854E@gmail.com> To: dev@flex.apache.org X-Mailer: Apple Mail (2.1878.6) archived-at: Wed, 27 Jul 2016 20:27:28 -0000 On Jul 27, 2016, at 10:42 PM, Alex Harui wrote: >=20 >=20 > On 7/27/16, 12:20 PM, "Harbs" wrote: >=20 >> Yes. It was a significant change. You can see what I did on the >> =93refactor-sprite=94 branch. >>=20 >> I spent the whole day on this. I just committed the last change to = make >> all the projects compile with no errors. (I did not test the = examples.) >>=20 >> I changed 4 base classes: HTMLElementWrapper, CSSShape, ButtonBase = and >> CSSTextField (I also made CSSSprite bas off HTMLElement.) These each = wrap >> Sprite, Shape, SimpleButton and TextField respectively. >=20 > I haven't looked at the code yet, but congrats for being able to do it = in > a day! :-) Sublime Text was very helpful in making the edits with its = multi-slect feature=85 >=20 >> They proxy the setters and getters to the composed objects where >> appropriate. CSSTextField in particular, I proxied a lot of the >> functionality because it=92s only used by Flash anyway. The = underlying >> Flash objects are available using sprite, shape, button and = textField. >>=20 >> The only class which still subclasses Sprite is Application. I don=92t = know >> a way around that. >=20 > One idea is that, since developer code never instantiates an = Application > (only the framework does) that Application could be an interface. The > framework would instantiate the concrete class. Not sure how to go about this, but I=92m not sure how bad it is for the = main app to subclass Sprite. I=92ll leave this for someone else. >>=20 >> The big question here is how to handle events. We could attach event >> listeners for every conceivable event and forward the events out. I=92d= >> like to avoid that if possible. I=92m wondering if there=92s a way to >> override addEventListener and removeEventListener so we=92d only = attach >> event listeners when we know someone is listening for them. >=20 > Doesn't the JS side already have a solution for this? = addEventListener on > the wrapper calls addEventListener on the wrapped element for certain > events. Not sure. There is some goog-specific event proxying, but I=92m not = exactly sure what it=92s doing. I guess we could add specific events as = needed, but I think it would be really great if it could happen = automagically. How much overhead is there by adding a whole list of = event listeners for every object created? TextField has 78 possible = events. I=92m not sure how many are going to be needed, but potentially = a lot. Here=92s the idea that I=92m thinking of: override public function addEventListener(type:String, = handler:Function, opt_capture:Boolean =3D false, opt_handlerScope:Object = =3D null):void { super.addEventListener(type, handler, opt_capture, = opt_handlerScope); // create a function which would field the event fired = from Flash=20 // it would examine the event to know what kind of event = it needs to throw // It might have a reference to =93handler=94, but it = might not need to because it=92s already listening sprite.addEventListener(type, proxyHandler, = opt_capture); }