Load dynamic data
When the ad runs, the Dynamic Enabler component transfers the dynamic data from the Rich Media Dynamic Ads content management systyem (RMDA CMS) into the ad, and you can't use the data until it's downloaded from the servers. The component has a callback feature that invokes a user-defined function when the download is ready.
Set up a Flash creative to load in your dynamic content
for AS2 users
- Add a listener for
registerOnLoadHandlerthat tells the Dynamic Enabler to run this function when ready://"DynamicEnabler" is a global reference to the component instance in AS2
DynamicEnabler.registerOnLoadHandler(dynamicStatusHandler); - Request data from the Dynamic Enabler:
DynamicEnabler.requestData(); - Create a handler function that's called when the dynamic data has loaded, for example:
function dynamicStatusHandler():Void {
if (1 == DynamicEnabler.getDataStatus()) {
getDynamicData();
} else {
trace("RMDA CONNECTION FAIL....");
}
} - When the dynamic data is ready, the component runs the code inside the
getDynamicData()function.function getDynamicData(){
trace(“Dynamic Content Goes Here”);
}
registerOnLoadHandler function could result in errors in the creative.for AS3 users
- Create a listener for when the Dynamic Enabler loads and its status has changed. For example:
DynamicEnabler.addEventListener(DynamicAdEvent.STATUS,
DynamicStatusHandler); - Request data from the Dynamic Enabler:
DynamicEnabler.requestData(); - Create a handler function that's called when the dynamic data has loaded, for example:
function dynamicStatusHandler(event:DynamicAdEvent):void {
if (DynamicEnabler.SUCCESS == event.status) {
getDynamicData();
} else {
trace("RMDA CONNECTION FAIL....");
}
} - When the dynamic data is ready, the component runs the code inside the
DynamicEnabler.SUCCESScondition.function getDynamicData(){
trace(“Dynamic Content Goes Here”);
}
Access dynamic data
To access the dynamic data as an HTML string, call the function:
DynamicEnabler.getValueAsHtml(dynamicHtmlName:String, defaultText:String);
This returns the dynamic data for each dynamicStringName submitted. You can set your creative container values directly to the value returned from the function, above.
You must pass two arguments into the function call: the label (matching one element name defined in the RMDA UI) and a default string to be shown if the dynamic data doesn't load.
Example:
myTextBox.text = DynamicEnabler.getValueAsHtml("tagline", "This is some default text.");
See complete Dynamic Enabler methods documentation for a full list of functions and their usage for accessing dynamic data.
