태터데스크 관리자

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

태터데스크 메시지

저장하였습니다.

Converting data from Java to ActionScript

An object returned from a Java method is converted from Java to ActionScript. BlazeDS also handles objects found within objects. BlazeDS implicitly handles the Java data types in the following table.

Java type

ActionScript type (AMF 3)

enum (JDK 1.5)

String

java.lang.String

String

java.lang.Boolean, boolean

Boolean

java.lang.Integer, int

int

If value < 0xF0000000 || value > 0x0FFFFFFF, the value is promoted to Number due to AMF encoding requirements.

java.lang.Short, short

int

If i < 0xF0000000 || i > 0x0FFFFFFF, the value is promoted to Number.

java.lang.Byte, byte[]

int

If i < 0xF0000000 || i > 0x0FFFFFFF, the value is promoted to Number.

java.lang.Byte[]

flash.utils.ByteArray

java.lang.Double, double

Number

java.lang.Long, long

Number

java.lang.Float, float

Number

java.lang.Character, char

String

java.lang.Character[], char[]

String

java. math.BigInteger

String

java.math.BigDecimal

String

java.util.Calendar

Date

Dates are sent in the Coordinated Universal Time (UTC) time zone. Clients and servers must adjust time accordingly for time zones.

java.util.Date

Date

Dates are sent in the UTC time zone. Clients and servers must adjust time accordingly for time zones.

java.util.Collection (for example, java.util.ArrayList)

mx.collections.ArrayCollection

java.lang.Object[]

Array

java.util.Map

Object (untyped). For example, a java.util.Map[] is converted to an Array (of Objects).

java.util.Dictionary

Object (untyped)

org.w3c.dom.Document

XML object

null

null

java.lang.Object (other than previously listed types)

Typed Object

Objects are serialized using Java bean introspection rules and also include public fields. Fields that are static, transient, or nonpublic, as well as bean properties that are nonpublic or static, are excluded.

Note: You can enable legacy XML support for the flash.xml.XMLDocument type on any channel that is defined in the services-config.xml file.

Note: In Flex 1.5, java.util.Map was sent as an associative or ECMA Array. This is no longer a recommended practice. You can enable legacy Map support to associative Arrays, but Adobe recommends against doing this.

flashplayer debugger download page
http://www.adobe.com/support/flashplayer/downloads.html



flashplayer uninstaller download page
http://kb2.adobe.com/cps/141/tn_14157.html


mxmlc를 이용해 플랙스 소스 컴파일중 아래와 같은 에러 발생

Error: An error occurred because there is no graphics environment available.  
Please set the headless-server setting in the Flex configuration file to true.


flex sdk에 frameworks 폴더에 flex-config.xml 파일 수정

<compiler>tag의 자식으로 아래 tag를 추가해준다.


<headless-server>true</headless-server>






[ 피곤해.. 공개하기 민망하지만... 나름 열코딩한 소스 ]

Flex Source
(upload 부분 소스)
(upload후 exception발생시 처리부분 구현 필요)

validator 부분 태그
<mx:StringValidator id="stringValidator" property="text" minLength="1" required="true" requiredFieldError="필수 기재 항목입니다."/>

//최종 validation 체크 및 업로드
private function setRegAppl(event:MouseEvent):void {
    //validation text 체크할 ID
    var listeners:Array = [tx_addr2, tx_telnoOfnum, tx_telnoNo, tx_iContent];
    var isValid:Boolean = true;
    for each(var listener:Object in listeners) {
        stringValidator.source = listener;
        vResult = stringValidator.validate();
        if(vResult.type == ValidationResultEvent.INVALID) {
            isValid = false;
        }
    }
    if(isValid) {
        //File Upload
        if(fr && StringUtil.trim(tx_fileNm.text) != "") {
            var today:Date = new Date();
            var fileName:Array = fr.name.split("."); 
            //물리 file명
            filePhysiclNm = String(Date.parse(today)) + "_" + String(Math.floor(Math.random()*10)) + '.' + fileName[1];
            var variables:URLVariables = new URLVariables();
            variables.fileMaxSize = FileCont.FILE_MAX_SIZE;
            variables.filePhysiclNm = filePhysiclNm;
            variables.uploadPath = FileCont.FILE_UPLOAD_PATH; 
    
            var urlRequest:URLRequest = new URLRequest(UrlUtil.getUrlRoot("uploadUnity.do"));
            urlRequest.method = URLRequestMethod.POST; 
            urlRequest.data = variables;
            fr.upload(urlRequest);    
        } else {
            uploadComplete();
        }
    } else {
        regFaildTxt.text = "*.필수 항목을 기재하지 않으셨습니다.";
        var timer:Timer = new Timer(3000, 1);
        timer.addEventListener("timer", returnErrorMsg);
        timer.start();
        return;
    }   
    function returnErrorMsg():void {
        regFaildTxt.text = "";
    }
}
 
