flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DavidM <dmos...@gmail.com>
Subject Re: AW: DG (class is not an IEventDispatcher)
Date Fri, 12 Dec 2014 19:19:11 GMT
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.

Mime
View raw message