Rich Media & Video | |||
| Components > Local Connection | |||
The local connection component simplifies communication between multiple creative, allowing the syncronization of animations and even the ability to pass data from one creative to another. User defined functions can be called in other banners simply by passing the required receiving channel and index of the function through the component.
Explore the local connection settings
| Settings |
Descriptions |
|---|---|
| Receiving function prefix | This string forms the function name by combining the prefix and an index number.
e.g. |
| Individual channel identifier | The index number of the channel to listen on. |
| Number of synchronized creative | The total number of creative you wish to synchronize. (Only available on channel 1) |
All the local connection components respond to the same instance name of 'MRM_LC'
| Signature |
Descriptions |
|---|---|
| LC_trigger_start():Void | The component receiving on channel one acts as the master, and once all the SWF files required in the creative execution have been registered with it, the component confirms the connection by calling the LC_trigger_start() function from the same scope. If you want to only synchronize the creative on user interaction then use the LC_trigger_start() function to set a boolean and only execute the user initiaton if the boolean is true. |
| fire(functionIndex:Number, channelIndex:Number, parameters:Object):Void | Fires the function with the 'functionIndex' on the channel with the 'channelIndex' and passes the parameters object e.g. |
The following example creates an object with two parameters and passes the parameters object to the second function on the third channel.
var obj:Object = new Object();
obj.value1 = 10;
obj.value2 = "my second value is....";
MRM_LC.fire(2,3,obj);
The master local connection component broadcasts this event to a _root level function called MRM_component_events.
| Event Type |
Description |
|---|---|
onSynchronizationCompleted |
Fires when all the creative are synchronized |
To setup the timeline function you can use the action hints panel and select MRM_component_events

function MRM_component_events(evtObj:Object)
{
if(evtObj.type == "onSynchronizationCompleted")
{
trace("onSynchronizationCompleted");
}
}
''Best practice is to place the local connection component in a child movie as this will allow the polite download to complete before attempting to make the connection'
The function name fired in the FLA on the receiving channel is defined through its components inspector and is set as LC_trigger by default. You can create as many functions as required by following the naming convention. e.g. your function prefix plus underscore and the index number of the function.
function LC_trigger_1(obj:Object):Void{ // Add your code here....
}
function LC_trigger_2(obj:Object):Void{
// Add your code here....
}
How to set up two synchronized creative1: Place the local connection component in both FLA's just off the visible stage.
(show details)
2: Set up local connection component properties for each file.
(show details)
|
Local Connection v 2.0.5
|
Local Connection v 2.0.5
|
Type the following code in the file with the 'Individual channel identifier' set to 1: (master)
function LC_trigger_start():Void{
MRM_LC.fire(1,2,7); //fire receiving function 1 (function myFunction_1()) on channel 2, and pass number 7
}
Type the following code in the file with the 'Individual channel identifier' set to 2: (slave)
function myFunction_1(par):Void{
trace("myFunction_1 called with parameter "+par);// Output: myFunction_1 called with parameter 7
}
Help Files
The component help files are available offline if no internet connection is available.
Video Tutorials
When there is a video tutorial available for the component an extra button is revealed which will load the demo into the components inspector panel. (Please note - This will not appear when working offline.)
See also |
|||