2010-10-25 53 views
0

的背景圖片我已經指派我的軟件HBox中的logo圖片如下 -更改HBox中

<mx:HBox id="logoBox" width="98%" textAlign="left" backgroundSize="100%" horizontalAlign="left" height="18%" backgroundImage="images/img_header_new_3-bg.jpg" verticalAlign="bottom" backgroundColor="#1573A4"> 

現在我需要和backgroundImage更改爲其他圖像上的事件。 如何做到這一點?我無法使用id'logoBox'來引用backgroundImage屬性。

回答

1

BackgroundImage是HBox的一種風格。組件創建後,您需要像這樣設置樣式:

logoBox.setStyle("backgroundImage","images/img_header_new_2-bg.jpg");