Błogosławiony dzień 4 grudnia, kiedy to Adobe wypuścił FL2.1 za darmo na Symbiana. Na razie tylko wersja dla developerów, ale już wkrótce ma być free for all :-). W końcu mam możliwość pisania SMSów bez polskich znaków. Co na nowszych nokiach (nie wiem, jak 3rd edition) było niezłym bólem w tyłku...
Actionscript:
-
import mx.controls.*;
-
class pl.maliboo.flashlite.SimpleSMS
-
{
-
-
private static var toField:TextArea;
-
private static var bodyField:TextArea;
-
private static var sendBtn:Button;
-
-
public static var click:Function;
-
-
public static function cutAccents (text:String):String
-
{
-
var cut =
-
[
-
["ę","e"],
-
["ó","o"],
-
["ą","a"],
-
["ś","s"],
-
["ł","l"],
-
["ż","z"],
-
["ź","z"],
-
["ć","c"],
-
["ń","n"]
-
];
-
var i:Number = cut.length;
-
while (i--)
-
{
-
text = text.split(cut[i][0]).join(cut[i][1]);
-
text = text.split(cut[i][0].toUpperCase()).join(cut[i][1].toUpperCase());
-
}
-
return text;
-
}
-
-
public static function onResize ():Void
-
{
-
var margin:Number = 3;
-
var width:Number = Stage.width - 2*margin;
-
var height:Number = Stage.height;
-
toField.setSize(width, 22);
-
toField.move(margin, margin);
-
-
sendBtn.setSize(width, sendBtn.height);
-
sendBtn.move(margin, height - sendBtn.height - margin);
-
-
bodyField.move(margin, toField.y + toField.height + margin);
-
bodyField.setSize(width, sendBtn.y - bodyField.y - margin);
-
}
-
-
private static function sendHandler ():Void
-
{
-
getURL("sms:"+toField.text+"?body="+cutAccents(bodyField.text));
-
}
-
-
private static function initialize ():Boolean
-
{
-
Stage.align = "TL";
-
Stage.scaleMode = "noScale";
-
click = sendHandler;
-
-
toField = _root.createClassObject(TextArea, "toField_mc", 0);
-
bodyField = _root.createClassObject(TextArea, "bodyField_mc", 1, {multiline:true, wordWrap:true});
-
sendBtn = _root.createClassObject(Button, "sendBtn_mc", 2, {label:"Ślij"});
-
-
Stage.addListener(SimpleSMS);
-
sendBtn.addEventListener("click", click);
-
-
return true;
-
}
-
-
public static function main ():Void
-
{
-
initialize();
-
}
-
-
}
I nie zapomnijcie dziatki o wrzuceniu komponentów Button i TextArea do bebloteki.
