Medialooks Knowledge Base Support Center

Contact Us

Flash items

You can use flash files (SWF) as graphics overlay. To be able to work with flash content with Character Generator you should obtain Character Generator Flash Plugin license and install Adobe Flash Plugin and ActiveX Control for Internet Explorer (x86). Here you can download sample SWF files for tests.

To add the flash object you need to use a path to SWF file with the AddNewItem method:

string graphicsItemId = "myFlash";
string pathToFlashFile = @"c:\myFlashFile.swf";
double relativeX = 0.05;
double relativeY = 0.05;
int isRelative = 1;
int isShow = 1; myCharGen.AddNewItem(pathToFlashFile, relativeX, relativeY, isRelative, isShow, ref graphicsItemId);

Default XML description of the flash item looks like:

<cg-item id='flash-000'>
    <img path=c:\myFlashFile.swf'/>
    <cg-props pos-x='36' pos-y='29' show='yes' move-type='accel-both' alpha='255' bg-color='Black(0)' pixel-ar='0.000' play-mode='loop' interlace='auto' scale='fit-ar' align='top-left' width='550' height='400' pause='no' edges-smooth='0'>
        <indent left='0' right='0' top='0' bottom='0' use-for-bg='no'/>
        <group-indent left='0' right='0' top='0' bottom='0'/>

Interaction with flash

Flash item is contained in <img> node and, in general, there is no difference between images and flash items. But you can interact with Flash items - call internal flash functions or change variables.

To get a list of available flash variables you should use:

string flashItemId = "myFlash";
int flashVariablesCount; myCharGen.FlashGetVariablesCount(flashItemId, out flashVariablesCount);
string[] flashVariablesArray;
if (flashVariablesCount > 0) 
    flashVariablesArray = new string[flashVariablesCount]; 
    for (int flashVarIndex = 0; flashVarIndex < flashVariablesCount; flashVarIndex ++) 
        string flashVarName; 
        myCharGen.FlashGetVariableName(flashItemId, flashVarIndex, out flashVarName); 
        flashVariablesArray[flashVarIndex] = flashVarName; 

To get a value of required variable you should call:

string flashVarValue; 
myCharGen.FlashGetVariable(flashItemId, flashVariablesArray[targetVariableIndex], out flashVarValue);

To change the value of required variable:

string flashVarName = "param1";
string flashNewValue = "test"; 
myCharGen.FlashSetVariable(flashItemId, flashVarName, flashNewValue);

To work with flash functions you should use FlashCallFunction method. Please refer to your source FLA file to get information about available functions and their parameters. You should configure your function into XML style to use in this method. For example, if required function looks like UpdateTitleVal(string newTitle) then you should prepare request like:

<invoke name='UpdateTitleVal'>
        <string>UpdateTitle Call!</string>

And use this string in FlashCallFunction method:

string flashItemId = "myFlash";
string functionRequest = @"<invoke name='UpdateTitleVal'> 
                                <string>UpdateTitle Call!</string> 
string flashResponse; 
m_objCharGen.FlashCallFunction(flashItemId, functionRequest, out flashResponse);