Thanks Chris, didn't catch that. I'll try today to get someway to solve it.
Thanks! 2017-01-19 7:32 GMT+01:00 Christofer Dutz <christofer.d...@c-ware.de>: > Show modal isn't defined in TestDialog, as it's defined in Dialog. So the > message is correct. In java static properties and methods aren't inherited > either. (I think) > > Chris > > > > Von meinem Samsung Galaxy Smartphone gesendet. > > > -------- Ursprüngliche Nachricht -------- > Von: Carlos Rovira <carlosrov...@apache.org> > Datum: 19.01.17 02:27 (GMT+01:00) > An: dev@flex.apache.org > Betreff: [FlexJS] Singletons are working ok? > > 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: > > *<mdl:Dialog xmlns:fx="http://ns.adobe.com/mxml/2009 > <http://ns.adobe.com/mxml/2009>"* > * xmlns:js="library://ns.apache.org/flexjs/basic > <http://ns.apache.org/flexjs/basic>"* > * xmlns:mdl="library://ns.apache.org/flexjs/mdl > <http://ns.apache.org/flexjs/mdl>"* > * xmlns="http://www.w3.org/1999/xhtml > <http://www.w3.org/1999/xhtml>">* > > *....* > > So should has showModal static method > > So this seems to me a bug in FlexJS > > Thanks > > > -- > Carlos Rovira > http://about.me/carlosrovira > -- Carlos Rovira Director General M: +34 607 22 60 05 http://www.codeoscopic.com http://www.avant2.es Este mensaje se dirige exclusivamente a su destinatario y puede contener información privilegiada o confidencial. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción. De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC S.A. La finalidad de dicho tratamiento es facilitar la prestación del servicio o información solicitados, teniendo usted derecho de acceso, rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación necesaria.