You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by DavidM <dm...@gmail.com> on 2014/12/12 08:23:27 UTC

DG (class is not an IEventDispatcher)

Hi, I'm running into a problem with updating a DataGrid.Basically data in an
ItemRender won't update, but it will update in a regular column.The Debugger
says: "warning: unable to bind to property 'company' on class 'Object'
(class is not an IEventDispatcher)"This can best be demonstrated by this
grid:																																													 																											
Changes to the 'company' field do update the first column, but not the
second.Thoughts?David



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDispatcher-tp9124.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

AW: DG (class is not an IEventDispatcher)

Posted by Krüger, Olaf <OK...@edscha.com>.
> I'm guessing that the 'set data()' function is preferred over the 'prepare()' function but I seem to recall reading somewhere that 'prepare()' is more efficient.
I'm always override the 'set data()' setter if I have to do something 'special' inside the ItemRenderer, but I don't know if this is the most efficient way.
The most examples out there, also these provided by adobe, are using this way I think.



-----Ursprüngliche Nachricht-----
Von: DavidM [mailto:dmoshal@gmail.com]
Gesendet: Freitag, 12. Dezember 2014 09:40
An: users@flex.apache.org
Betreff: Re: DG (class is not an IEventDispatcher)

Olaf,

Both my examples above work, even though dataField is not specified.

It would appear that the GridItemRenderer triggers on row changes, not data
field changes.

This makes sense to me because often you want to create a nested structure in a cell that reacts to more than one datafield.

I'm guessing that the 'set data()' function is preferred over the 'prepare()' function but I seem to recall reading somewhere that 'prepare()'
is more efficient.

>From what I can see in the debugger, they both get called, set data() before
prepare()

Any thoughts?

Dave



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDispatcher-tp9124p9130.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
[Merry Christmas - Frohe Weihnachten - Feliz Navidad - Joyeux Noel - Vesele Vanoce]

________________________________

Edscha Holding GmbH
Sitz der Gesellschaft: Remscheid
Registergericht: Wuppertal, HRB 22889
Geschäftsführung: Francisco J. Riberas Mera, Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Markus Kirchner, Hans-Peter Schulz und Volker Weiss

Vertretungsberechtigt sind nur Geschäftsführer und schriftlich Bevollmächtigte.

Solely Managing Directors or employees with a written proxy have got power of representation.

Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung, Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System. Vielen Dank.

The contents of this e-mail including any attachments are confidential and may be legally privileged. If you are not the intended recipient, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete this e-mail including any attachments from your system. Thank you.

Re: DG (class is not an IEventDispatcher)

Posted by DavidM <dm...@gmail.com>.
Olaf,  

Both my examples above work, even though dataField is not specified.  

It would appear that the GridItemRenderer triggers on row changes, not data
field changes.   

This makes sense to me because often you want to create a nested structure
in a cell that reacts to more than one datafield. 

I'm guessing that the 'set data()' function is preferred over the
'prepare()' function but I seem to recall reading somewhere that 'prepare()'
is more efficient.  

>From what I can see in the debugger, they both get called, set data() before
prepare()

Any thoughts?  

Dave



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDispatcher-tp9124p9130.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

AW: DG (class is not an IEventDispatcher)

Posted by Krüger, Olaf <OK...@edscha.com>.
Try to pass it in your mxml:
<s:GridColumn dataField="company">



-----Ursprüngliche Nachricht-----
Von: DavidM [mailto:dmoshal@gmail.com]
Gesendet: Freitag, 12. Dezember 2014 09:24
An: users@flex.apache.org
Betreff: Re: DG (class is not an IEventDispatcher)






--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDispatcher-tp9124p9129.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
[Merry Christmas - Frohe Weihnachten - Feliz Navidad - Joyeux Noel - Vesele Vanoce]

________________________________

Edscha Holding GmbH
Sitz der Gesellschaft: Remscheid
Registergericht: Wuppertal, HRB 22889
Geschäftsführung: Francisco J. Riberas Mera, Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Markus Kirchner, Hans-Peter Schulz und Volker Weiss

Vertretungsberechtigt sind nur Geschäftsführer und schriftlich Bevollmächtigte.

Solely Managing Directors or employees with a written proxy have got power of representation.

Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung, Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System. Vielen Dank.

The contents of this e-mail including any attachments are confidential and may be legally privileged. If you are not the intended recipient, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete this e-mail including any attachments from your system. Thank you.

Re: DG (class is not an IEventDispatcher)

Posted by DavidM <dm...@gmail.com>.
				




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDispatcher-tp9124p9129.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: DG (class is not an IEventDispatcher)

