A journal that focuses on Flash Platform development, and a little bit about what I am up to on any given day.

Thursday, June 23, 2005

FLfile.write()"`\n" stripped

It seems to me that the traditional "\n" does not work with the FLfile.write method properly.

I was working on a little extension, and I would be passing String data up from a SWF using MMExecute(). IN JSFL, when i did a few alert or traces to check the string, eveything seemed fine, but when written to disk, all line breaks were removed.

For this extenion it was crucial that I have the line breaks, so I had to keep trying to figure out the issue. I determined that 100% FLFile was stripping them out. If i write the string to a file using the fl.ouputPanel.save(), they were in there.

So at the end of the day I just ended up doing a character code output and comparing the edifference between a file that was properly written vs one that was stripped. The difference was the missing char 10.

So instead of using newline(in AS) or \n in my string generation, I used this instead String.fromCharCode(13,10). Pretty simple, but it is annoying when documented examples of using this functionality fail, making you search through your own code trying to find the issue. A note should be made in the official documentation for FLfile.write().

4 Comments:

Anonymous Anonymous said...

Bumped in to this problem yesterday, thanks for the solution.

/Ted

12:46 AM

 
Anonymous Anonymous said...

runescape money runescape gold runescape money runescape gold wow power leveling wow powerleveling Warcraft Power Leveling Warcraft PowerLeveling buy runescape gold buy runescape money runescape items runescape gold runescape money runescape accounts runescape gp dofus kamas buy dofus kamas Guild Wars Gold buy Guild Wars Gold lotro gold buy lotro gold lotro gold buy lotro gold lotro gold buy lotro gold runescape money runescape power leveling runescape money runescape gold dofus kamas cheap runescape money cheap runescape gold Hellgate Palladium Hellgate London Palladium Hellgate money Tabula Rasa gold tabula rasa money lotro gold buy lotro gold Tabula Rasa Credit Tabula Rasa Credits Hellgate gold Hellgate London gold dofus kamas buy dofus kamas 血管瘤 肝血管瘤 音乐剧 北京富码电视 富码电视 富码电视台 7天酒店 7天连锁酒店 7天连锁 自清洗过滤器 过滤器 压力开关 压力传感器 流量开关 流量计 液位计 液位开关 温湿度记录仪 风速仪 可燃气体检测仪 wow power leveling wow powerleveling Warcraft PowerLeveling Warcraft Power Leveling World of Warcraft PowerLeveling World of Warcraft Power Leveling runescape power leveling runescape powerleveling

10:42 PM

 
Anonymous Anonymous said...

I hit this too, with no warning of it on the Macromedia site. I couldn't believe Flash has such a bug. It's like they don't want you to make tools with it.

2:26 PM

 
Anonymous Anonymous said...

I found the clue. FLfile.write uses ANSI not UTF-8. So
In UNIX, '\n' in Windows, '\r\n' and in Mac, '\r' is put at the end of each line.

Thats why \n doesnt work in windows, but this works:

FLfile.write(filePath, "A line with linebreak.\r\n", "append");

2:28 AM

 

Post a Comment

<< Home