특별한딸기이야기

액션스크립트 컴포넌트 본문

딸기 공부방/flex

액션스크립트 컴포넌트

특별한녀석 2008. 12. 27. 21:26

MyButton.as

package Mycontrols
{
 import mx.controls.Button;
 import mx.controls.Alert;

 public class MyButton extends Button
 {
  private var m_str : String;
  
  public function MyButton()
  {
   super();
   m_str = "";
  }
  
  public function setM_str(str : String) : void
  {
   m_str = str;
  }
  
  public function getM_str() : String
  {
   return m_str;
  }
  
  public function showStr() : void
  {
   Alert.show(m_str);
  }
 }
}

Study.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
 xmlns:nsl="Mycontrols.*">
 <mx:Script>
  <![CDATA[
   private function onClick() : void
   {
    mybutton.setM_str("This is MyButton test");
    mybutton.showStr();
   }
  ]]>
 </mx:Script>
 <nsl:MyButton label="MyButton" id="mybutton" width="100" height="100"
  click="onClick()" x="54" y="91" />
</mx:Application>

'딸기 공부방 > flex' 카테고리의 다른 글

커스텀 이벤트  (0) 2008.12.27
커스텀 프로퍼티  (0) 2008.12.27
컴포넌트를 이용한 비디오 플레이어  (0) 2008.12.27
컴포넌트 만들기  (1) 2008.12.27
http로 서버에 정보 전달하기  (0) 2008.12.27