On 11/20/16, 9:57 AM, "Harbs" <[email protected]> wrote:

>Makes sense.
>
>So the right solution is probably to make the type passed into the
>constructor Object for both platforms.

Maybe.  You might be able to declare a new type that extends ByteArray in
SWF and ArrayBuffer in JS.   I think you also just declare a new type that
extends Object but has a payload property with a platform-specific type.

-Alex

>
>On Nov 20, 2016, at 5:03 PM, Alex Harui <[email protected]> wrote:
>
>> BinaryData is in Core.  There is a Core.swc and CoreJS.swc with the
>> respective API signatures.
>> 
>> In FlexJS, when an API has different signatures per-platform, the entire
>> subsystem is suppose to "not care" in that nobody ever checks the type
>> they get back (like the parent property of a display object) or what you
>> pass in is correct for the platform (that an Event inherits flash Event
>> for SWF and browser Event for JS).  It is just supposed to work out.
>> 
>> So you may need to compile against the CoreJS.swc instead of Core.swc.
>> 
>> -Alex
>> 
>> On 11/20/16, 3:19 AM, "Harbs" <[email protected]> wrote:
>> 
>>> I’m working on a js-only app. I’m trying to create a BinaryData object
>>> from an ArrayBuffer. The class has conditional compiling and takes
>>>either
>>> a ByteArray in SWF or an ArrayBuffer in JS.
>>> 
>>> When I try to pass an ArrayBuffer to the constructor in my js app, I
>>>get
>>> the following error:
>>> Implicit coercion of a value of type ArrayBuffer to an unrelated type
>>> ByteArray.
>>> 
>>> This is the only “javascript” problem I’m getting in my app. All other
>>> JS-only APIs are not causing errors. Any clues why this is not working?
>>> 
>>> I can change BinaryData to accept a type of “Object”, but I’d like to
>>> understand why it’s not working as it currently stands.
>>> 
>>> Harbs
>> 
>

Reply via email to