Development

Flash content

This module allows you to manage content that is dynamically loaded into a Flash movie.

Loading a Flash article

To enable communication between TYPOlight and your Flash movie, you have to assign a unique ID to each article of the Flash content module and add the following code to the root frame of your Flash movie:

TextField.prototype._loadArticle = function(flashID)
{
    tf = this;

    // Enable HTML mode and remove content
    tf.html = true;
    tf.htmlText = "";

    // Instantiate a new LoadVars object and assign the article ID
    lv = new LoadVars();
    lv["flashID"] = flashID;
    lv.sendAndLoad(URL + "flash.php", lv, "POST");

    lv.onLoad = function(success)
    {
        if (success)
        {
            tf.htmlText = lv["content"];
        }
    }
}

Here is how to call the function in order to load an article into a TextBox:

myTextBox._loadArticle("article_ID");

In this example, the Flash article "article_ID" would be displayed in the TextBox called "myTextBox".

Importing a style sheet

You can also import a style sheet into your Flash movie to use it with a particular text box. Simply add the following function to the root frame of your Flash movie:

TextField.prototype._addCSS = function(style_sheet)
{
    tf= this;
    tf.styleSheet = null;

    // Instantiate a new StyleSheet object
    st = new TextField.StyleSheet();
    st.load(URL + style_sheet);

    st.onLoad = function(success)
    {
        if (success)
        {
            tf.styleSheet = st;
        }
    }
}

Here is how to call the function in order to assign the style sheet to a TextBox:

myTextBox._addCSS("basic.css");

Note that Flash only supports a few particular HTML tags and therefore some of your rich text editor formattings might not be displayed.