flex BorderContainer动态更换背景失败,求高手指点!!急,在线等!
BorderContainer:<s:BorderContainerwidth="900"height="600"id="bg"visible="true"horizon...
BorderContainer:
<s:BorderContainer width="900" height="600" id="bg" visible="true" horizontalCenter="0" verticalCenter="0"> </s:BorderContainer>
bg.setStyle("backgroundImage",图片路径)
哪里不对吗? 展开
<s:BorderContainer width="900" height="600" id="bg" visible="true" horizontalCenter="0" verticalCenter="0"> </s:BorderContainer>
bg.setStyle("backgroundImage",图片路径)
哪里不对吗? 展开
1个回答
展开全部
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" initialize="application1_initializeHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.controls.Alert;
[Embed(source="assets/image/1.jpg")]
public static const BLUECLOUD:Class;
protected function application1_initializeHandler(event:FlexEvent):void
{
bg.setStyle("backgroundImage",BLUECLOUD);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<s:BorderContainer width="900" height="600" id="bg" visible="true" horizontalCenter="0" verticalCenter="0">
</s:BorderContainer>
</s:Application>
希望对你有帮助!
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" initialize="application1_initializeHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.controls.Alert;
[Embed(source="assets/image/1.jpg")]
public static const BLUECLOUD:Class;
protected function application1_initializeHandler(event:FlexEvent):void
{
bg.setStyle("backgroundImage",BLUECLOUD);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<s:BorderContainer width="900" height="600" id="bg" visible="true" horizontalCenter="0" verticalCenter="0">
</s:BorderContainer>
</s:Application>
希望对你有帮助!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询