OnFSCommand

Description

This event is triggered when the Flash ActiveX event OnFSCommand is raised.

This occurs in the following cases:

  • When a GetURL action in the movie specifies a URL beginning with FSCommand:
  • When the fscommand function is explicitly called from ActionScript:
fscommand("show_msg", "Hello!");
fscommand("quit");

The text after the colon (:) is passed as the command parameter, and the optional argument is provided in the SFPCFSCommandInfoStruct::args parameter.

This event can be used to handle button clicks, frame actions, or other triggers from inside the Flash movie.

Example

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
...
    case WM_NOTIFY:
    {
        NMHDR* pNMHDR = (NMHDR*)lParam;
 
        if (hwndFlashPlayerControl == pNMHDR->hwndFrom)
        {
            switch (pNMHDR->code)
            {
                case FPCN_FSCOMMAND:
                {
                    SFPCFSCommandInfoStruct* pInfo = (SFPCFSCommandInfoStruct*)lParam;
 
                    MessageBox(hWnd, pInfo->command, _T("FSCommand(): command"), MB_OK | MB_ICONINFORMATION);
                    MessageBox(hWnd, pInfo->args, _T("FSCommand(): args"), MB_OK | MB_ICONINFORMATION);
 
                    break;
                }
            }
        }
    }
}