Flash4UI.h File Reference

#include "FlashDelegate.h"

Functions

Flash4UIExport void * CreateFlashControl (const std::wstring &url, int x, int y, int width, int height, bool taskButton=false)
Flash4UIExport void DestroyFlashControl (void *pFlashControl)
Flash4UIExport void MoveFlashControl (void *pFlashControl, int x, int y, int width, int height)
Flash4UIExport HWND GetWindowHandle (void *pFlashControl)
Flash4UIExport void Show (void *pFlashControl)
Flash4UIExport void Hide (void *pFlashControl)
Flash4UIExport void Load (void *pFlashControl, const std::wstring &movieFilename)
Flash4UIExport void SetTopMost (void *pFlashControl, bool topmost)
Flash4UIExport void SetDraggable (void *pFlashControl, bool enable, bool useRightButton=false)
Flash4UIExport void SetTrackable (void *pFlashControl, bool enable)
Flash4UIExport void SetOpacity (void *pFlashControl, float opacity)
Flash4UIExport void Bind (void *pFlashControl, const std::wstring &funcName, const FlashDelegate &callback)
Flash4UIExport void Unbind (void *pFlashControl, const std::wstring &funcName)
Flash4UIExport FlashValue CallFunction (void *pFlashControl, std::wstring funcName, const Arguments &args=Args())

Detailed Description

This file is part of Flash4UI, a library that allows developers to use Flash as user interface in their applications. Copyright (C) 2009 YKDOUBLES@GMAIL.COM

Function Documentation

Flash4UIExport void Bind ( void *  pFlashControl,
const std::wstring &  funcName,
const FlashDelegate &  callback 
)

Binds a local callback to a certain function name so that your Flash movie can call the function from ActionScript using ExternalInterface.call('functionName').

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.
funcName The name to bind this callback to. The name "WindowMessageHooker" is reserved for hook message of the flash control.
callback The local function to call, see below for examples of declaring a FlashDelegate.
    // Example declaration of a compatible function (static function):
    FlashValue myStaticFunction(void* caller, const Arguments& args)
    {
        // Handle the callback here
        return FLASH_VOID;
    }

    // Example declaration of a compatible function (member function):
    FlashValue MyClass::myMemberFunction(void* caller, const Arguments& args)
    {
        // Handle the callback here
        return "Some return value!";
    }

   // Set the function callback (class member function)
   Bind(pFlashControl, "functionName", FlashDelegate(this, &MyClass::myMemberFunction);
   Bind(pFlashControl, "functionName", FlashDelegate(pointerToClassInstance, &MyClass::myMemberFunction);

   // Set the function callback (static function)
    Bind(pFlashControl, "functionName", FlashDelegate(&myStaticFunction);

   // Example for using WindowMessageHooker
   FlashValue MyClass::MyMessageProc(void* caller, const Arguments& args)
    {
       UINT Msg = (UINT)args.at(0).getNumber();
       WPARAM wParam = (WPARAM)args.at(1).getNumber();
       LPARAM lParam = (LPARAM)args.at(2).getNumber();

       // Do something to enjoy the message
       //....

        // we have handled the message, stop transferring to the flash control. 
        return true;

       // return false to let the flash control handle this message
    }

   // Set the message hooker
   Bind(pFlashControl, "WindowMessageHooker", FlashDelegate(this, &MyClass::MyMessageProc));

Flash4UIExport FlashValue CallFunction ( void *  pFlashControl,
std::wstring  funcName,
const Arguments args = Args() 
)

Attempts to call a function declared as a callback in the ActionScript of the currently-loaded movie.

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.
funcName The name of the callback that was declared using 'ExternalInterface.addCallback(funcName, function)' in the ActionScript of the currently-loaded movie.
args The arguments to pass to the ActionScript function.
Returns:
If the flash movie does not exist or the funcName and args are wrong, it returns FLASH_ERROR. If the invocation was successful and the ActionScript function returned a value, it returns a FlashValue with a non-null type.
Note:
It is highly recommended to use the 'Args(arg1)(arg2)(arg3)...' helper class to pass arguments.

Flash4UIExport void* CreateFlashControl ( const std::wstring &  url,
int  x,
int  y,
int  width,
int  height,
bool  taskButton = false 
)

create a new flash control including the window it created. Confirm to call CoInitialize(NULL) first before you create any Flash control.

Parameters:
url The url of the swf file, whether local file or a network file.
x The left coordinate of the new flash window. If created as a child, the x is relative to it's parent. otherwise it is relative to the screen.
y The top coordinate of the new flash window. If created as a child, the y is relative to it's parent. otherwise it is relative to the screen.
width The width of the new flash window.
height The height of the new flash window.
taskButton Indicates whether the flash window created as PopupWindow or ToolWindow. The difference is that there's no button on the task bar when created as ToolWindow.
Returns:
If the new flash control is created successfully, return the pointer of the new flash control, otherwise it returns NULL.

Flash4UIExport void DestroyFlashControl ( void *  pFlashControl  ) 

Destroys flash control including the window it created.

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.

Flash4UIExport HWND GetWindowHandle ( void *  pFlashControl  ) 

Gets the window handler of the flash control.

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.
Note:
It's not recommended to use Windows API to change the window properties.

Flash4UIExport void Hide ( void *  pFlashControl  ) 

Hides the flash window.

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.

Flash4UIExport void Load ( void *  pFlashControl,
const std::wstring &  movieFilename 
)

Loads a movie (a .swf file) into this Flash Control and begins playing.

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.
movieFilename The filename of the movie to load.
Note:
If the the movie file(*.swf) does not exist, nothing will be shown in the flash control.

Flash4UIExport void MoveFlashControl ( void *  pFlashControl,
int  x,
int  y,
int  width,
int  height 
)

Moves the flash control to a specified position of the screen or change the size of the window.

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.
x The left coordinate.
y The top coordinate.
width The new width of the flash control.
height The new height of the flash control.

Flash4UIExport void SetDraggable ( void *  pFlashControl,
bool  enable,
bool  useRightButton = false 
)

Sets whether this Flash Control is draggable via the right-mouse-button, this is only applicable to FlashControls created as an overlay.

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.
enable Whether or not this Flash Control should be draggable.
useRightButton Whether or not use the right button of mouse to drag the window.

Flash4UIExport void SetOpacity ( void *  pFlashControl,
float  opacity 
)

Sets the opacity of this Flash Control.

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.
opacity The opacity as a Real value; 0 is totally transparent, 1 is totally opaque.

Flash4UIExport void SetTopMost ( void *  pFlashControl,
bool  topmost 
)

Sets the flash window topmost.

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.
topmost Whether topmost.

Flash4UIExport void SetTrackable ( void *  pFlashControl,
bool  enable 
)

Sets whether this Flash Control is hidden after one command, also hidden when the flash control is deactivated. This is typically used for menu.

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.
enable Whether or not this Flash Control should be trackable.

Flash4UIExport void Show ( void *  pFlashControl  ) 

Shows the flash window.

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.

Flash4UIExport void Unbind ( void *  pFlashControl,
const std::wstring &  funcName 
)

Un-binds the specified callback.

Parameters:
pFlashControl The pointer of the flash control created with createFlashControl.
funcName The name that the callback was bound to.


Generated on Thu Sep 10 19:00:54 2009 for Flash4UI by  doxygen 1.5.2