Posted by OmPrakash Muppirala <bi...@gmail.com>.
The code did not come through in the email.  It can be seen here:
http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDispatcher-tp9124.html

Thanks,
Om

2014-12-11 23:46 GMT-08:00 Krüger, Olaf <OK...@edscha.com>:
>
> > Thoughts?
> You should provide some code
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: DavidM [mailto:dmoshal@gmail.com]
> Gesendet: Freitag, 12. Dezember 2014 08:27
> An: users@flex.apache.org
> Betreff: Re: DG (class is not an IEventDispatcher)
>
>
>
> Changes to the 'company' field do update the first column, but not the
> second.
>
> Thoughts?
>
> David
>
>
>
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDispatcher-tp9124p9125.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
> [Merry Christmas - Frohe Weihnachten - Feliz Navidad - Joyeux Noel -
> Vesele Vanoce]
>
> ________________________________
>
> Edscha Holding GmbH
> Sitz der Gesellschaft: Remscheid
> Registergericht: Wuppertal, HRB 22889
> Geschäftsführung: Francisco J. Riberas Mera, Francisco López Peña, David
> Vázquez Pascual, Torsten Greiner, Markus Kirchner, Hans-Peter Schulz und
> Volker Weiss
>
> Vertretungsberechtigt sind nur Geschäftsführer und schriftlich
> Bevollmächtigte.
>
> Solely Managing Directors or employees with a written proxy have got power
> of representation.
>
> Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist
> vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der
> bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung,
> Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte
> informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie
> die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System.
> Vielen Dank.
>
> The contents of this e-mail including any attachments are confidential and
> may be legally privileged. If you are not the intended recipient, any
> disclosure, copying, distribution or use of its contents is strictly
> prohibited, and you should please notify the sender immediately and then
> delete this e-mail including any attachments from your system. Thank you.
>

AW: DG (class is not an IEventDispatcher)

Posted by Krüger, Olaf <OK...@edscha.com>.
> Thoughts?
You should provide some code




-----Ursprüngliche Nachricht-----
Von: DavidM [mailto:dmoshal@gmail.com]
Gesendet: Freitag, 12. Dezember 2014 08:27
An: users@flex.apache.org
Betreff: Re: DG (class is not an IEventDispatcher)



Changes to the 'company' field do update the first column, but not the second.

Thoughts?

David



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDispatcher-tp9124p9125.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
[Merry Christmas - Frohe Weihnachten - Feliz Navidad - Joyeux Noel - Vesele Vanoce]

________________________________

Edscha Holding GmbH
Sitz der Gesellschaft: Remscheid
Registergericht: Wuppertal, HRB 22889
Geschäftsführung: Francisco J. Riberas Mera, Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Markus Kirchner, Hans-Peter Schulz und Volker Weiss

Vertretungsberechtigt sind nur Geschäftsführer und schriftlich Bevollmächtigte.

Solely Managing Directors or employees with a written proxy have got power of representation.

Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung, Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System. Vielen Dank.

The contents of this e-mail including any attachments are confidential and may be legally privileged. If you are not the intended recipient, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete this e-mail including any attachments from your system. Thank you.

AW: DG (class is not an IEventDispatcher)

Posted by Krüger, Olaf <OK...@edscha.com>.
> Thoughts?
Seems that you've forgot to pass the 'dataField' property to your 'itemRenderer column':

<!-- second column: same data field 'company', but using itemrenderer -->
<s:GridColumn dataField="company">
        <s:itemRenderer>
                <fx:Component>
                        <s:GridItemRenderer>
                                <s:VGroup>
                                        <s:Label text="{data.company}"/>
                                </s:VGroup>
                        </s:GridItemRenderer>
                </fx:Component>
        </s:itemRenderer>
</s:GridColumn>


Olaf





-----Ursprüngliche Nachricht-----
Von: DavidM [mailto:dmoshal@gmail.com]
Gesendet: Freitag, 12. Dezember 2014 08:27
An: users@flex.apache.org
Betreff: Re: DG (class is not an IEventDispatcher)



Changes to the 'company' field do update the first column, but not the second.

Thoughts?

David



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDispatcher-tp9124p9125.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
[Merry Christmas - Frohe Weihnachten - Feliz Navidad - Joyeux Noel - Vesele Vanoce]

________________________________

Edscha Holding GmbH
Sitz der Gesellschaft: Remscheid
Registergericht: Wuppertal, HRB 22889
Geschäftsführung: Francisco J. Riberas Mera, Francisco López Peña, David Vázquez Pascual, Torsten Greiner, Markus Kirchner, Hans-Peter Schulz und Volker Weiss

Vertretungsberechtigt sind nur Geschäftsführer und schriftlich Bevollmächtigte.

