From September, Flash will no longer be supported by Chrome. Prepare for the shift towards HTML5 by visiting our Flash to HTML5 help page

Check it out!

XML Manager Component

  • Info

    Adform XML Manager component ensures the proper performance of Adform Dynamic Content Banners.

  • Events

    AdformXMLManager component has the following methods and events:

    1. For loading a text variable value to an assigned textField:

    AdformXMLManager.setText(varName:String, tf:TextField);


    varName - variable name in content xml at selected group;
    tf – textfield instance name.

    2. For loading an image to an assigned movieClip with a preloader:

    AdformXMLManager.loadFile(varName:String, mc:*, loadCompleteHandler:Function, loadProgressHandler:Function);


    varName – variable name in content xml at selected group;
    mc – movieClip instance name;
    loadCompleteHandler – function to call when file has been loaded;
    loadProgressHandler - function to call while file is loading; properties are bytesLoaded and bytesTotal.

    3. For retrieving variable values:

    AdformXMLManager.getVarValue(type:String, name:TextField);

    type – variable type in the context xml, possible types are: text and graphic;
    name – variable name in the context xml.

    Note: You are not able to access a variable value until XML is completely loaded. You must listen to the “AdformXMLManager.XML_LOAD_COPLETE” event.


    4. Adding event listener:

    AdformXMLManager. addEventListener (event:String, handler:Function);


    event – event name;
    handler – event handle function.

    5. AdformXMLManager component has event which fires when XML is completely loaded:

    AdformXMLManager. addEventListener (AdformXMLManager. XML_LOAD_COMPLETE, onXMLLoaded:Function);

    6. For setting the test XML location (this is ONLY for testing purposes, when publishing final banners this method should not be used as the AdformXMLManagers find the XML automatically):

    AdformXMLManager.pathToXMLFile = "url:String"

    url – Valid URL to a content xml. Possible values are relative (ex.: metadata.xml) or full paths.

     

  • Examples

    ActionScript2:

    AdformXMLManager.pathToXMLFile = "ADFdemo.xml";
    AdformXMLManager.loadFile("Logo", this.mc1, onImageCompleted, onImagePreloader);
    AdformXMLManager.setText("BackgroundColor", this.myText1);
    AdformXMLManager.setText("TextAS2", this.myText2);
    function onXMLLoaded(e):Void {
       trace("onXMLLoaded");
       trace("getVarValue "+AdformXMLManager.getVarValue("text", "TextAS2"));
    }
    function onImageCompleted(e):Void {
       trace("onImageCompleted");
    }
    function onImagePreloader(e, bl, bt):Void {
       trace("onImagePreloader "+bl+", "+bt);
    }
    AdformXMLManager.addEventListener(AdformXMLManager.XML_LOAD_COMPLETE,onXMLLoaded);

    ActionScript3:

    AdformXMLManager.pathToXMLFile = "ADFdemo.xml";
    AdformXMLManager.setText("BackgroundColor", this.myText1);
    AdformXMLManager.setText("TextAS2", this.myText2);
    AdformXMLManager.loadFile("Logo", this.mc1, onImageCompleted, onImagePreloader);
    function onXMLLoaded(e:Event):void {
       trace("onXMLLoaded");
       trace("getVarValue "+AdformXMLManager.getVarValue("text", "TextAS2"));
    }
    function onImageCompleted(e:Event):void {
       trace("onImageCompleted");
    }
    function onImagePreloader(e:ProgressEvent):void {
       trace("onImagePreloader "+e.bytesLoaded+"/"+e.bytesTotal);
    }
    AdformXMLManager.addEventListener(AdformXMLManager.XML_LOAD_COMPLETE, onXMLLoaded);

     

    Weight
    ActionScript2: AdformXMLManager component – 7231 bytes;
    ActionScript3: AdformXMLManager component – 6610 bytes;