//  listener
private function configureListeners(dispatcher:IEventDispatcher):void {
    dispatcher.addEventListener(Event.SELECT, fileSelect);
    dispatcher.addEventListener(Event.COMPLETE, uploadComplete);
    dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, error);
    dispatcher.addEventListener(IOErrorEvent.IO_ERROR, error);
    function error(event:*):void {
        Alert.show(event.toString(), "Error");
    }
}
         
//upload file 선택
private function fileSelect(e:Event):void {
    if(fr.size < FileCont.FILE_MAX_SIZE) {
        tx_fileNm.text = fr.name;
        fileSizeField.text = "[ " + (Math.round(fr.size / 1024)).toString() + "KB ]";
    } else {
        Alert.show("파일크기: "+(Math.round(fr.size / 1024)).toString()+"KB\n
                            파일크키는 2048KB(2MB)를 넘을 수 없습니다.", "경고");
    }
}

//파일첨부 Btn click(최초 업로드 버튼 클릭)
private function openFileBrowse(e:MouseEvent):void {
    if(!fr) {
        fr = new FileReference();
    }
    configureListeners(fr);
    fr.browse(FileCont.fileFilterArr());
}


//FileCont.fileFilterArr() 부분
public static function fileFilterArr():Array {
    var allFilter:FileFilter = new FileFilter("업로드가능파일",                                "*.jpg;*.gif;*.png;*.pdf;*.doc;*.txt;*.hwp;*.xls;*.xlsx;*.ppt;*.pptx");
    var imagesFilter:FileFilter = new FileFilter("이미지파일(*.jpg; *.gif; *.png)", "*.jpg;*.gif;*.png");
    var docFilter:FileFilter = new FileFilter("문서파일(*.pdf; *.doc; *.txt; *.hwp; *.xls; *.xlsx; *.ppt; *.pptx)",   "*.pdf;*.doc;*.txt;*.hwp;*.xls;*.xlsx;*.ppt;*.pptx");
    return [allFilter, imagesFilter, docFilter];
}


(download 부분 소스)
private function download():void {
    if (tx_fileLogicNm.text == "등록된 파일이 없습니다."){
        tx_fileLogicNm.buttonMode = false;
    }else{
        tx_fileLogicNm.buttonMode = true;
        if(!fileRef) {
            fileRef = new FileReference();
        }
        configureListeners(fileRef);

        var filePhysiclNm:String = contentData.filePhysiclNm;
        var fileLogicNm:String = contentData.fileLogicNm;
        var variables:URLVariables = new URLVariables();
        var urlRequest:URLRequest = new URLRequest(UrlUtil.getUrlRoot("JAVA SERVLET URL"));
        variables.filePhysiclNm = filePhysiclNm;
        variables.uploadPath    = FileCont.FILE_UPLOAD_PATH;
        urlRequest.method = URLRequestMethod.POST;
        urlRequest.data = variables;
        fileRef.download(urlRequest, fileLogicNm);      
    } 
}

private function configureListeners(dispatcher:IEventDispatcher):void {
    //dispatcher.addEventListener(Event.COMPLETE, completeHandler);
    dispatcher.addEventListener(Event.OPEN, openHandler);
    dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
    dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
    dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
    dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}

private function httpStatusHandler(event:HTTPStatusEvent):void {
    trace("httpStatusHandler: " + event);
}

private function cancelHandler(event:Event):void {
    trace("cancelHandler: " + event);
}

private function ioErrorHandler(event:IOErrorEvent):void {
    Alert.show("파일이 존재하지 않습니다.\n Error [:" + event.text + "]", "Error");
}

private function openHandler(event:Event):void {
    trace("openHandler: " + event);
}

private function progressHandler(event:ProgressEvent):void {
    var file:FileReference = FileReference(event.target);
    trace("progressHandler name=" + file.name + " bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal);
}

private function securityErrorHandler(event:SecurityErrorEvent):void {
    trace("securityErrorHandler: " + event);
}

private function selectHandler(event:Event):void {
    var file:FileReference = FileReference(event.target);
    trace("selectHandler: name=" + file.name + " URL=" + downloadURL.url);
}


Java Source
(commons-fileupload 사용)
(exception 처리 필요)
- upload -

        try {
            boolean isMultipart = ServletFileUpload.isMultipartContent(request);
           
            if (isMultipart) {
                FileItemFactory factory = new DiskFileItemFactory();
                ServletFileUpload upload = new ServletFileUpload(factory);
                upload.setHeaderEncoding("UTF-8");
                request.setCharacterEncoding("UTF-8");
               
                List items = upload.parseRequest(request);
                Iterator iter = items.iterator();
               
                long fileMaxSize    = 0;       //file upload 용량 제한
                String filePhysiclNm = "";    //물리파일명
                String uploadPath   = "";      //파일저장경로
               
                while (iter.hasNext()) {
                    FileItem item = (FileItem) iter.next();
                   
                    if (item.isFormField()) {
                        if(item.getFieldName().equals("fileMaxSize")){
                            fileMaxSize = Long.parseLong(item.getString());
                        } else if(item.getFieldName().equals("filePhysiclNm")) {
                            filePhysiclNm = item.getString("UTF-8");
                        } else if(item.getFieldName().equals("uploadPath")) {
                            uploadPath = item.getString("UTF-8");
                        }
                    } else {
                        if (item.getSize() < fileMaxSize) {
                            String filePath = CommonUtil.getRealPath(uploadPath + filePhysiclNm);
                            //System.out.println("filePath:::::::::"+filePath);
                            File uploadedFile = new File(filePath);
                           
                            File upDir = uploadedFile.getParentFile();
                            if(!upDir.isDirectory()){
                                upDir.mkdirs();
                            }
                            if (!uploadedFile.exists()) {
                                uploadedFile.createNewFile();
                            }
                            item.write(uploadedFile);
                        } else {
                        }
                    }
                }
            } else {
            }     
        } catch (Exception ex) {
        }

   
- download -

        String filePhysiclNm = request.getParameter("filePhysiclNm");
        String downloadPath = request.getParameter("uploadPath");        
        try {
            String filePath = CommonUtil.getRealPath(downloadPath + filePhysiclNm);
            System.out.println("filePath:::::::::"+filePath);
            File downloadFile = new File(filePath);
           
            int length = 0;
            ServletOutputStream op = response.getOutputStream();
            ServletContext context = getServlet().getServletConfig().getServletContext();
            String mimetype = context.getMimeType(filePhysiclNm);
           
            response.setContentType((mimetype != null)?mimetype:"application/octet-stream");
            response.setContentLength((int)downloadFile.length());
            response.setHeader("Content-Disposition", "attachment;filename=\"" + filePhysiclNm + "\"" );
           
            byte[] bbuf = new byte[2048];
            DataInputStream in = new DataInputStream(new FileInputStream(downloadFile));
            while ((in != null) && ((length = in.read(bbuf)) != -1)) {
                op.write(bbuf, 0, length);
            }
            in.close();
            op.flush();
            op.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }

출처 : http://livedocs.adobe.com/flex/3/html/help.html?content=validators_5.html

Ex)


<?xml version="1.0"?>
<!-- validators\PNValidatorErrMessageStyle.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <!-- Use blue for the error message. -->
    <mx:Style>
        .errorTip { borderColor: #0000FF}
    </mx:Style>

    <!-- Define the PhoneNumberValidator. -->
    <mx:PhoneNumberValidator id="pnV"
        source="{phoneInput}" property="text"
        wrongLengthError="Please enter a 10-digit number."/>

    <!-- Define the TextInput control for entering the phone number. -->
    <mx:TextInput id="phoneInput"/>
    <mx:TextInput id="zipCodeInput"/>
</mx:Application>

Tag // flex, validator

vb 라는 id를 가진 VBox 를 기준으로 자식들중 Text컴포넌트에만 접근, 

컴포넌트에 name을 준후 getChildByName를 이용해서도 가능하다... (요건 나중에~ㅋㅋ)


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="test11()">
    <mx:Script>
        <![CDATA[
            import mx.containers.VBox;
            private var tt:Text;
            private var vv:VBox;
            private function test11():void {
                var i:int;
                for(i = 0;i<vb.getChildren().length;i++) {
                   if(vb.getChildAt(i) is VBox) {
                       vv = vb.getChildAt(i) as VBox;
                       var j:int;
                       for(j = 0;j<vv.getChildren().length;j++) {
                           if(vv.getChildAt(j) is Text) {
                                tt = vv.getChildAt(j) as Text;
                                tt.text = "########### i::" + i + ", j::" + j; 
                                trace(tt.id);                    
                           }
                       }
                   }
                }
            }
        ]]>
    </mx:Script>
    <mx:VBox id="vb">
        <mx:VBox >
            <mx:Text id="test1" />
        </mx:VBox>
        <mx:VBox >
            <mx:Label id="ee" />
            <mx:Text id="test2" />
            <mx:Text id="test3" />
        </mx:VBox>
        <mx:VBox >
            <mx:Text id="test4" />
        </mx:VBox>
        <mx:VBox >
            <mx:Text id="test5" />
        </mx:VBox>   
    </mx:VBox>
</mx:Application>

 

 


http://blog.jidolstar.com/363

세부 설명 및 예제..
Tag // BlazeDS, flex, Tomcat

<참조> http://kanuwadhwa.wordpress.com


 Flex Online Compiler
http://try.flex.org/


Flex Component Explorer
http://examples.adobe.com/flex2/inproduct/sdk/explorer/explorer.html


Flex Chart Explorer
http://demo.quietlyscheming.com/ChartSampler/app.html


Flex Style Explorer
http://examples.adobe.com/flex2/consulting/styleexplorer/Flex2StyleExplorer.html


Flex Transition and Effect Explorer
http://blog.keutgens.de/download/flexEffectExplorer/current/swf/TransitionsAndEffects.html


Flex Primitive Explorer
http://www.3gcomm.fr/Flex/PrimitiveExplorer/Flex2PrimitiveExplorer.html


Flex Filter Explorer
http://www.merhl.com/flex2_samples/filterExplorer/


Flex Samples Explorer
http://flexapps.macromedia.com/flex15/explorer/explorer.mxml


Button Skin Controller
http://www.wabysabi.com/flex/enhancedbuttonskin/


Resize Manager
http://www.teotigraphix.com/explorers/ResizeManagerFX/ResizeManagerFXExplorer.html


Reflection Explorer
http://www.wietseveenstra.nl/files/flex/ReflectionExplorer/v1_0/ReflectionExplorer.html


Custom Easing function Explorer
http://www.madeinflex.com/img/entries/2007/05/customeasingexplorer.html


Color Explorer
http://kuler.adobe.com/


Flip and Rotate Explorer
http://www.alex-uhlmann.de/flash/adobe/blog/distortionEffects/effectCube/


Searching Datagrid
http://www.preterra.com/flexsamples/gridsearch/gridsearch.html

http://www.udayms.com/flex/grid/


Random Walk
http://demo.quietlyscheming.com/RandomWalk/IconWalk.html


Datagrid Row Color Component
http://www.iepl.net/DataGridRowColorSample/DataGridRowColorSample.html


Chart Range Selection Component
http://www.stretchmedia.ca/code_examples/chart_range_selection/main.html


Dual Slider
http://www.visualconcepts.ca/flex2/dualslider2/DualSlideTest.html


Advance Form
http://renaun.com/flex2/AdvancedForm/


Drag Tile
http://demo.quietlyscheming.com/DragTile/Alphabet.html


Flex Components
http://flexbox.mrinalwadhwa.com/


FlexLib Component List
http://code.google.com/p/flexlib/wiki/ComponentList


Word Information
http://mark-shepherd.com/thesaurus/




Flex vs Silverlight


출처 : http://t9t9.springnote.com/pages/601346



Flickr Mashup - http://learn.adobe.com/wiki/display/Flex/1a.+Learning+Points

Flash Media Server 3 - http://i-dreaming.com/2511420

Drag & Drop - http://blog.jidolstar.com/274

 

Flash Lite 얼라이언스 http://www.adobe.com/mobile/supported_devices/handsets.html

Flex 로 구현된 포토샵 - http://www.splashup.com/splashup/

 

Web Cam 웹 캠 제어 데모 - https://www.cynergysystems.com/blogs/page/andrewtrice?entry=capturing_still_images_from_a

Web Cam 웹 캠 제어 - http://newmovieclip.wordpress.com/2006/05/26/take-a-webcam-snapshot-in-flex-20-beta-3/

State 변화 - http://blog.jidolstar.com/178

Silverlight 와 Flex 구현사례 - http://www.smartplace.kr/blog_post_241.aspx

3D Flex UI - http://dev.getoutsmart.com/os3d/demos/videoroom/
Flex 용 물리 엔진 - http://box2dflash.sourceforge.net/

 

MS Visual C++ 6.0 환경에서 MySQL 연동하는 방법 - http://blog.jidolstar.com/250
SQLite - http://tong.nate.com/heenf22/25130378

 

온라인 사진 공유 업체들 - http://koko8829.tistory.com/244

 

Action Script 관련 예제 - http://blog.jidolstar.com/106
Action Script 속도 향상법 - http://blog.jidolstar.com/196
Flex Builder 메모리 설정 확장하기 - http://blog.jidolstar.com/83

 

UI Component 의 extends(상속) - http://blog.jidolstar.com/226
UI Component 의 속성 정리 - http://blog.jidolstar.com/260
addChild() 시 Sprite 사용법 - http://blog.jidolstar.com/86

 

화살표 동적 생성 - http://blog.jidolstar.com/188

JPG PNG Encoder - http://www.ihelpers.co.kr/programming/tipntech.php?CMD=view&TYPE=8&KEY=&SC=S&&CC=&PAGE=1&IDX=591

JPEG Encoder - http://cafe.naver.com/flexcomponent/1277

Timer 사용법 - http://blog.jidolstar.com/104
마우스 DragStart() 와 DragStop()로 만든 박스 만들기 - http://blog.jidolstar.com/138
String 의 replace 함수 - http://blog.jidolstar.com/125

 

Flex 참고 소스 자료가 많은 곳 - http://blog.jidolstar.com/tag/Flex?page=2
Flex 참고 소스 자료가 많은 곳 - http://www.ihelpers.co.kr/programming/tipntech.php?TYPE=8&AG=pg
Flex Component 모음 - http://www.afcomponents.com/components/
FlexBox(다양한 컴포넌트) - http://flexbox.mrinalwadhwa.com/

Flex 관련 사이트 모음 - http://blog.jidolstar.com/134
Flex 관련 사이트 모음 - http://blog.jidolstar.com/69
Flex Lib - http://blog.jidolstar.com/80

 

Google Map (AS2)- http://www.afcomponents.com/components/g_map/
지구에서 두지점간 거리 구하기 - http://blog.jidolstar.com/217
Google Map Flex 에 넣기 강좌 - http://www.afcomponents.com/tutorials/g_map/

 

개발자 커뮤니티
Flex Component - http://cafe.naver.com/flexcomponent.cafe 
Adobe Korea Flash Forum - http://www.flalab.com/phpBB2/ 
Directory for Adobe Flex - http://www.flex.org/


구구단.. 알고보면 어렵진않지만 알기전엔 맨땅에 헤딩??

반나절끝에 작성.. ArrayCollection에 대해 좀더 깊이 공부해야겠다..


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="set99()" layout="absolute">
 <mx:Script>
  <![CDATA[
   import mx.collections.ArrayCollection;
   public var aArray:ArrayCollection = new ArrayCollection();
   
      public function set99():void {
    for(var i:int=1; i<=9; i++){
      var obj:Object = {};
      for(var j:int=2; j<=9; j++){
       var ans:String = String(j*i);
       if((j*i)<10) {
        ans = "0" + (j*i);
       }
        obj[j] = j + " X " + i + " = " + ans;
      }
      aArray.addItem(obj); 
    }
      }
  ]]>
 </mx:Script>
 <mx:DataGrid x="19" y="10" width="601" fontWeight="bold" textAlign="center" dataProvider="{aArray}" rowCount="9">
  <mx:columns>
   <mx:DataGridColumn headerText="2단" dataField="2" />
   <mx:DataGridColumn headerText="3단" dataField="3" />
   <mx:DataGridColumn headerText="4단" dataField="4" />
   <mx:DataGridColumn headerText="5단" dataField="5" />
   <mx:DataGridColumn headerText="6단" dataField="6" />
   <mx:DataGridColumn headerText="7단" dataField="7" />
   <mx:DataGridColumn headerText="8단" dataField="8" />
   <mx:DataGridColumn headerText="9단" dataField="9" />
  </mx:columns>
 </mx:DataGrid> 
</mx:Application>