A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: tile a background image in flash

  1. #1
    Junior Member
    Join Date
    Aug 2005
    Posts
    15

    tile a background image in flash

    Hello im new here so I don't know if im in the right topic for this:

    How do you "tile" an image in flash? I have seen so many flash sites with tiled background images (ex: 2advanced.com, look closely at the pinstrip design in the background). How do I do that? How do you tile an image in general?

    Thank You guys in advance!

  2. #2
    the naked eye waynenort's Avatar
    Join Date
    Jan 2002
    Location
    Melbourne, Australia
    Posts
    334
    All done manually with the help of the rulers guides and hight/width in the property dialogue box.

    Or place all your tiles on the stage and use the align function under modify

    Or http://www.flashkit.com/board/showthread.php?t=642631
    Last edited by waynenort; 08-21-2005 at 08:43 AM.

  3. #3
    Junior Member
    Join Date
    Aug 2005
    Posts
    15
    Ok, I still don't understand how to do that, even with all the codes shown in the link. Ok, How do you tile an image in general? Photoshop?

  4. #4
    Noor._alpha = 0 ! nooor83's Avatar
    Join Date
    Aug 2005
    Posts
    252
    not suppose to answer this here but it's ok..

    open a new photoshop image and make it 50 x 50 in draw ur pattern OR open any available picture that u want just to tile..

    now go edit -> define pattern and write the pattern name and click ok..

    now click on the paint bucket tool in the toolbox to the left side..and then below the menu up u will see a drop down box of two choices wether pattern or foreground..choose pattern and pick up the pattern u have define or the ready made pattern and fill ur image..that's it..

    Noor

  5. #5
    Junior Member
    Join Date
    Aug 2005
    Posts
    15
    Thank you nooor83, that helped a lot!

  6. #6
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    Quixx came up with a nice bit of code for tileing a background.....

    code:

    //"tiles" holds the Width and Height dimensions of your tile (100 x 100 px).
    tiles = {tileW:100, tileH:100};
    //Your movie is 800px wide, so you need 8 tiles across (8 x 100 = 800).
    var mapWidth = 8;
    //Your movie is 600px high, so you need 6 tiles across (6 x 100 = 600).
    var mapHeight = 6;
    level = 1;
    for (var i = 0; i<mapHeight; ++i) {
    for (var j = 0; j<mapWidth; ++j) {
    _root.level++;
    _root.container.attachMovie("myTile", "myTile"+_root.level, _root.level);
    myTile = eval("_root.container."+"myTile"+_root.level);
    myTile._x = (j*tiles.tileW);
    myTile._y = (i*tiles.tileH);
    }
    }
    stop();


  7. #7
    the naked eye waynenort's Avatar
    Join Date
    Jan 2002
    Location
    Melbourne, Australia
    Posts
    334
    edit: you must of beat me with the code. Nice

    Photoshop is great and very easy create tiled backgrounds as like Fireworks. But the only problem is if you import a fully tiled screen from PS it makes the Flash file size much larger and it will take longer for your web page to open. Especially if your on a dialup modem.
    Sure make your one tile in PS, but if you want your Flash file to be much smaller and quicker to load on the net, duplicated the tiles in Flash.

    OK. If you tile is 50 x 50 and your Flash stage(screen size) is 600 x 800 then duplicate the patten 16 times for the length of the stage. Approximately line them up horizontally accross the stage in a row. The left tile has to be at far left of the stage and the right tile needs to be at the stage right.

    Select all the tiles - goto edit in the tool bar - click align - click on vertical centre.
    With your 16 tiles still selected - goto edit - click align - click on distribute widths

    Your tiles should be all ailgned perfectly in a row. Group these. Now duplicate these 12 times. for the hight of the stage and do this:.

    Approximately line them up vertically on the stage in a row. The top row has to be at top the stage top and the bottom row at the stage bottom.
    Select all the tiles - goto edit in the tool bar - click align - click on horizontal centre.
    With your 16 tiles still selected - goto edit - click align - click on distribute heights
    All your tiles should be all ailgned perfectly in the pattern you want. So none of them move - convert them to a graphic symbol.

    This may seem to take longer than PS, but it's worth it for file size sake.
    Last edited by waynenort; 08-21-2005 at 07:01 PM.

  8. #8
    Junior Member
    Join Date
    Aug 2005
    Posts
    15
    So uh, basically im just copying, pasting, grouping, and aligning. Ok, I shoulda thought of that on my own. Thank you guys!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center