flash 궁금하니?
Custom 컴포넌트 3 - SWC 컴포넌트
deguls
2008. 8. 14. 16:07
출처: http://chocodonut.tistory.com/256
- Flex Library 프로젝트에서 작성한 ActionScript 코드는 자동으로 빌드된다.
3. SWC 컴포넌트 사용하기
- 이렇게 만든 SWC 컴포넌트를 Flex 프로젝트에서 사용한다.
- SWC 컴포넌트를 사용하는 방법은 3가지가 있다.
3.1 Source path에 추가해 사용하기
- 새 Flex 프로젝트를 생성한 후 Properties > Flex Build Path > Sourch path에 SWC 컴포넌트를 추가한다.
3.2 Library path에 추가해 사용하기
- 새 Flex 프로젝트를 생성한 후 Properties > Flex Build Path > Library path에 SWC 컴포넌트를 추가한다.
- Flex 프로젝트의 Components 뷰에 등록된 SWC 컴포넌트를 스테이지에 끌어다 배치한다.
3.3 flex-config.xml 파일에 추가해 사용하기
- C:\LCDS\jrun4\servers\default\flex\WEB-INF\flex\flex-config.xml 파일을 열고 86번 행에 있는
libray-path 태그 내에 SWC 컴포넌트의 경로를 추가한다.
4. Open Source Flex Components Library
- http://www.adobe.com/cfusion/exchange/index.cfm?event=productHome&exc=15&loc=en_us
- http://code.google.com/p/flexlib/
- http://flex.org/software/components
- http://www.quietlyscheming.com/blog/components/
- http://flexbox.mrinalwadhwa.com/
2008/08/04 09:06 in AIR/Flex

1. 정의
- Custom 컴포넌트를 Zip 파일과 같은 Archive 형태로 만들어 배포하는 컴포넌트이다.
- SWF 파일과 catalog.xml 파일(컴포넌트 리스트 파일)로 구성된다.
- 컴포넌트를 하나로 묶는 개념이기 때문에 배포와 사용이 편리하다.
- 컴파일된 코드를 배포하는 것이기 때문에 SWC 컴포넌트의 수정은 불가능하다. 만약 수정을 해야 할 경우에는
SWC 컴포넌트를 삭제한 후 다시 배포해야 한다.
2. SWC 컴포넌트 만들기
- SWC 컴포넌트는 Flex Library 프로젝트를 생성해서 만들어야 한다.
- ActionScript Class 파일을 추가한다.
- SWC 컴포넌트에 추가할 기능을 구현한다.
package { import mx.controls.Button; public class MyComp extends Button { public function MyComp() { super(); this.label = "My SWC Component"; this.setStyle("color", "yellow"); this.setStyle("fontSize", 14); } } }
- Flex Library 프로젝트에서 작성한 ActionScript 코드는 자동으로 빌드된다.
3. SWC 컴포넌트 사용하기
- 이렇게 만든 SWC 컴포넌트를 Flex 프로젝트에서 사용한다.
- SWC 컴포넌트를 사용하는 방법은 3가지가 있다.
3.1 Source path에 추가해 사용하기
- 새 Flex 프로젝트를 생성한 후 Properties > Flex Build Path > Sourch path에 SWC 컴포넌트를 추가한다.
3.2 Library path에 추가해 사용하기
- 새 Flex 프로젝트를 생성한 후 Properties > Flex Build Path > Library path에 SWC 컴포넌트를 추가한다.
- Flex 프로젝트의 Components 뷰에 등록된 SWC 컴포넌트를 스테이지에 끌어다 배치한다.
3.3 flex-config.xml 파일에 추가해 사용하기
- C:\LCDS\jrun4\servers\default\flex\WEB-INF\flex\flex-config.xml 파일을 열고 86번 행에 있는
libray-path 태그 내에 SWC 컴포넌트의 경로를 추가한다.
<!-- list of SWC files or directories that contain SWC files --> <library-path> <path-element>./user_classes</path-element> <path-element>./libs</path-element> <path-element>./locale/{locale}</path-element> </library-path> <!-- list of SWC files or directories to compile against but -->
<!-- to omit from linking --> <external-library-path> <path-element>./libs/playerglobal.swc</path-element> </external-library-path>
4. Open Source Flex Components Library
- http://www.adobe.com/cfusion/exchange/index.cfm?event=productHome&exc=15&loc=en_us
- http://code.google.com/p/flexlib/
- http://flex.org/software/components
- http://www.quietlyscheming.com/blog/components/
- http://flexbox.mrinalwadhwa.com/