태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

ria/flex2008/01/18 17:52

아래 블로그에서 해결책을 찾았네요.

예전부터 저도 고심하던 버그였는데..

직접 SDK를 수정할 생각을 했었는데..(어리석었죠. 상속받아서 mx_internal을 사용할 생각을 못했었네요..)


http://flexibleexperiments.wordpress.com/2007/01/25/flex-20-tree-with-spring-loaded-folders-update/#more-16



버그 내용은 다음과 같습니다.


The bug will surface when a folder has no children and you try to close it using the expandItem function. Which in the case of the sample I use extensively.

The bug is in my opinion a Flex bug within the tree.as when tweening animation. The tree.as function buildUpCollectionEvents makes an assignment to a collection view of a null value (first line below) the next line attempts to access this value without a test. If no children exist when a folder has no children for example, the createCursor call is being done on a null object. Hence the error #1009.

 

Code from the tree.as

var children:ICollectionView = getChildren(expandedItem, iterator.view);
var cursor:IViewCursor = children.createCursor();

So what can we do when this happens. Well lucky for me the function called just before the “buildUpCollectionEvents” on the error stack is marked as internal.

mx_internal function onTweenEnd(value:Object):void

 

 

tree 노드를 isBranch 속성들을 지정해주거나 해서 폴더형태로 보여줬을 때,

나는 에러인데 닫을 때 발생하고.

 

이 분은 상속받은 Tree에서 처리를 하셨네요. try, catch로..

 

Because it’s marked internal I was able to override this and add a error handler on the extended version of the tree in order to gracefully handle it.

In order to override a function you need to add “use namespace mx_internal;” at the end of the imports. You can then override the “onTweenEnd” to control the error. The sample already contains the import “mx.core.mx_internal;”. The below code will handle the error.

override mx_internal function onTweenEnd(value:Object):void{
try{
  super.mx_internal::onTweenEnd(value);
 }
 catch(err:Error){
  //Tween failure a nasty flex bug.
  //trace(err.message);
 }
}

The bug seems after testing to be handled, and no adverse effects in doing this are noticeable.

 

 

p.s. 위에 올린 블로그 보면 모든 내용이 다 있습니다..

 

Posted by THLIFE.net

TRACKBACK http://thlife.net/trackback/50 관련글 쓰기

댓글을 달아 주세요