2011-02-16 5 views
0

기본적으로 플래시 명령을 사용하여 영화 클립에서 선택한 텍스트 그룹을 개별적으로 변환하는 방법이 필요합니다. 예를 들어, 단계는 내가 그냥 텍스트 항목을 선택 알고플래시의 동영상 클립을 jsfl을 사용하여 변환하십시오.

var theSelectionArray = fl.getDocumentDOM().selection; 

for(var i = 0; i < theSelectionArray.length; i++){ 

    if(theSelectionArray[i].elementType == "text"){ 
     ...  
    } 
} 

그리고 나는 무비 클립에 선택을 변환 아는 것은 :

fl.getDocumentDOM().convertToSymbol("movie clip", theName, "top left"); 

그래서 내가 루프 방법을 알 필요가 무비 클립의 각 텍스트 필드를 변환합니다.

감사합니다.

답변

1

모든 개체를 선택하고 예제에서와 같이 반복하지 않는 이유는 무엇입니까?

var startIndex = prompt("Please enter the start index", "0"); 
if (startIndex == null || startIndex.length == 0) { 
    startIndex = 0; 
}; 
startIndex = parseInt(startIndex); // Just to be on the safe side. 

fl.getDocumentDOM().selectAll(); 
var theSelectionArray = fl.getDocumentDOM().selection; 
for(var i = 0; i < theSelectionArray.length; i++){ 
    if(theSelectionArray[i].elementType == "text") { 
     fl.getDocumentDOM().selectNone(); 
     fl.getDocumentDOM().selection = [theSelectionArray[i]]; 
     fl.getDocumentDOM().convertToSymbol("movie clip", "textfield" + startIndex, "top left"); 
     startIndex++; 
    } 
} 

편집 : 위의 코드가 작동합니다. (시작 인덱스 포함)

+0

해당 스크립트의 문제점은 텍스트뿐만 아니라 현재 선택된 모든 항목으로 "n"개의 영화 클립을 생성한다는 점입니다. 예를 들어 이 내가 필요 (하지만이 작동하지 않습니다)과 비슷하다. fl.getDocumentDOM() theSelectionArray [I] .convertToSymbol ("무비 클립", "텍스트 필드"+ I, "왼쪽") ; –

+0

그것은 표적에서 벗어난 것이 아닙니다. :) 답변에 편집 된 코드를 참조하십시오. – erkmene

+0

정말 고마워요! 그것은 매력처럼 작동합니다! –

관련 문제