« HELP CENTER

Component Document Class

Every Ad Studio 3 component SWF must have a document class associated with it. This document class must implement several interface methods in the flite namespace. See below for more on the flite namespace. Please refer to our component example code for a simple example of how to set up your document class, or create a new component in Component Studio using our example SWF file.

  • constructor method: The component constructor is invoked as soon as the component is loaded by the Flite Runtime. It is run before any interface methods are called. Use this function to set up the component’s environment. 
  • initialize: This interface method is invoked after the component is loaded. It initiatlizes the component with a resource object containing an API hook, configuration parameters, and other useful information for running your component. 
  • resize: This interface method is invoked whenever the component is resized dynamically. This method is optional. When it is implemented, the component will resize dynamically as its container size is being changed. When it is omitted, the component will be unloaded and reloaded at the new size when the container resize is complete.
  • stateChange: This interface method is invoked whenever the state of a component or one of its children changes. Any code that needs to execute on state change should reside here. 

flite namespace

Your document class definition must contain the following line in order to define the flite namespace:

     public namespace flite = "https://flite.site/ad/v3/component/namespace";

The component’s interface methods (initialize, resize and stateChange) must be implemented under this namespace in order to be recognized.

Base Component example

Please download our Base Component example code. This very simple component code example creates a v3 component that draws a rectangle of the specified color and transparency. The component code is thoroughly commented and demonstrates best practices in creating and naming components. It is a good starting point for creating a component of your own.