Passing events to other objects in the Flash RAD framework

Basis

The Flash RAD event handler is created to cast:

  1. Multiple variables form your form and your object
  2. To multiple targets in your project
  3. Using multiple instructions
  4. Using one or more of your custom created classes to execute additional ans self defined actions

Events

Basic events within the Flash RAD framework are:

  • onClick
  • onRelease
  • onChange
  • onFocus
  • onLostFocus
  • onLoadStart
  • onLoadProgress
  • onLoadDone

For forms, the events are:

  • onLoadStart
  • onLoadProgress
  • onLoadDone
  • onSubmit
  • onSubmitted

Each event is either defined in the XHTML as another parameter to an object, or in the Controller-XML connected to a form or panel. Every event has both a target and a set of actions to perform.

Instructions

Base set

  1. reload: re-loads the src connected to the target-object using the parameters as passed in the event-definition (onClick, onChange, etc)
  2. setvalue: sets the value of the target object to the first value passed in the parameters
  3. filter: filters the currently loaded data in the target object using the following parameters

Input fields

  1. setvalue: sets the value of the target input field.

ComboBox, DataGrid and any data-object

  1. reload: re-loads the src connected to the target-object using the parameters as passed in the event-definition (onClick, onChange, etc)
  2. setvalue: sets the value of the target object to the first value passed in the parameters
  3. filter: filters the currently loaded data in the target object using the following parameters

Images / Flash movies

  1. reload: re-loads the content of the IMG tag, replacing either specific parameters the construction “reload <targets>:src=<my image location>” to replace the

Event definition
Any event is constructed of five parts:

  1. The event name (onClick, onChange, etcetera.)
  2. The instruction <instruction>
  3. The target object(s) <target>
  4. The target variable name <target variable>
  5. The variable to be passed <target variable>

Below is a step by step explanation of each part.

Example
onClick=”<instruction> <targets>:<target variable>=[<local value>]

onClick=”reload peoplelist:companyid=[this.companyid]

Multiple instructions
You separate instructions using the semi-colon: “;“.

onClick=”<instruction1> <targets>:<target variable>=<local value>;<instruction2> <targets>:<target variable>=[<local value>]

Setvalue: setting directly on the “value” parameter and on possible additional variables
By default “setvalue” assumes that your default variable will be the “value” variable on the target object. As your self-defined objects may have additional variables you can specify these one by one, like the example below:

onClick=”setvalue <target(s)>:[<local value>],<target variable2>=[<local value>];<instruction> <targets>:<target variable>=[<local value>]

Multiple variables
You separate variables by using the comma: “,

onClick=”<instruction> <targets>:<target variable1>=[<local value>],<target variable2>=[<local value>];<instruction> <targets>:<target variable>=[<local value>]

Multiple targets
Targets are any other panels or forms anywhere within your project. You separate your targets using the comma: “,“.

onClick=”<instruction> <target1>,<target2>,<target3>:<target variable1>=[<local value>],<target variable2>=[<local value>]

Any target with the same name
When using the “*” wildcard you can cast the event to any object with the same name, anywhere in your project.

onClick=”reload *.selectlist1:companyid=[form.companyid]

Will attempt a reload on any object in any form currently loaded in your project with the name “selectlist1″.

onChange=”filter *.selectlist1:companyid=[form.companyid]

Will filter the result set in any object named “selectlist1” in you project with the value typed into the owner of the onChange event handler.

Variables
On any event, the following variables are passed:

  1. From the data object of the component itself (using “[this.<variable name>]“)
  2. From all the form fields in the form that component is part of (using “[form.<variable name>]“)

Passing variables from the form and the object itself
All named fields in your form and all variables in the object that is the owner of the event are directly available to the event handler. You pass these variables by using the field/variable reference (=the name you gave it in your XHTML) between these two characters: “[ ]”:

onChange=”<instruction> <target1>,<target2>,<target3>:<target variable1>=[this.personid],<target variable2>=[form.companyid]

Be the first to start a conversation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: