레이블이 flex인 게시물을 표시합니다. 모든 게시물 표시
레이블이 flex인 게시물을 표시합니다. 모든 게시물 표시

2010년 12월 6일 월요일

flex 3.0 life cycle

대충 봤는데도 좋은거 같다.

정말로 궁금해 하던 부분을 긁어 주는거 같다.

2010년 10월 1일 금요일

[ActionScript] addEventListener시 파라미터 추가

현재 상황

  • 화면상에 여러개의 버튼과 textfield를 추가
  • script로 for문을 돌려서 실행하였고 그걸 다시 line 별로 같은 line의 textfield값의 받아서 처리 해야함
  • script에서 new로 button을 생성하다보니.. addEventListener 처리를 하다보니 받을 수 있는 값은 event 밖에 없음

처리 방법

  • button 상속후 버튼에 사용할 propeties 정의 setter/getter 추가
  • script에서 for문 이용해서 button 생성시 id값 넘겨줌
  • event 처리부에서 event.currentTarget.새로정의한properties 값 받아서 처리

[code]package custom
{
 import mx.controls.Button;  public class ExtendButton extends Button
 {
 
  private var _currentId:String;  public function ExtendButton()
  {
   super();
  }
 
  public function get currentId():String {
   return _currentId;
  }
  public function set currentId(currentId:String):void {
   _currentId = currentId;
  }
 
 
 }
}[/code]

 

위 처러 만든 후에

[code]var button:ExtendButton = new ExtendButton();
 for(var i:int=1;i<10;i++) {
  button.currentId = "a"+i;
 }
 
 button.addEventListener(MouseEvent.CLICK,function(event:MouseEvent):void{
  trace(event.currentTarget.currentId)
 });[/code]

 

이렇게 만들었음

 

------------------------------------------------------------------------------

여기서 부터는 질문

 http://blog.flashplatform.kr/tag/keep-generated-actionscript

 

위의 링크방식대로 한다고 하면

 

generated라고 옵션은 줘서 as 스크립트를 전부 만들어서 거기에서 추가적으로

 

처리를 해야지 처리가 가능한거지?? ㅡㅡ;;

 

아니면 안되는건지 알고 싶습니다.

 

 

2010년 9월 14일 화요일

eclispse monkey

