I have a background in flash I want to cut up into tiles for scrolling. I can't seem to figure out how to do this, can someone please put me out of my misery?
Printable View
I have a background in flash I want to cut up into tiles for scrolling. I can't seem to figure out how to do this, can someone please put me out of my misery?
There are several programs that lets you split up an image into several.
I've used a program called Splitz: http://134.53.40.1/dms/rajkumtm/splitz/
Note: I'm assuming this is a map which only goes left and right, and doesn't move vertically.
Just select a screen-sized portion of the map, turn it into a movie clip (let's say tile0), then the next screen-sized portion of it will be tile1, the next will be tile2, and so on. So assume you start off at tile5. If you press left, it'll attach tile4 to the left of it. Keep on going left, and eventually you'll have to attach tile3, too (and remove tile5).
if you're using MX04, you can use this
Code:/**
* Save As : TileSet.jsfl
* Save In : C:\Documents and Settings\[username]\Local Settings\Application Data\Macromedia
* \Flash MX 2004\en\Configuration\Commands
*
* Works : Flash MX 2004
* Usage :
* Create a new Flash document, create a blank movieclip named 'tileset', import yout tileset.gif|jpg into that
* Align the tileset to the top-left and break the image apart (Ctrl + B | Modify -> Break Apart )
*
* Next select Commands -> TileSet; this will genarate a tileset
* Tiles are named tileX where X is a incremented number
*
* By default the tiles are not set to be exported at the first frame, if you want them to
* alter the indicated line in the for loop
*/
var tileW = 32 // the width of your tile
var tileH = 32 // the height of your tile
var setW = 10 // the number of horizontal tiles in your tileset
var setH = 10 // the number of vertical tiles in your tileset
var lib = fl.getDocumentDOM ( ).library;
var source = 'tileset';
var tileNum = -1
for ( var y = 0; y < setH; y++ )
{
for ( var x = 0; x < setW; x++ )
{
var name = 'tile' + ( ++tileNum )
lib.addNewItem ( 'movie clip', 'tiles/' + name );
lib.setItemProperty ( 'linkageExportForAS', true );
// export at first frame?
lib.setItemProperty ( 'linkageExportInFirstFrame', false );
fl.getDocumentDOM ( ).library.selectItem ( source );
fl.getDocumentDOM ( ).library.editItem ( );
fl.getDocumentDOM ( ).setSelectionRect ( { left: x * tileW, top: y * tileH, right: ( x +1 ) * tileW, bottom: ( y + 1 ) * tileH } );
fl.getDocumentDOM ( ).clipCopy ( );
fl.getDocumentDOM ( ).library.selectItem ( 'tiles/' + name );
fl.getDocumentDOM ( ).library.editItem ( );
fl.getDocumentDOM ( ).clipPaste ( true );
fl.getDocumentDOM ( ).moveSelectionBy ( {x: -x * tileW, y: -y * tileH } );
fl.getDocumentDOM ( ).selectNone ( );
}
}
Any idea if the script will work on a mac?
I tried but it complained about the clipCopy function when ever I tried to run it.
Are you kidding? The Flash Player's practically famous for its cross-platform portability. Unless Macromedia have betrayed us (_again_), then it ought to work fine.
http://www.apple.com/favicon.ico
I salute you, Comrade Macski!
I had the same problem on a pc when i was writing the script, I can't remember what or how I solved it, maybe try running the code on this .fla (see if it makes any difference) just resize the image (in the fla) to 320x320
tell me how you get on