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 52ACB200C0F for ; Thu, 19 Jan 2017 02:27:32 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 512EF160B53; Thu, 19 Jan 2017 01:27:32 +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 9F43D160B44 for ; Thu, 19 Jan 2017 02:27:31 +0100 (CET) Received: (qmail 54846 invoked by uid 500); 19 Jan 2017 01:27:25 -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 54834 invoked by uid 99); 19 Jan 2017 01: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; Thu, 19 Jan 2017 01: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 1071FC186D for ; Thu, 19 Jan 2017 01:27:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.23 X-Spam-Level: *** X-Spam-Status: No, score=3.23 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=2, KAM_INFOUSMEBIZ=0.75, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, 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 E55D0j0n0uc0 for ; Thu, 19 Jan 2017 01:27:23 +0000 (UTC) Received: from mail-ua0-f180.google.com (mail-ua0-f180.google.com [209.85.217.180]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 381C05FCA2 for ; Thu, 19 Jan 2017 01:27:23 +0000 (UTC) Received: by mail-ua0-f180.google.com with SMTP id 96so23009925uaq.3 for ; Wed, 18 Jan 2017 17:27:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=3/e4TZDkN2nxfxQ16wwmDaZR4xUfUaL6PSUCZWOBciI=; b=rgGEUn9DRyN4PIGyjjfNtpVGg6rqa0C9X+ZY7YPzJflCmFkErPZm6rWf4YJuIKGs0O zHYpLgKLkDsStqHI//MtvoOS4URC4VAtPdAAEbn47ye7pQ1JhebSI9lt3RZl8a8V1ID+ ehzmery7Lglog4LpM3ciuuBZF6k7kcSeugHsYYMxThDvUUp8/5VjZcCzJMtRrkc9iVjB rW6HZGkHcC68AYIiWLiAyxh1HTRSKqGg8uHHqrHbuEN0E2xKLyEg70nfLGyhdp/J3One xxgL6y3pKEoGw0fMns0MKp1mPDswGLh2p02D4yDP9Lj2F4Goz3dLieyy4ITL1sL/eP7L k2Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=3/e4TZDkN2nxfxQ16wwmDaZR4xUfUaL6PSUCZWOBciI=; b=PNuPgreIWEDoXBf/U+TIRBLnJadmKXa7KMZFOx+M6Gybiv+ElnFv4fQRQN0Gf46/uv kiNdaJw2v3VxCZPfupIO6Lq6U0PPPragn1fP7A5Isn/yxEA5M7UjqZg1EUnremCkDAWx EBaCxVcLM13dR9/MiWBVH4Q+5L6FaFOZuFO3moriLZz08k2XeefnxJcRWQBw6xeAMS/i actgmxZVe3PVmnsRh4uYLhrHdTLLWT4btPV/zAol6REozxCcg7M7QnftMy6pk9/j4Xoh ukdos3VkmQC6AQcooXJVTtqYHhGdEa7B9+NDwxGAZyEigVwF7bB2njOJ6dC0any5wy40 CCQg== X-Gm-Message-State: AIkVDXJZD/VCu3XvykMYfryfM7EFlxv7gMdUgl349TwoMB7hjMfug5m0bRRVq/HegXDxKh7JcjzGP81uNWs4/g== X-Received: by 10.176.90.199 with SMTP id x7mr3416191uae.165.1484789242492; Wed, 18 Jan 2017 17:27:22 -0800 (PST) MIME-Version: 1.0 Sender: carlos.rovira@gmail.com Received: by 10.103.12.3 with HTTP; Wed, 18 Jan 2017 17:27:02 -0800 (PST) From: Carlos Rovira Date: Thu, 19 Jan 2017 02:27:02 +0100 X-Google-Sender-Auth: OjVNHo_uVhnHrW9cOsR7LjyenBY Message-ID: Subject: [FlexJS] Singletons are working ok? To: "dev@flex.apache.org" Content-Type: multipart/alternative; boundary=f403045f91085d7c380546686ffb archived-at: Thu, 19 Jan 2017 01:27:32 -0000 --f403045f91085d7c380546686ffb Content-Type: text/plain; charset=UTF-8 Hi, I found a problem with my Dialog implementation. It's creating a dialog each time I show it, so I try to make it a Singleton, but I can't get it working as expected: The singleton is (remove comments and not related methods to remove verbosity): *public class Dialog extends ContainerBase implements IPopUp* * {* * public function Dialog()* * {* * if(_instance)* * {* * throw new Error("Dialog should not be instantiated.");* * }* * _instance = this;* * }* * static private var _instance:Dialog;* * COMPILE::JS* * static private var dialog:HTMLDialogElement;* * static public function addDialog():Dialog* * {* * if(!_instance)* * {* * _instance = new Dialog();* * if(Application.topLevelApplication != null)* * {* * Application.topLevelApplication.addElement(_instance);* * }* * }* * return _instance;* * }* * static public function showModal():Dialog { * * if(!_instance) { * * addDialog();* * }* * COMPILE::JS * * {* * dialog.showModal();* * }* * return _instance;* * }* * }* *}* Then I have a MXML file called TestDialog.mxml that has some custom content. I call with a button click like this: *var t:TestDialog = TestDialog.showModal();* This reports and error when compile MDLExample: *Error: Call to a possibly undefined method showModal through a reference with static type TestDialog.* * var t:TestDialog = TestDialog.showModal();* ^ But as I said TestDialog is an mxml declared as: ** *....* So should has showModal static method So this seems to me a bug in FlexJS Thanks -- Carlos Rovira http://about.me/carlosrovira --f403045f91085d7c380546686ffb--