FSCommandAction: String;
FSCommandAction: string;
The FSCommandAction property determines a handler of FSCommand events for a Flash movie.
To use the event handler, the SWF movie used by a Flash object should be generated specifically taking into account its work via FsCommand. Only predefined commands and parameters can be used. For example, FlashMapEngine.swf has predefined events onClick and onMouseOver.
Macros implemented in classes cannot be used as handlers. Depending on the file where the macro is implemented the path to the macro in this property is specified in the different ways:
The macro is implemented in a unit or form of the repository: <Unit or form ID>.<Macro ID>.
The macro is implemented in an object of the repository assembly: <Assembly ID>.<Macro ID>.
In the repository units and forms, user macros must be implemented in the Global Scope of names.
To execute the following example, create a unit with the Module identifier (the Message procedure, then add links to the Ui, Tab, and Report assemblies):
Public Sub Message(Flash: IPrxFlash; Args: IPrxFlashFSCommandEventArgs);
Begin
WinApplication.InformationBox((Flash As ITabObject).Id + " : " + Args.Name + " = " + Args.Arguments);
End Sub Message;
Then create a regular report with the Report identifier and add the created unit to report units. Place the Flash object, which uses FlashMapEngine.swf movie, on a report sheet. Define initialization string for the Flash object, this initialization string should have enabled option of passing events via onFsCommand (fscomand='1') and the onClick attribute is set to onClick='alert'. Add links to the Metabase, Report, Tab system assemblies in the unit.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
Tab: ITabSheet;
Flash: IPrxFlash;
Begin
MB := MetabaseClass.Active;
Report := MB.ItemById("Report").Edit As IPrxReport;
Tab := (Report.Sheets.Item(0) As IPrxTable).TabSheet;
Flash := Tab.Objects.Item(0).Extension As IPrxFlash;
Flash.FSCommandAction := "Module.Message";
(Report As IMetabaseObject).Save;
End Sub UserProc;
After executing the example an event handler is assigned to the Flash object. Clicking a map region displays an information message containing region identifier.
Create a unit with the Module identifier (the Message procedure) described in the example above. Fore.NET event handlers are not supported, as user macros in .NET units and .NET forms are described within a class.
Then create a regular report with the Report identifier and add the created assembly to report units. Place the Flash object, which uses FlashMapEngine.swf movie, on a report page. Define initialization string for the Flash object, this initialization string should have enabled option of passing events via onFsCommand (fscomand='1') and the onClick attribute is set to onClick='alert'. The specified example is an entry point for a .NET assembly. Add links to the Metabase, Report, Tab system assemblies in the units.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Report: IPrxReport;
Tab: ITabSheet;
Flash: IPrxFlash;
Begin
MB := Params.Metabase;
Report := MB.ItemById["Report"].Edit() As IPrxReport;
Tab := (Report.Sheets.Item[0] As IPrxTable).TabSheet;
Flash := Tab.Objects.Item[0].Extension As IPrxFlash;
Flash.FSCommandAction := "Module.Message";
(Report As IMetabaseObject).Save();
End Sub;
After executing the example an event handler is assigned to the Flash object. Clicking a map region displays an information message containing region identifier.
See also: