I'm creating a Flash movie that loads some XML containing details of some text and a image URL, that needs to replace a existing MovieClip in a Flash movie.

Is there a way in Flash to replace a existing MovieClip or to update it so that the updated/new display object keeps the original look of the original display object and any Tweening for the original display object still works we the new or updated display object.

Thanks

Stephen

Update: here is the code I'm using to load this:

---

```
import flash.events.IOErrorEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.Loader;
import flash.text.TextField;
import flash.events.ProgressEvent;

// get the number of children in display list
var count:uint = numChildren;

// get the url for the Ceres server
//var configUrl:String = loaderInfo.parameters.configUrl;

// load the config file from the server using the configUrl
var configUrl:String = "C:\development\projects\ReadXMLInFlash\example_xml_ceres_response.xml";   //loaderInfo.parameters.configFileUrl;
var defaultImgUrl:String = loaderInfo.parameters.defaultImgUrl;
var urlRequest:URLRequest = new URLRequest( configUrl );

// create the XML loader
var urlLoader:URLLoader = new URLLoader();
urlLoader.load( urlRequest );
urlLoader.addEventListener(Event.COMPLETE, onDataLoaded);
//Error handling    ;
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
//Could be an error or just a message;
urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus);

function onDataLoaded(evt:Event):void
{
    var myXML:XML = new XML(evt.target.data);
    var node:XML;
    // loop through the XML
    for each (node in myXML.dynamicGroups.DynamicGroup.assets.Asset.elements.Element)
    {
        // check the assetValue of the XML, if contains http then a link use 'createNewImageLoader'
        if(String(node.assetTagName) == 'Image' )
        {
            createNewImageLoader( node.assetValue, node.elementName );
        }
        else
        {
            // else it is text (e.g. a product descrition) use createNewTextLoader
            createNewTextLoader( node.assetValue, node.elementName );
        }

    }

}

//error callbacks
function onIOError(evt:IOErrorEvent)
{
    trace("IOError: "+evt.text);
    // if an error load the default image
    var defaultImgLoader:Loader = new Loader();
    var defaultImgUrl:URLRequest = new URLRequest( defaultImgUrl );
    defaultImgLoader.load( defaultImgUrl );
    addChild( defaultImgLoader );

}
function onHTTPStatus(evt:HTTPStatusEvent)
{
    //trace("HTTPStatus: "+evt.status);
}
function onSecurityError(evt:SecurityErrorEvent)
{
    trace("SecurityError: "+evt.text);
}

// loads a image asset
function createNewImageLoader(loadURL:String, elementname:String):void
{
    for(var i:uint=0;i<numChildren;i++)
    {
        var display:DisplayObject = getChildAt(i);
        if (elementname == display.name)
        {
            var loader:Loader = new Loader();
            var urlRequest:URLRequest = new URLRequest(loadURL);
            loader.addEventListener(Event.COMPLETE, function(){
                                    loader.x = display.x;
                                    loader.y = display.y;
                                    addChild( loader );
                                    removeChild(display);
                                    });
            loader.load( urlRequest );

        }
    }
}
// adds new text to a display object
function createNewTextLoader( textToLoad:String, elementname:String):void
{
    trace( "elementname:" + elementname );

    for(var i:uint=0;i<count;i++)
    {
        var display:DisplayObject = getChildAt(i);

        trace( "displayName:" + display.name );
        if (elementname == display.name)
        {
            var textToDisplay:TextField = new TextField();
            textToDisplay.text = textToLoad;
            textToDisplay.x = display.x;
            textToDisplay.y = display.y;
            addChild(textToDisplay);
            removeChild(display);
            break;
        }
    }
}

```