2010-01-29 34 views
1

在Flex(v。3.5)中調試某些容器大小(即HBox)時,我注意到Variables列表中有一個變量「$ height」。

有誰知道這個變量是什麼?它被標記爲受保護的,但我不相信我可以在兒童課程中使用它。

我注意到它有時會得到與「高度」和「_height」不同的值。有誰知道這是爲什麼,它是如何繪製一個組件?

回答

2

完整MX框架源代碼在這裏你的SDK目錄中可用:

\..\sdks\3.3.0\frameworks\projects\framework\src 

私人文件說。

/* 
* This property allows access to the Player's native implementation 
* of the 'height' property, which can be useful since components 
* can override 'height' and thereby hide the native implementation. 
* Note that this "base property" is final and cannot be overridden, 
* so you can count on it to reflect what is happening at the player level. 
*/ 

它打上mx_internal,所以你需要聲明use namespace mx_internal;讓在自己的類訪問它。

+0

你知道嗎,我從來沒有想過在源頭上看:)謝謝! – bedwyr 2010-01-29 22:51:20

0

Flex覆蓋了自定義對象(如FlexSprite)中的很多方法。

在他們的內部代碼庫中,他們經常將標記爲'final'和super()的新方法聲明爲缺省方法實現。這些最終方法以'$'開頭,以便它們易於識別。

另一個例子是'$ addChild',flex具有自定義的addChild功能,但通過'$ addChild'方法在內部使用原始實現。

相關問題