Dynamic load image and tile it! how?

heyh,

im working on a little project, and would like to be able to have my clients add, background tiles to their page, and yes it can be done in html, but I running everything trought Flash, so I like to keep it this way.

I’ve got background colo and bagground image working in the right layers, but not my tiling script… :(…

I can do it if i have it compiled within the Flash (Libary) as a graphic, But, I would like to be able to load it dynamic from a XML file knowing the [foldername]/filename

project structure
::::::::::::::::::::::::::::::
|- project.swf
|- gfx/
|- tile.jpg
|- xml/
|- settings.xml
:::::::::::::::::::::::::::::

I I know i included XML all of a sutten, but nevermind that.

I would like to dynamic load an image from the variable from the XML and then let the folowing script tile i… and it works fine, with an image from the Libary.


function tiler(linkageID:String, target:MovieClip, clipName:String, depth:Number, x:Number, y:Number,  row:Number, column:Number):MovieClip {
                        trace("go");
                        var pattern:MovieClip = target.createEmptyMovieClip(clipName, depth);
                        var depthCount:Number = 0;
                        for (var j:Number = 0; j < column; j++) {
                            for (var i:Number = 0; i < row; i++) {
                                var tile:MovieClip = pattern.attachMovie(linkageID, "tile" + i +"_" + j, depthCount);
                                tile._x = x + (tile._width * i);
                                tile._y = y + (tile._height * j);
                                depthCount++;
                                //trace(depthCount);
                            }                            
                        }
                        return pattern;
                    }
                    var patternClip:MovieClip = tiler("123", this, "patternClip", 1, -10, -10, 20, 2);

“123” is the identifiername of a graphics in the libary.

linkageID = Identifiername ( this I would like to be the loaded image)
target = itself :slight_smile:
clipName = “patternClip”
depth = …
x = starting position
y = starting position
row = number of rows to repeat
column = number of columns to repeat

If any questions please leave me an hint if more explaning is needed