'팁&테크/ActionScript3'에 해당되는 글 24건
- 2014.08.27 Checkbox label 에 text 스타일 적용하기
- 2014.07.28 exit 함수
- 2014.07.28 bin2hex, hex2bin 함수
- 2014.07.28 Pure AS3 에서 간단하게 Alert 띄우는 클래스
2014. 8. 27. 18:34
Checkbox label 에 text 스타일 적용하기
2014. 8. 27. 18:34 in 팁&테크/ActionScript3
import fl.controls.CheckBox; var checkBox:CheckBox = new CheckBox(); checkBox.x = 100; checkBox.y = 100; addChild(checkBox); var myFormat:TextFormat = new TextFormat(); myFormat.font = "Arial"; myFormat.size = 14; myFormat.bold = true; myFormat.color = 0xFF0000; //red checkBox.textField.autoSize = TextFieldAutoSize.LEFT; checkBox.setStyle("textFormat", myFormat); checkBox.label = "Hello world, it's a beautiful day! Isn't it?";
2014. 7. 28. 14:15
exit 함수
2014. 7. 28. 14:15 in 팁&테크/ActionScript3
public static function applicationExit():void { var exitingEvent:Event = new Event(Event.EXITING, false, true); NativeApplication.nativeApplication.dispatchEvent(exitingEvent); if(!exitingEvent.isDefaultPrevented()) { NativeApplication.nativeApplication.exit(); } }
2014. 7. 28. 14:14
bin2hex, hex2bin 함수
2014. 7. 28. 14:14 in 팁&테크/ActionScript3
package { import flash.utils.ByteArray; public class StringHexConverter { public static function encode(value:String):String { var ba:ByteArray = new ByteArray(); ba.writeUTFBytes(value); var len:uint = ba.length; var s:String = ""; for(var i:uint=0;i<len;i++) { s += ba[i].toString(16); } return s; } public static function decode(value:String):String { var ba:ByteArray = new ByteArray(); var len:uint = value.length; for(var i:uint=0;i<len;i+=2) { var c:String = value.charAt(i) + value.charAt(i+1); ba.writeByte(parseInt(c, 16)); } return ba.toString(); } } }
2014. 7. 28. 14:13
Pure AS3 에서 간단하게 Alert 띄우는 클래스
2014. 7. 28. 14:13 in 팁&테크/ActionScript3
package { import flash.html.HTMLLoader; public class AlertNative { // invokes an alert box public static function alert(message:String):void { var _alertDispatcher:HTMLLoader = new HTMLLoader(); _alertDispatcher.loadString("<!DOCTYPE html><html lang='en'><head><meta charset='utf-8'>" + "<title></title><script></script></head><body></body></html>"); _alertDispatcher.window.alert(message); } // invokes a confirm box public static function confirm(message:String):Boolean { var _alertDispatcher:HTMLLoader = new HTMLLoader(); _alertDispatcher.loadString("<!DOCTYPE html><html lang='en'><head><meta charset='utf-8'>" + "<title></title><script></script></head><body></body></html>"); return _alertDispatcher.window.confirm(message); } // invokes a prompt box public static function prompt(message:String,defaultVal:String=""):String { var _alertDispatcher:HTMLLoader = new HTMLLoader(); _alertDispatcher.loadString("<!DOCTYPE html><html lang='en'><head><meta charset='utf-8'>" + "<title></title><script></script></head><body></body></html>"); return _alertDispatcher.window.prompt(message, defaultVal); } } }