[code javascript] /* * Menu: Actionscript > Convention Generator * Key: M3+1 * DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript * Author: Yi Tan * MoreInfo: http://code.google.com/p/yis-eclipse-monkey-scripts-for-flash-builder/ */ /** * [What's this] * This script automatically converts input to class properties. * * For example: * * Your enter: * -propertyName:n= * * It will be converted to: * private var propertyName:Number= 0; * * * [Shortcut Key] * * Alt + 1 * * [How to use] * * Pleae check the how to slides * * http://www.slideshare.net/halfmile/convention-generator-yis-eclipse-monkey-scripts-for-flash-builder * * [Change log] * * 2009/11/11 Fix bug: fail to parse property name when there is input for the data type * 2009/11/6 Add condition checking for nil selection * 2009/10/31 First version * */ var ACCESS_TYPE_PUBLIC = "+"; var ACCESS_TYPE_PRIVATE = "-"; var ACCESS_TYPE_PROTECTED = "*"; var ALL_ACCESS_TYPES = "+-*"; var ACCESS_TYPES = {"+":"public", "-":"private", "*":"protected"}; var MEMBER_TYPE_METHOD = "method"; var MEMBER_TYPE_PROPERTY = "property"; var DATA_TYPE_DEFAULT_VALUES = { "Object":"{}", "String":'""', "Boolean":"false", "Array":"[]", "Number":"0", "int":"0", "uint":"0", "Vector":"new Vector.<>()", "XML":'""' }; var DATA_TYPE_ABBRES = { "o":"Object", "s":"String", "b":"Boolean", "a":"Array", "n":"Number", "i":"int", "u":"uint", "v":"Vector", "x":"XML" } function main() { var editor = editors.activeEditor var source = editor.source if (!editor.selectionRange) return; var range = editor.selectionRange; var offset = range.startingOffset; var text = (offset == range.endingOffset)? editor.source.split(editor.lineDelimiter)[editor.getLineAtOffset(editor.currentOffset)].replace(/^\s+|\s+$/g, ''): source.substring (offset, range.endingOffset); if (range.startingOffset == range.endingOffset) // when there is no selection offset -= text.length; if (text.length < 1) { alert("Please select your input."); return; } // auto TODO if (text == "td") { editor.applyEdit(offset, range.endingOffset - offset, "// TODO: Need Implementation "); return; } // detect property type var memberType = (text.search(/\(\)/) != -1) ? MEMBER_TYPE_METHOD : MEMBER_TYPE_PROPERTY; // add default access type if (ALL_ACCESS_TYPES.indexOf(text[0]) == -1) text = "+"+text; switch(memberType){ case MEMBER_TYPE_METHOD: // result = generateMethod(text); text = text.replace(text[0], ACCESS_TYPES[text[0]] + " function "); var dataType = text.match(/\:\w+/) if(! dataType) { text += ":void"; } else { dataType = dataType[0].replace(":",""); // parse data type abbrevations if (dataType.length == 1) { var fullDataType = DATA_TYPE_ABBRES[dataType.toLowerCase()] || dataType; // alert("fullDataType :"+fullDataType ); text = text.replace(":"+dataType, ":"+fullDataType); } } text += "\n{\n\n}" ; break; case MEMBER_TYPE_PROPERTY: // get propertyName and data type if(text.indexOf(":") != -1) { var propertyName = text.match(/\w+\:/)[0].replace(/\:/,""); var dataType = text.match(/\:\w+/)[0].replace(":",""); } else { // no input for data type var propertyName = text.match(/\w+/)[0]; var dataType = "* "; } // append declaration var declaration = " var "; if (text.indexOf("$$") != -1) // $$ -> static const { declaration = " static const "; text = text.replace(propertyName, propertyName.toUpperCase()); text = text.replace("$$", ""); } else if(text.indexOf("$") != -1) // $ -> static { declaration = " static var "; text = text.replace("$", ""); } text = text.replace(text[0], ACCESS_TYPES[text[0]] + declaration); // parse data type abbrevations if (dataType.length == 1) { var fullDataType = DATA_TYPE_ABBRES[dataType.toLowerCase()] || dataType; // alert("fullDataType :"+fullDataType ); text = text.replace(":"+dataType, ":"+fullDataType); dataType = fullDataType; } // append default value if required if (text.lastIndexOf("=") == text.length -1 ) { var defaultValue = DATA_TYPE_DEFAULT_VALUES[dataType] || "null" ; text += " "+defaultValue; } if (text.lastIndexOf("n") == text.length -1 ) { var defaultValue = DATA_TYPE_DEFAULT_VALUES[dataType] || " new "+dataType+"()" ; text = text.substr(0,text.lastIndexOf("n"))+defaultValue; } text += ";"; // auto getter and setter if(propertyName[0] == "_") { // alert("// auto getter and setter"); var accessorName = propertyName.substr(1); text += "\n\t\tpublic function get " + accessorName + "():" + dataType + " {"; text += "\n\t\t\treturn " + propertyName + ";"; text += "\n\t\t}\n\n"; text += "\t\tpublic function set " + accessorName + "("+accessorName+":" + dataType + "):void {"; text += "\n\t\t\t" + propertyName + " = "+accessorName+";"; text += "\n\t\t}\n"; } break; } // var result = "public static const " + text + ":String = '" + text.toLowerCase() + "';"; editor.applyEdit(offset, range.endingOffset - offset, text); } [/code] 원래 출처: http://code.google.com/p/yis-eclipse-monkey-scripts-for-flash-builder/
원본 저자: Yi Tan (yi2004@gmail.com)

eclipse monkey

몇가지 불편한거 추가..

setter/getter 이상한거 수정
property:Type= n -> 실행시
property:Type= new Type(); 으로 변환 되는 기능 추가

2010년 9월 10일 금요일

[flex] ContextMenu 기능 정리

1. ContextMenuItem 추가시에 사용하는 이름이 동일하면 한개만 출력된다.

2. ContextMenuItem 추가시에 사용하는 이름이 "삭제","Del" 이런거 전부 안된다.

 

위의 내용들은 디버거 써도 에러도 잡히지도 않는다. ㅡㅡ

 

이걸로 며칠을 고생했는지 ㅠㅠ

 

슬프다.