Forum Moderators: open

Message Too Old, No Replies

Set image as tiled background in Flash MX

         

chaosAD

9:39 pm on Apr 19, 2004 (gmt 0)

10+ Year Member



Hi,
Does anybody know if it is possible to set an image as a tiled background in Flash? I need to match it to the background image I used for a HTML page, many thanks.

yowza

10:02 pm on Apr 19, 2004 (gmt 0)

10+ Year Member



I don't know if it is, but I don't think so.

However, you could have a transparent background.

chaosAD

10:08 pm on Apr 19, 2004 (gmt 0)

10+ Year Member



Hi,

How would I go about setting a transparent background?
Thanks for your help.

mumbledawg

11:38 pm on Apr 19, 2004 (gmt 0)

10+ Year Member



Set windows mode to transparent under Publish Settings/HTML

Soth

11:42 pm on Apr 19, 2004 (gmt 0)

10+ Year Member



Depending on the texture of the tile, you can import the tile into the movie and press CNTL B to break the image. You can then use the eye dropper tool on the image which will make a pattern out of the image. You then simply make a square the same size as your movie on the bottom layer and fill it with the paint bucket tool.

If its a mottled texture or one that is a very fine grain it blends in ok with the HTML background.

benihana

8:18 am on Apr 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



whilst i cannot give you specific code (having not done it and not having time to do it right now :(), you could use a couple of nested for loops in action script to duplicate the image (it would have to be contained in a movieclip).

e.g., say your image is 10 x10 px, and your movie is 200 by 100 px, and the picture is held in a movieclip called (instance name of) my_mc


//looping through 10 times to give 10 rows
for (i = 1; i < 10; ++i) {

//looping through 20 times to give each row 20 columns
for (p = 1; p < 20; ++p) {

// duplicating the movieclipeach loop, and setting its name to have i + p appended, eg the first one would be my_11_mc, second my_12_mc - same for depth, which is starting at -10 give depths of e.g. -1011, -1012 etc
_root.my_mc.duplicateMovieClip("my"+i+p+"_mc", -1000+i+p);
//setting the x and y coordinates of each new movie clip to be 10 x i and p. as the image is 10 px this should put things in the right position.
_root["my"+i+p+"_mc"]._x = (10*p);
_root["my"+i+p+"_mc"]._y = (10*i);

}
}

N.B. its early and i need coffee, so im not saying this code is anything like syntactically correct, but could function with a little work :)

winstun

3:46 pm on Apr 20, 2004 (gmt 0)

10+ Year Member



If you have Flash MX 2004 there is a built-in function to create repeating tiles for you with an easy to use interface.

If you only have MX then Ben's suggestion would be best I would think.

Heh, Ben's way would likely give you a smaller file size, as well. Sometimes Flash's intrinsic functions and components can seem a bit bloated.

Cheers,
winstun