You're gonna need gfxpak and GFXVIEW and, of course, the files you want for the flag (make sure they are in Indexed Mode, look it up on Photoshop or whatever image editor you use).
Once you're set, fire up Notepad and write a command like this:
gfxpak -rp FILENAME.PAK Fl01.png Fl01 Fl02.png Fl02 Fl03.png Fl03 ... (repeat this until you get to 12)
Where FILENAME is the name of the flag you want to replace (e.g. MALAYSIA.PAK), "Fl01.png", "Fl02.png" and so on are the names of your edited files, and "Fl01" (same as before, without the extension) are the names of the files as they will be encapsuled in the .PAK file (they go to 12 because all these flags have 12 frames of cycling animation).
You'll have to use the same names the files used before, or else they won't work in the game.
To learn the names of the image files, you'll use GFXVIEW. You can also use it to unpack the individual images from the file, in case you need a guide.
What that script does is replace the files in the .PAK with your own files, without loss of colors. Here's the example with Malaysia for clarification:
gfxpak -rp MALAYSIA.PAK Ma01.png Ma01 Ma02.png Ma02 Ma03.png Ma03 Ma04.png Ma04 Ma05.png Ma05 Ma06.png Ma06 Ma07.png Ma07 Ma08.png Ma08 Ma09.png Ma09 Ma10.png Ma10 Ma11.png Ma11 Ma12.png Ma12
Re-explaining each part:
* gfxpak : means it's a command that gfxpak will use, obviously.
* -rp : is the command that will replace each file in the pack with your files. In this case, R is for real and P is for palette, i.e. it'll keep the image's real palette. Trust me, this works better than the -c command that Gonzalo Indacochea used.
* MALAYSIA.PAK is the file you'll be editing.
* MaXX.png are the image files you'll put into the .PAK file above.
* MaXX are how these files will be presented once they are encapsuled in the .PAK.
In short, you'll want to write something like the above.
So anyway, once you finish with the file above, save it with any name, then do the following
in this exact order:
1. Change its format from .txt to .bat so it'll become a batch file
2. Copy gfxpak and the original .PAK into the same folder the .bat is
3. Double-click your .bat to run it. It'll generate a new flag with the same name as the old one (if you change any filename, for the flag or for the images inside, it won't work)
Once you're done, copy your flag into the FEPACK/GLOBAL folder (but don't forget to backup the original if you mess something up). Remember also to make the small flags (SM______.PAK), which will show up in the Team Select screens in Friendly, Penalty Shootout, and Training - the standard-sized ones appear only in the League mode. The small flags will go in the FEPACK/LEAGUE folder.
NOTES:
* The continental confederation flags only appear in small size (196x66 - normal size is 224x75). You can make them in the normal size, though, and resize it - the proportions will be kept.
* If you're going to replace the Swedish flag, note that its file is called NORWAY, not SWEDEN. Same goes for the small one, its name's SMNORWAY. Who knows why.