Skip to content

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":

  1. Copy the Flex code file.
  2. 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
  1. 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.
  2. Try to compile it.
  3. Ask on the dev@royale mailing list about any remaining errors.
Clone this wiki locally