Advanced Programming
1.) Adding additional Movie load variables/placeholders
Microsoft Rich Media allows you to load up to 15 external/child movies into a parent/base movie. By default, 4 Movie variables/placeholders are predefined in the Microsoft Rich Media template. To add additional Movie variables/placeholders follow the steps below:
- In the Links and Descriptions layer of your parent/base movie's main timeline, Add a new Movie variable
- Right Click frame 1 of the movie1 layer in Movies layer set on the main timeline and Select Copy Frames.
- Add a new layer to the Movies layer set and Name it movie5.
- Right Click Frame 1 of the layer you just created (movie5) and Select Paste Frames.
- Open movie Properties Panel, Press CTRL+F3. With Frame 1 of your new layer selected, Press CTRL+a to select all. In the Properties Panel, Change movie1_mc to movie5_mc.
- That is it! You have successfully added an additional Movie load variable & placeholder to your Flash movie. Repeat steps 1 thru 5 to add more Movie load variables & placeholders (up to 15).
2.) Loading a grandchild SWF into child SWF
When loading a grandchild .swf movie into a child .swf movie you do not use the Microsoft Rich Media movie() command. However, you do need to use the movie variables defined in the Links and Descriptions layer.Example:
Your Links and Descriptions movie variables would look something like this:
movie1 = childMovie1.swf
movie2 = childMovie2.swf
movie3 = grandchildMovie1.swf
movie4 = grandchildMovie2.swf
Your Actionscript, in the child movie, to load the grandchild movie would look something like this:
loadMovie(_root.movie3);
*Where _root.movie3 = grandchildMovie1.swf
Note: We do not use the movie() command because this is ONLY used for loading into the parent/base movie file.
3.) Triggering actions after an elapsed period of time
The script below is an example of how to close the expanded phase of an ad after it has been open for 10 seconds and report the event.
var startTime = getTimer();
var countdownDuration = 10; // Duration in seconds
onEnterFrame = function () {
var elapsedTime = getTimer() - startTime;
elapsedTime = Math.round(elapsedTime/1000);
if (elapsedTime>=countdownDuration) {
// Event Action
_root.conduit.event(1);
// Action to take once time has been reached
_root.gotoAndPlay("reminder);
}
}
Usage: A possible use for this script would be to close the Teaser portion of a floating ad after a certain amount of time has passed.
4.) Time Bucketing
The script below is an example of how to start and stop a timer based on user interaction and then track events based on the amount of time elapsed.
Code Example:
The script below is an example of how to start and stop a timer based on user interaction and then track events based on the amount of time elapsed.
Start/stop timer functions would be added to the first frame of a layer on the main timeline of your movie.
// Start Timer Function
function ARM_startPanelTimer() {
//Initiates time
ARM_startTime = getTimer ();
}
// End Timer Function
function ARM_endPanelTimer() {
// Evaluates the difference between elapsed time & start time.
var ARM_elapsedTime = getTimer() -ARM_startTime;
// rounds the time to whole seconds and sets the total duration variable
ARM_totalDuration = Math.round(ARM_elapsedTime/1000);
// executes the correct event based on the elapsed time
if (ARM_totalDuration<=5) {
_root.conduit.event(1);
} else if (ARM_totalDuration>=6 && ARM_totalDuration<=10) {
_root.conduit.event(2);
} else if (ARM_totalDuration>=11 && ARM_totalDuration<=15) {
_root.conduit.event(3);
} else if (ARM_totalDuration>15) {
_root.conduit.event(4);
}
}
NOTE: the event calls in the if/else clause above (i.e _root.conduit.event(1); etc.) should correspond to the event variables defined on the links and descriptions layer of the main timeline, as shown in the code example below.
event1desc = "ad was expanded for 0 to 5 seconds";
event2desc = "ad was expanded for 6 to 10 seconds";
event3desc = "ad was expanded for 11 to 15 seconds";
event4desc = "ad was expanded for greater than 15 seconds";
Implementation Example:
Let’s say you have an Expanding Banner type ad and you want to track how long a user expands the ad for, you would call the functions like this:
On the ad's banner phase clickthrough button:
on (rollOver) {
// starts time
_root.ARM_startPanelTimer();
_root.gotoAndStop ("expand");
}
on (release) {
_root.conduit.exit(1);
}
On the ad's expand phase close button:
on (release) {
// ends timer
_root.ARM_endPanelTimer();
_root.gotoAndPlay("banner");
}
This is just one example of how implement the time bucketing code. It does NOT have to be executed from a button object, it could also be implemented via another script, object or directly from the timeline.
NOTE: You CANNOT dynamically assign the timer results to the event variables found on the links and descriptions layer. The system is not able to accommodate this type of functionality at this time. The Microsoft Rich Media event variables have to be predefined.
5.) Microsoft Rich Media Reserved Words
Please avoid using the following keywords in the areas of your rich media ad that do NOT pertain to the Microsoft Rich Media functionality.
- Banner
- Expand
- Teaser
- Reminder
- Main
- Closead
- mouseRolledOff
- closeSelfFloat



