Change the event category in the GTrack OSMF plugin (dynamically)

This is somewhat a spin-off from the Media Player Anatomy series of tutorials that I’m working on, but since there is nothing to be found out there I thought to post this in case it helps anyone.
From a series of emails that I had with a representative of the RealEyes Media the only way to change the event category that is being send to the server is by changing the config.xml file.
It seemed rather insane to have a single config.xml for each category so I thought to create one on the fly as it only needs to be xml (file or build with as3 makes no difference).
FYI this is the reops tutorial on the GTrack plugin (a really nice plugin and one of the few left for free nowadays…)
GTrack Plugin Tutorial

We assume that the initial load has been done and now we want to change the category into “music”
we declare an XML template:
[cc lang=”Actionscript”]
public var xmlTemplate:XML =


And then we change it:
[cc lang=”Actionscript”]
public function createXMLConfig(cat:String = ‘music’):XML
var attr:XML = new XML(xmlTemplate);

var arr:XMLList = new XMLList();
arr = attr.event;
for(var i:Number=0;i {
attr.event[i].@category = cat;

return attr;

This can be then loaded as follows:
[cc lang=”Actionscript”]
var customPluginConfigXML:XML = createXMLConfig();
pluginResource.addMetadataValue( “”, customPluginConfigXML );

At this point you might want to remove the previous MetadataValue before assigning the new one.


Tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *