actionscript 3-在Flex中嵌入应用程序背景图像返回404在浏览器中未发现错误



我正在使用FlashBuilder3创建一个应用程序。我需要为应用程序设置一个背景图像。我试图为我的Flex应用程序嵌入背景图像,并且这个语法工作正常:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
layout="absolute" creationComplete="init()" width="468" height="400" 
fontFamily="Verdana" fontSize="10" fontWeight="bold" 
themeColor="#FFFFFF" cornerRadius="10" backgroundColor="#FFFFFF" backgroundImage="@Embed(source='../Assets/BG-468x350.gif')" borderColor="#111112" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#CDEAD0, #CDEAD0]">

上面的嵌入式图像可以正常工作,但在mozila(或任何其他浏览器)fir bug中,我注意到后台flash图像的http请求在尝试在http://arvind.abcd.com/loan/loan-advice-india/@Embed(source=%27../Assets/BG-468x350.gif%27)

我不明白为什么会发生这种情况,所以请给我建议可能的解决方案。提前感谢您在这里抽出宝贵的时间。

我不知道我是对是错,因为我不是一个普通的flex开发人员,因为我偶尔会收到任务分配给我。我的意思是,我不知道这个错误背后的原因是什么,为什么后台图像获取404的http请求没有找到错误,但我找到了另一种方法来嵌入一个没有收到http请求的后台图像,因此不会返回404未找到的错误。

我使用的另一种方式是:

  1. 首先,我将变量BackgroundImage声明为:[Bindable] [Embed(source="../Assets/BG-468x350.gif")] protected var BackgroundImage:Class;
  2. 然后使用预初始化方法init()将decled的BackgroundImage变量分配给预定义的BackgroundImage变量,该方法在<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" width="468" height="350">上decledpublic function init():void { Application.application.setStyle("backgroundImage", BackgroundImage);
    }

我提到这个解决方案是为其他可能出现类似错误的用户提供的,但如果有人知道更好的解决方案,请在这里更新。谢谢大家。

最新更新