Masalah Flash CS3 + batch file (*.bat)

Dah ada Flash CS5.5 baru nak tulis pasal ni kan… hihih. Ape nak buat, bile jumpe masalah lagi baru cari solution.

Dari segi integrasi dgn Flash, BAT file ni biasanya digunakan untuk execute dan kill application. Kadangkala menjadi keperluan dan kadangkala supaya aplikasi Flash kita jadi lebih presentable.

Mungkin ada certain Actionscript programmer pernah dapat masalah nak execute *.bat file dalam folder fscommand. Berapa banyak kali cuba pun code dalam *.bat file tak mau jalan. Masalah ni khususnya berlaku untuk Flash CS3. Tak penah jumpa lagi masalah ini dalam Flash version lain.

Setelah mencari-cari, akhirnya jumpa solution disini. Terima kasih sangat pada programmer tersebut. Kalau banyak duit sure aku dah donate. Harap cleanlah exe yang dibagi nih… huhu.

Dalam Bahasa Melayu, ringkasan solusinya begini;

1. Letakkan file BAT dalam folder yang diberi nama ‘fscommand’ bersama dengan satu salinan file proxy.exe.
2. Tukar nama salinan file proxy.exe kepada namafilebatkau.exe
3. Dalam actionscript, macam biasa cara nak execute terpaksalah guna fscommand; fscommand(“exec”, “namafilebatkau.exe”);

Di bawah ni adalah link untuk download file berkenaan.
proxy.exe

Oh ya. Selain menyelesaikan masalah BAT tak mau proses… proxy.exe ini juga menghapuskan ‘blink’ ketika run file BAT tersebut. Presentation jadi lebih clean dan smooth.

Sekian, selamat mencuba!




Import Sound to Flash Problem

Ok, i found this problem few times before… When we tried to import sound file, often mp3 files… flash will show error telling that flash cannot read the file. Something like that. The result, sound file fail to import in.

My previous solution was converting the sound file to 44 khz 16 bit mono. But this is not practical, imagine if we deal with hundreds sound file, disaster. I googled for a solution. But before I found anything really helpfull, husband and I thought maybe I should try to install Quicktime Player. So I did.

And… tadaaa! Problem solved. So for those who get same problem… why not try to do the same :D .




How to :: Write text file with javascript and actionscript

I assume anyone who wants to use this know the basic of writing javascript and actionscript. Because I don’t have much time to describe this in details.

Proviso :: I get this from googling, asking, testing and discussing with my life partner Iqbal. So we never claim this as ‘our’ codes or method. We just reuse, manipulate, customise and you know what lah. We just hope this will help anybody like us :D .

Create input textbox, give ‘saveThisTxt’ as its instance name.
Create a button, give ‘send_button’ as its instance name.
And put this in your Flash actionscript panel

function saveTxt() {
if (saveThisTxt.text != “”) {
myText = saveThisTxt.text;
getURL(“javascript:WriteToFile(‘”+myText+”‘)”);
}
}

send_button.onRelease = function() {
saveTxt();
};

Publish the Flash file (*.swf and *.html).

Put this between <HEAD></HEAD> in your html codes.

<script>
function WriteToFile(sText) {
var fso = new ActiveXObject(“Scripting.FileSystemObject”);
var FileObject = fso.CreateTextFile(“C:\\LogFileX.txt”, true); // 8=append, true=create if not exist, 0 = ASCII
FileObject.WriteLine(sText);
FileObject.Close();

}
</script>

p/s :: This will only work in IE. And if above codes cannot work, please try and error.. good for you, :D .