Forms.callFunction() This page was last modified over 30 day(s) ago and has 0 comment(s)


Back to Forms Class Summary

Availability
Windows, Mac OSX, Linux

Usage
mdm.Forms.formName.callFunction(functionName:String, parametersString:String, delimiter:String):void

Parameters
functionName:String - Function to be executed
parametersString:String - Parameters delimited with character passed in "delimiter" argument
delimiter:String - Delimiter used for the parameters

Returns
Nothing

Description
Executes the specified function in the specified Form.

Notes
That is required that methods are to be called are registered in application. This is done using ExternalInterface programming api. Please see below sample code.

NOTE:
in AS1/AS2 authoring tool that is required to force ExternalInterface inclusion into output by either:
#1
using fully qualified class name:

flash.external.ExternalInterface.addCallback("myFunction", this, myFunction);

#2
using explicit import:

import flash.external.ExternalInterface;
// then
ExternalInterface.addCallback("myFunction", this, myFunction);

To pass complex objects between forms you could serialize them into JSON-like strings and then deserialize back to object.
More information on how to use this command can be found in the 'Manipulating Forms' page in the 'Using Forms' chapter in the 'Using Zinc 4.0' chapter in the 'General Help File'.

Example Code
import flash.external.ExternalInterface;
//
// in initialization routine in your form:
//
if(ExternalInterface.available)
{
ExternalInterface.addCallback( "myFunction", myFunction );
// methods of objects
ExternalInterface.addCallback( "testMethod", someObject.testMethod);
};

// later in code
var form:Object = mdm.Forms.getFormByName("MyForm");
if(form)
{
form.callFunction("myFunction", "param1@param2", "@");
}

mdm.Forms Class Example Downloads
No Example Downloads Available


Registered Users must be logged in to 'MyAccount' to add a Comment - Log In Here
  After Logging In, Click Here to Refresh This Page