flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pan Li <Pa...@Prominic.NET>
Subject Re: [FlexJS] Issue with JSON.stringify and Bindable VO objects
Date Wed, 19 Apr 2017 01:07:41 GMT


I am afraid the javascript can only act as a tool to implementation the
JSON class, it can't replace Flex JSON in whole, Since they are different.
If you use different thing as replacement it isn't hard to find cases
didn't cover
and the FlexJS's JSON in js has more issues than Bindable, I talked on it
only because it is the issue blocking me, also swf mode is broken as well.
Longer story:

the sdk document lists other difference: because the page is comparing Flex
SDK's JSON with broswer's javascript's JSON, there may be difference to our

A I had noticed JSON didn't work long before, but those days we didn't work
on SDK code, so I didn't dig deeper.
These were important issues which break my code:
A.1 JSON isn't supposed to output private properties, but current
implementation (using JS's as replacement) does
A.2 default date format of Flex SDK's JSON is different to FlexJS SDK's
A.3 when property of integer is not set, actionscript output it as 0 but
Javascript ignores it.
I think these is because JS's JSON doesn't have knowledge of ActionScript's
class system.

B These are issue which didn't affect my code but since you use this
approach as SDK implementation it is very critical:
B.1 If Actionscript class has other class as it property, it is supposed to
process it correctly, but in FlexJS's JSON (using JS's), it goes no where.
if the property's value in created inside the main domain, then FlexJS JS
mode doesn't process it but FlexJS swf mode does, otherwise FlexJS js mode
processes it but swf mode doesn't

C in today's testing mores unexpected behaviour is noticed:
C.1 the javascript JSON ignores any assignment on variables' declaration
(like  public var donothideme:uint = 88)

D There are some further issues if you use javascript code as the FlexJS
SDK implementation
D.1 it can't handle actionscripts's property name with get/set correctly,
an extra underscore is added.
D.2 the code will ignore an user declared property named _target, it is not
rare to have a property named "_target" in VO objects

these are domain classes which can reproduce some of issues listed above,
you need to run in in Flex, FlexJS swf mode and FlexJS js mode to compare:


	public class Book
		public function Book()

		public var title: String;
		public var page : uint;
		public var date : Date;
	    public var authors : Array;
	    public var topic : Topic = new Topic();

	    public var donothide: uint = 99;
	    private var internalDate: Date = new Date();



	public class Topic
		public function Topic()

		public var name: String = "Politics";


Code to create testing instance:

			var book : Book = new Book();
			book.title = "Trump";
			book.date = new Date();
			book.authors = new Array();

My Apache Flex community contribution is working on the open source
Moonshine-IDE.com for FlexJS.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message