Confirm 창 Yes ? No?

/* JavaScript 처럼 yes를 선택하면 Flow를 계속 타고 no를 선택하면 정지하는 방법입니다. */
/* Flex에서는 기본적으로 다른 함수를 호출하여 처리합니다. 이렇게 처리 하면 Flow의 변수처리 및 소스가 복잡해지는 문제가 발생합니다. 이에 다음과 같이  alert.show() 메소드에서 다른 메소드를 호출하지 않고 직접 확인처리하는 방법입니다.
 - 좋은 정보를 제공해준 오스템임플란트 이상준씨께 감사드립니다. -
*/

    Alert.show("저장 하시겠습니까?", "완료 여부를 선택하세요 ", Alert.YES|Alert.NO, this,
                function alertClick(e:CloseEvent){
                 if(e.detail == Alert.YES){
                       Alert.show("완료처리 되었습니다.");
                        //처리 프로세스를 기술 합니다.
                }

 

by 미소가인 | 2009/08/24 18:02 | 트랙백 | 덧글(0)

콤보박스에 XML 적용하기

콤보박스에 XML 적용하기 
http service 를 통해 가져온 데이타를 XML로 변경한후 콤보박스에 적용하였다.
     
private function getSapUpsoAllHandler(event:ResultEvent):void {       
    //cb01.dataProvider = event.result.item;    //요건안됨
    xmlResult = event.result as XML;             //요렇게 해야함.
    cb01.dataProvider = xmlResult.item;         //콤보박스에 적용하기.
}

 <!-- 서버 연결부분 -->
 <mx:HTTPService id="getSapUpsoAll"
  url="/main/getUpsoDamdang.do?method=getSapUpsoAll"
  useProxy="false"
  showBusyCursor="true"
  result="getSapUpsoAllHandler(event);"
  fault="faultHandler(event);"
  resultFormat="e4x"
  />


        <mx:ComboBox width="100" id="cb01"
         dataProvider="{getSapUpsoAll.lastResult.item}"
         labelField="@label"
         >
         </mx:ComboBox>

by 미소가인 | 2009/05/15 16:52 | Flex | 트랙백 | 덧글(0)

html에서 flash 함수호줄하기 , tabbar 탭이동

0.문제발생
    tabbar 에서 tab이동을 html 에서 컨트롤 하려하였음.
    같은 페이지 내에 플래시 Object가 있을때는 ExternalInterface.addCallback() 메소드가 잘 작동하나, 같은 페이지내에     
    플래시 Object가 없을경우  stack overflow 가 발생하였음.  
  • [html] html 내 "FlashVars", "파라메터명=파라메터값", 을 embed 부분에 추가한다.
  • [html] tabbar 네비게이션시 속도를 빠르게 처리
  • [flex]  html에서 넘어온 파라메터를 받아 네비게이션 이동
  • [flex]  html <-> flex 간 호출 처리


1.HTML 부분
//html내 flashObject명 객체를 가져옵니다.
var fp = document.getElementById(flashObject명');      
 
 //탭 메뉴를 불러 온다. ini_i는 tab버튼 번호
 function CallFlash(int_i){
    // flashObject가 있을 경우 - 즉, 같은 페이지내에 있을경우 Flex에서 직접 moveTab() 함수를 호출한다.
  if(fp){
   fp.moveTab(int_i);
  }else{
   //다른페이지에서 호출할경우 tab파라메터를 넘긴다.(java단에서  html 내의 flash obejct 선언부 파라메터로 처리토록해야함)
   location.replace('/info.do?method=doOrdInfo'+'&tab='+int_i);
  }
 }

//Flash Object 부분 tab파라메터 처리 - 언어별로 알아서 처리함
         AC_FL_RunContent(
           "FlashVars", "tab=$tab",
            .
            .
            .
        )
// --------- 여기 까지 html 선언은 끝 ------------

2.Flex 부분    
    //html에서 Flex메소드를 바로 호출할경우 - 같은 페이지에서 넘기는경우
   if(ExternalInterface.available){
      ExternalInterface.addCallback("moveTab",moveTab);
   }

    //tap파라메터를 넘겨서 받을경우 - 다른페이지에서 redirection으로 넘기는경우 
   if(parameters.tab >= 0){   
    moveTab(parameters.tab);
   }

    public function moveTab(tab:int):void {
     //Alert.show(parameters.tab);  
    //해당 탭으로 이동
     viewstack1.selectedIndex=tab;
    }

2.처리에 사용된 함수 
    ExternalInterface.addCallback()    //flex

//    function callMe(name:String) :String {
//        return "busy signal =) ";
//    }
//    ExternalInterface.addCallback("myFunction", callMe);
    

3.삽질후기
html에서 변수로 받아서 onload() 를 써서 html  onload 시 처리 하려 하였으나
flash obejct가 자꾸 Error가 발생하였음.
html이 로드완료되더라고 flash는 다 완료가 되지 않은듯함

by 미소가인 | 2009/04/24 18:56 | Flex | 트랙백 | 덧글(0)

Evnent 발생시 Object 전달

1.이벤트 발생
<ns1:DateField_KR id="start_dt" width="110" click="dateRangeCheck(event)"/>

2.처리 함수

private function dateRangeCheck(event:Event):void{
        //DateField : 오브젝트 객체가 DateField이기 때문이다, 
        //currentTarget : click 이벤트가 발생한 Object
      var _start_dt:DateField = event.currentTarget;            
   
   //DateFile의 속성적용 예 - 날짜 제한 selectableRange  프로퍼티를 설정하였음
   _start_dt.selectableRange = {rangeStart: new Date(2009,12,25), rangeEnd: new Date()};
 }

3.삽질후기
event Object 를 id 값으로만 처리 하려 해서 삽질하였습니다.(무지몽매하였음)

by 미소가인 | 2009/04/23 10:20 | Flex | 트랙백 | 덧글(0)

Flex XML 을 XMLList로 변환해서 사용해보자

package {
import flash.display.Sprite;

public class XMLListExample extends Sprite {
private var books:XML;

public function XMLListExample() {
books = <books>
<book publisher="Addison-Wesley" name="Design Patterns" />
<book publisher="Addison-Wesley" name="The Pragmatic Programmer" />
<book publisher="Addison-Wesley" name="Test Driven Development" />
<book publisher="Addison-Wesley" name="Refactoring to Patterns" />
<book publisher="O'Reilly Media" name="The Cathedral & the Bazaar" />
<book publisher="O'Reilly Media" name="Unit Test Frameworks" />
</books>;

showBooksByPublisher("Addison-Wesley");
}

private function showBooksByPublisher(name:String):void {
var results:XMLList = books.book.(@publisher == name);
showList(results);
}

private function showList(list:XMLList):void {
var item:XML;
for each(item in list) {
trace("item: " + item.toXMLString());
}
}
}
}

by 미소가인 | 2009/04/15 18:13 | Flex | 트랙백 | 덧글(0)

로딩중 커서 (Busy Cursor) 사용법 3가지

setCursor and removeCursor methods of CursorManager

Maybe you know setBusyCursor and removeBusyCursor methods of CursorManager, but setCursor and removeCursor are more flexible. you can prepare a custom class , representing and embedding a cursor swf, as a parameter of setCursor, just like:

[Embed(source="assets/hourglass.swf")]public var HourGlassAnimation:Class;
CursorManager.setCursor(HourGlassAnimation);CursorManager.removeCursor(CursorManager.currentCursorID);

style of CursorManager

it’s a easier way. CursorManager has a style called “busyCursor”. So what you should do is , changing to your own class at the begginning of application, e.g. in preinitialize event hanler of Application, like:

StyleManager.getStyleDeclaration(”CursorManager”).setStyle(”busyCursor”,myBusyCursor); //myBusyCursor is class, embedding cursor swf

CSS

i think CSS must be the easiest way.

CursorManager
{
busyCursor: Embed(”../libs/cur.swf”);
}

Put it in css file or whereever you like. no problem.

출처:구글링

by 미소가인 | 2009/03/26 15:06 | 트랙백 | 덧글(0)

XML을 이용한 HttpService 연결


<xml />
<result>
        <now>날짜</now>
        <month>월</month>
</result>
위 xml파일에서 데이타를 가져와서 로컬에 변수에 적용할때 예시

// end_dt :  date콘트롤 ,월,요일을 한글로 변경했다.

<mx:DateField  yearNavigationEnabled="true"  formatString="YYYY/MM/DD" id="end_dt" width="110"
 monthNames="['1월', '2월', '3월', '4월', '5월','6월', '7월', '8월', '9월', '10월', '11월','12월']"
 dayNames="['일','월', '화', '수', '목', '금', '토']" />


//getDate : httpService id명
 <!-- 날짜 가져오기 -->
 <mx:HTTPService id="getDate"
  url="http://localhost/getDate.do?method=getDate"
  useProxy="false"
  result="resultHandler(event);"  
  fault="Alert.show('데이타를 가져오는중 에러가 발생하였습니다.')"
  />

//lastResult : 가져온데이타

end_dt.text=getDate.lastResult.result.now;
end_month.text=getDate.lastResult.result.month;

변수로도 세팅이 가능하다.

by 미소가인 | 2009/03/26 14:57 | Flex | 트랙백 | 덧글(0)

◀ 이전 페이지          다음 페이지 ▶