CLIK AS3 vs. CLIK AS2

This section outlines major differences, mostly programming related, between CLIK AS2 and CLIK AS3.

  1. CLIK AS3 is designed to work in Flash Player.
  2. Rather than using a custom EventDispatcher, CLIK AS3 uses ActionScript 3’s native event system.
  3. The invalidation system has been redesigned to help avoid unnecessary updates in draw(). Each component now stores an “invalid” table that tracks which aspects of the component are currently invalid. Default invalidation types are defined in scaleform.clik.constants.InvalidationType. Aspects can be marked as invalid using invalidate(), invalidateInvalidationType, or manually setting the property to true within the table.. Logic within draw() should be wrapped within an appropriate isInvalid() check to ensure that unnecessary updates to components are avoided.
  4. invalidate() no longer uses a 1ms delay; instead, it uses the next stage invalidatation (Event.RENDER) or the next Event.ENTER_FRAME for the component and then calls validateNow().
  5. Tween’s syntax is no longer MovieClip.tweenTo; instead, var t:Tween = new Tween();
  6. handleInput() is now tied to the native event system. This means that handleInput() now accepts one parameter of type InputEvent and the event will bubble up from the component that dispatched it rather than being passed down from FocusHandler.
  7. handleInput() no longer returns a Boolean; instead, it should set event.handled = true; if the event was handled.
  8. UIComponent has a new property, focusable, which can be used with the CLIK FocusManager to prevent focus from reaching a component. This is more or less a replacement for AS2’s MovieClip.focusEnabled property.
  9. enableInitCallback is no longer an inspectable of UIComponent. Instead, it should be set within a class’s constructor or preInitialize() method.
  10. DataProvider now requires that you provide the target array to DataProvider’s constructor (myComponent.dataProvider = new DataProvider(myArray);), rather than simply setting myComponent.dataProvider = myArray;
  11. ButtonBar will now only create Buttons that fit within its own size. If your ButtonBar’s size is 200px wide and each Button is 150px wide, only one Button will be displayed. This allows users to resize their ButtonBar and have the Buttons within be added and removed dynamically.
  12. UILoader has been removed. This functionality is now handled by the Flash MovieClip/Sprite and Loader classes.
  13. UIComponent.SoundMap, introduced in CLIK 3.3, has been removed for CLIK AS3.