Solely Managing Directors or employees with a written proxy have got power of representation.

Der Inhalt dieser E-Mail einschließlich etwaiger beigefügter Dateien ist vertraulich und nur für den Empfänger bestimmt. Sollten Sie nicht der bestimmungsgemäße Empfänger sein, ist Ihnen jegliche Offenlegung, Vervielfältigung, Weitergabe oder Nutzung des Inhalts untersagt. Bitte informieren Sie in diesem Fall unverzüglich den Absender und löschen Sie die E-Mail einschließlich etwaiger beigefügter Dateien von Ihrem System. Vielen Dank.

The contents of this e-mail including any attachments are confidential and may be legally privileged. If you are not the intended recipient, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete this e-mail including any attachments from your system. Thank you.

Re: DG (class is not an IEventDispatcher)

Posted by DavidM <dm...@gmail.com>.

Changes to the 'company' field do update the first column, but not the
second.

Thoughts?

David



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDispatcher-tp9124p9125.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: AW: DG (class is not an IEventDispatcher)

Posted by Alex Harui <ah...@adobe.com>.

On 12/12/14, 11:19 AM, "DavidM" <dm...@gmail.com> wrote:
>
>Separately: I'm getting this warning every single time that
>ExternalInterface receives an object:
>
>WARNING: For content targeting Flash Player version 14 or higher,
>ExternalInterface escapes strings using JSON conventions. To maintain
>compatibility, content published to earlier Flash Player versions
>continues
>to use the legacy escaping behavior.
>
>I'm worried about this because some users will be using Flash 11.1 and
>some
>will be using more recent versions.
>
>What's the best way to ensure that the data I send complies 100% with both
>string escape algorithms??

I could be wrong, but the warning basically says that the -swf-version
option to MXMLC will control this behavior, not which version of the Flash
Player your users are running.  So, setting -swf-version=24 (or less, 24
is the SWF version for Flash Player 13) should cause ExternalInterface to
escape the JSON data the same way regardless of whether a customer is
running FP 11.1 or FP15.

Also, unless you are parsing the data yourself, it may not matter.
Hopefully what a player's ExternalInterface does is compatible with the
JSON class in that player.

-Alex


Re: AW: DG (class is not an IEventDispatcher)

Posted by DavidM <dm...@gmail.com>.
Nice suggestion Alex, the compiler was ok, but the runtime chocked:

TypeError: Error #1034: Type Coercion failed: cannot convert
Object@183e1f101 to model.common.Person.

Then I realized that the object I'm putting in the array is *not actually
typed* !!

It's coming in from Firebase in JSON format, via ExternalInterface, and
added to an array collection without casting.

I'm actually surprised that it worked before (i.e: in labels, regular DG
fields, etc, etc) !!

So, if I actually cast the object to the correct class first (by having a
field in the JSON message with the class name, and using that to cast to the
correct Object type), then this problem goes away entirely, even this will
work: 



So, the issue is fixed by explicit casting on insertion into the
ArrayCollection, but the lessons re "set data()" are valuable.  

Separately: I'm getting this warning every single time that
ExternalInterface receives an object:

WARNING: For content targeting Flash Player version 14 or higher,
ExternalInterface escapes strings using JSON conventions. To maintain
compatibility, content published to earlier Flash Player versions continues
to use the legacy escaping behavior.

I'm worried about this because some users will be using Flash 11.1 and some
will be using more recent versions. 

What's the best way to ensure that the data I send complies 100% with both
string escape algorithms??

Dave








--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDispatcher-tp9124p9149.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: AW: DG (class is not an IEventDispatcher)

Posted by Alex Harui <ah...@adobe.com>.
You may have to import MyModel in an fx:Script if it is in a separate
fx:Component.  Fx;Component is sort of like a sub-document.

On 12/12/14, 10:16 AM, "DavidM" <dm...@gmail.com> wrote:

>Alex, thanks for that awesome explanation, I really appreciate it.
>
>I tried casting to my model as you suggest {MyModel(data).field} but for
>some reason FlashBuilder won't resolve the MyModel class, even though it
>uses the same class elsewhere in the mxml file just fine.
>
>For now I'm going with set data.
>
>Dave
>
>
>
>
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDi
>spatcher-tp9124p9146.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: AW: DG (class is not an IEventDispatcher)

Posted by DavidM <dm...@gmail.com>.
Alex, thanks for that awesome explanation, I really appreciate it.   

I tried casting to my model as you suggest {MyModel(data).field} but for
some reason FlashBuilder won't resolve the MyModel class, even though it
uses the same class elsewhere in the mxml file just fine.  

For now I'm going with set data.

Dave







--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/DG-class-is-not-an-IEventDispatcher-tp9124p9146.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.