Loading in XML images;

Hi everyone,

Has anyone got experience loading in PNG’s or GIF’s into empty movieclips?

For some reason, only one of my PNG’s will load (and its no the first one or last one, its not the smallest file sized one, so its not the code i think). But it will load as many jpegs as I want, but if I try and load in a gif, the whole movie loads for a second then just everything disappears.

Heres the code:

//standard code
fscommand("allowscale", "true");
stop();

var mainVar;
mainVar = _root.SetMainVar;
//mainVar = 0;

var WebDesignURL;
WebDesignURL = _root.SetWD;

var LogoDesignURL;
LogoDesignURL = _root.SetLD;

var WebDesignURL;
SeoURL = _root.SetSEO;


//inv button functions
Layer3.WebDesign._alpha = 0;
Layer3.WebDesign.onRelease = function()
{
    trace("web design test triggered");
    getURL(WebDesignURL);
}

Layer3.LogoDesign._alpha = 0;
Layer3.LogoDesign.onRelease = function()
{
    trace("logo design test triggered");
    getURL(LogoDesignURL);
}

Layer3.SEO._alpha = 0;
Layer3.SEO.onRelease = function()
{
    trace("SEO test triggered");
    getURL(SeoURL);
}


//trace all the x values (debugging - to comment out!!!)
myformat = new TextFormat();
myformat.color = 0xffffff;
myformat.bullet = false;
myformat.underline = true;
myformat.bold = true;
myformat.size = 12;

_root.createTextField("Layer1Position",getNextHighestDepth(),10,10,100,20);
Layer1Position.multiline = true;
Layer1Position.wordWrap = true;
Layer1Position.border = true;
Layer1Position.background = true;
Layer1Position.backgroundColor = 0x000000;

_root.createTextField("Layer2Position",getNextHighestDepth(),10,30,100,20);
Layer2Position.multiline = true;
Layer2Position.wordWrap = true;
Layer2Position.border = false;
Layer2Position.background = true;
Layer2Position.backgroundColor = 0x000000;

_root.createTextField("Layer3Position",getNextHighestDepth(),10,50,100,20);
Layer3Position.multiline = true;
Layer3Position.wordWrap = true;
Layer3Position.border = false;
Layer3Position.background = true;
Layer3Position.backgroundColor = 0x000000;


//load in xml
var xmlLoc;
xmlLoc = _root.SetXML;

var straplines_array;
var banner_xml = new XML();
banner_xml.ignoreWhite = true;
banner_xml.onLoad = function (success)
{
    if (success)
    {
        var banner = this.firstChild;
        straplines_array = banner.childNodes;
        PopulateLists(straplines_array);
        //trace("banner= "+banner+"
");
        //_root.createTextField("Text",33,500,0,100,30);
        //Text.text = "xml loaded";
        //Text.setTextFormat(myformat)
    }
    else
    {
        trace('Error loading XML file.');
        //Text.text = "xml failed";
        //Text.setTextFormat(myformat)
    }
}
banner_xml.load(xmlLoc);
//banner_xml.load("./Banner.xml");

//now do something with the xml data
PopulateLists = function(final_array)
{
    for (var i=0; i<final_array.length; i++)
    {
        //tell the loop we are about to retrieve the attributes of each line in the xml
        var banner = final_array*.attributes;
        
        //retrieve all the atributes from each array instance
        var strA;
        strA = banner.conttext;
        //trace("strA= "+strA);
        
        var intB;
        intB = banner.xcord;
        //trace("intB= "+intB);
        
        var intC;
        intC = banner.ycord;
        //trace("intC= "+intC);
        
        var intD;
        intD = banner.wdth;
        //trace("intD= "+intD);
        
        var intE;
        intE = banner.hght;
        //trace("intE= "+intE);
        
        var intF;
        intF = banner.fntsize;
        //trace("intF= "+intF);
        
        var intG;
        intG = banner.txtrot;
        //trace("intG= "+intG);
        
        var intH;
        intH = banner.txtcol;
        //trace("intH= "+intH);
        
        var intY;
        intY = banner.level;
        //trace("strZ= "+strZ);
        
        var strZ;
        strZ = banner.path;
        //trace("strZ= "+strZ);
        
        //format the style of the text (doing it for each instance so individual text sizes and rotations can be set
        TextStyle = new TextFormat();
        TextStyle.color = intH;
        TextStyle.bullet = false;
        TextStyle.underline = false;
        TextStyle.font = "MyFont";
        TextStyle.size = intF;
        
        //now create a text field for each line in the xml
        if(strA)
        {
            _root.createTextField("TextBox"+*,getNextHighestDepth(),intB,intC,intD,intE);
            this["TextBox"+*].multiline = false;
            this["TextBox"+*].wordWrap = false;
            this["TextBox"+*].border = false;
            this["TextBox"+*].wordWrap = true;
            this["TextBox"+*].embedFonts = true;
            this["TextBox"+*].htmlText = strA;
            this["TextBox"+*]._rotation = intG;
            this["TextBox"+*].setTextFormat(TextStyle);
        }
        
        //now lets create the movieclips for the images
        if(strZ)
        {
            _root.createEmptyMovieClip("ImageHolder"+*,intY);
            this["ImageHolder"+*].loadMovie(strZ);
            this["ImageHolder"+*]._x = intB;
            this["ImageHolder"+*]._y = intC;
            this["ImageHolder"+*].width = intD;
            this["ImageHolder"+*].height = intE;
        }
    }
}


//test code from adobe live docs
/*var container_mc = _root.createEmptyMovieClip("picture", _root.getNextHighestDepth());
container_mc.loadMovie("http://www.designaces.co.uk/Sites/DA2008b/Images/Banner3.gif");

test_btn.onRelease = function()
{
    container_mc.useHandCursor = true;
}*/

I set the co-ords, width and height etc in the XML file.

So has anyone ever tried this out importing PNG’s or GIFS? I am exporting for Flash Player 8 and have also tried 9 but that didnt help.

These are the locations of the PNG’s:

http://www.designaces.co.uk/Sites/DA2008b/Images/Banner1.png
http://www.designaces.co.uk/Sites/DA2008b/Images/Banner2.png
http://www.designaces.co.uk/Sites/DA2008b/Images/Banner3.png
http://www.designaces.co.uk/Sites/DA2008b/LinkedFiles/Banner.fla

The reason it needs to be PNG’s is that im trying to create a parallax effect banner that is XML based so that other people that cant use Flash, can update it in my work. Also gonna put it as a free download once it finished. (I already have the parallax code working when I place the images on the canvas but decided this really needs to be XML based so it can be updated easily).

I have been stuck on this for 3 days now so I have been trying everything before bothering people asking for help. If anyone has a spare 5 mins, can you have a look and see what Im doing wrong. I have attached the XML but Flash (was too large to upload as i still have the 3 png’s inside it at the moment) files and image locations are above but you shouldnt need them as they are full URL’s in the XML file.