I haven't really followed this thread in detail so apologies if I'm missing the point.
Hopefully, FlexJS/Royale has never promised 100% backward compatibility with Flex. That's because there are some fundamental differences in the runtimes/platforms. In Flash, if you change properties of a DisplayObject, the effects show up after all other code runs. In the browser, if you change properties on an HTMLElement, it shows up right away in many cases. So lifecycle events and invalidation are not being promised to work exactly as they did in Flex. It would add a lot of overhead to try to emulate the deferred rendering of Flash in the browser. "initComplete" in Royale isn't quite the exact same as "creationComplete" in Flex. Both give you a place to run some code as the component is initialized, but there may be subtle differences if you depended on deferred validation in Flex. That said, based on the code snippets provided, I'm not sure why "initComplete" fired before addElement, which is what I think you are trying to point out. I would expect it to be called in addElement, so further investigation is needed there. Put a breakpoint in your "initComplete" handler and see what the call stack is. addedToParent() should be on the call stack. HTH, -Alex On 4/1/19, 4:33 AM, "Kessler CTR Mark J" <[email protected]> wrote: I had a little time over this weekend to try to catch up on some things. This is a follow up to that issue I was having about the reference comparison. It was a timing issue on our part that we resolved by moving up how quickly we store a reference. Here's an example of what I mean. The "initComplete" event handler that is inside the "MyClass" was being called before the "addReferenceToList". The instance was getting to its "initComplete" called faster and was attempting to call a method that uses its stored reference from a list before the "myMethod" method could store the reference. We are not talking about a lot of prep either. Interesting problem to have; no invalidation or heavy lifting before its fully completed. public function myMethod():void { var newInstance:MyClass = new MyClass(); ...do some prep for the new instance... addReferenceToList(newInstance); addElement(newInstance); } Changed to: public function myMethod():void { var newInstance:MyClass = new MyClass(); //swapped addReferenceToList(newInstance); ...do some prep for the new instance... addElement(newInstance); } -Mark K
