µðÆúÆ® properties ÀÇ ÀÛ¼º
[DefaultProperty] metadata tag ¸¦ »ç¿ëÇØ, ActionScript ÄÄÆÛ³ÍÆ®ÀÇ µðÆúÆ® properties ¸¦ Á¤ÀÇÇÒ ¼ö ÀÖ½À´Ï´Ù. µðÆúÆ® properties ¸¦ MXML ·Î ÄÄÆÛ³ÍÆ® ű×ÀÇ ÀÚ½Ä (child) ű׷μ properties ¸íÀ» ÁöÁ¤ÇÏ´Â ÀÏ ¾øÀÌ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ´ÙÀ½ÀÇ Label ÄÁÆ®·ÑÀÇ ¿¹¸¦ Âü°í·Î ÇØ ÁÖ¼¼¿ä.
<! -- ´ÙÀ½ÀÇ 3 °³ÀÇ Label ÄÁÆ®·ÑÀº °°Àº ±â´É -->
<! -- ÅÂ±× ¼Ó¼ºÀ» »ç¿ëÇØ ÅØ½ºÆ® properties ¸¦ ¼³Á¤ÇÑ´Ù -->
<mx:Label text="Hello"/>
<! -- ÀÚ½Ä (child) ű׸¦ »ç¿ëÇØ ÅØ½ºÆ® properties ¸¦ ¼³Á¤ÇÑ´Ù -->
<mx:Label>
<mx:text>Hello</mx:text>
</mx:Label>
<! -- µðÆúÆ® properties ¸¦ »ç¿ëÇØ ÅØ½ºÆ® properties ¸¦ ¼³Á¤ÇÑ´Ù -->
<mx:Label>
Hello
</mx:Label>
Label ÄÁÆ®·ÑÀº,text properties ¸¦ µðÆúÆ® properties ·Î¼ Á¤ÀÇÇÕ´Ï´Ù. µû¶ó¼, Label ÄÁÆ®·ÑÀÇ 3 ¹øÂ°ÀÇ ¿¹¿¡¼´Â,text properties ¸¦ ¼³Á¤ÇØ ÀÖ½À´Ï´Ù¸¸, ÅÂ±× Á¤ÀÇ¿¡ <mx:text> ÀÇ ÀÚ½Ä (child) űװ¡ ¾ø½À´Ï´Ù.
´ÙÀ½ÀÇ ¿¹ÀÇ °°°Ô, ActionScript ÄÄÆÛ³ÍÆ®·Î [DefaultProperty] metadata tag ¸¦ »ç¿ëÇØ, µðÆúÆ® properties ¸¦ Á¤ÀÇÇÒ ¼ö ÀÖ½À´Ï´Ù.
package myComponents
{
import mx.containers.HBox;
[DefaultProperty("text")]
public class MyComponent extends HBox {
private var _text:String;
public function set text(value:String) :void {
if (value! =null)
_text=value;
}
}
}
´ÙÀ½ÀÇ ¿¹ÀÇ °°°Ô, MXML ·Î µðÆúÆ® properties ¸¦ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.
<? xml version="1. 0"? > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents. *"><MyComp:MyComponent>Hello</MyComp:MyComponent></mx:Application>
ActionScript Ŭ·¡½º¸¦ MXML ÄÄÆÛ³ÍÆ®ÀÇ ·çÆ® ű׷μ »ç¿ëÇϰí ÀÖ´Â °æ¿ì, Flex ¿¡¼´Â µðÆúÆ® properties ¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù. ÀÌ °æ¿ì´Â, ´ÙÀ½ÀÇ ¿¹ÀÇ °°°Ô, ÀÚ½Ä (child) ű׸¦ »ç¿ëÇØ properties ¸¦ Á¤ÀÇÇÒ Çʿ䰡 ÀÖ½À´Ï´Ù.
<? xml version="1. 0"? > <MyComp:MyComponentxmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents. *"><mx:text>Hello</mx:text></MyComp:MyComponent>
