-
Notifications
You must be signed in to change notification settings - Fork 117
Creating A High Level Emulation Component
aharui edited this page Jan 9, 2020
·
1 revision
Some emulation components are better implemented by copying the Flex code and modifying it. One of the deciding factors is whether there are low-level Flash APIs used. If not, the component is a candidate for straight migration.
The process is "simple":
- Copy the Flex code file.
- Rename flash.. imports to the Royale equivalents:
- flash.events.* generally can become org.apache.royale.events.*
- flash.display.Graphics might be replaced with mx.display.Graphics
- flash.display.* needs to be replaced by Basic or MXRoyale controls. Sprite probably gets replaced by UIComponent, for example.
- flash.text.TextFIeld might be replaced by mx.controls.Label
- If the code relies on Flex lifecycle APIs, consider calling commitProperties in an override of addedToParent(). createChildren() should get called. measure() may not get called but hopefully there aren't critical things in measure(). If updateDisplayList is used, override setActualSize() to call updateDisplayList.
- Try to compile it.
- Ask on the dev@royale mailing list about any remaining errors.
Apache®, Apache Royale, Royale™, and the Royale logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.