I have an .aspx page that generates thumbnails. It takes an ID and returns an image with response Content-Type: image/jpeg.
我有一个生成缩略图的.aspx页面。它需要一个ID并返回一个响应Content-Type:image / jpeg的图像。
How do I display this image in Flex?
如何在Flex中显示此图像?
3 个解决方案
#1
I believe this should work:
我相信这应该有效:
<mx:Image source="http://localhost/webform.aspx?ID=1"/>
You can obviously set the source in ActionScript or make the URL a bindable string so that you can pass in the ID.
显然,您可以在ActionScript中设置源代码,或者将URL设置为可绑定字符串,以便您可以传入ID。
#2
Generally you use the Image
tag, and provided you're setting the response headers and encoding the bytes properly on the server (and you're working within the security sandbox), you should just be able to set the source
property of that tag (it need not be @Embed-ded), and be done:
通常,您使用Image标记,并且如果您正在设置响应标头并在服务器上正确编码字节(并且您在安全沙箱中工作),您应该只能设置该标记的source属性(它不需要@ Embed-ded),并且可以完成:
<mx:Image source="http://someurl.com/myimagegenerator.php?id=123" />
Are you having a problem with that approach, or is it just a general-information question?
您是否遇到过这种方法的问题,还是仅仅是一般信息问题?
#3
Take a look a Loader
看看装载机
var loader:Loader = new Loader();
loader.load(new URLRequest("http://www.yoursite.com/yourasp.aspx?img=01001"));
addChild(loader);
#1
I believe this should work:
我相信这应该有效:
<mx:Image source="http://localhost/webform.aspx?ID=1"/>
You can obviously set the source in ActionScript or make the URL a bindable string so that you can pass in the ID.
显然,您可以在ActionScript中设置源代码,或者将URL设置为可绑定字符串,以便您可以传入ID。
#2
Generally you use the Image
tag, and provided you're setting the response headers and encoding the bytes properly on the server (and you're working within the security sandbox), you should just be able to set the source
property of that tag (it need not be @Embed-ded), and be done:
通常,您使用Image标记,并且如果您正在设置响应标头并在服务器上正确编码字节(并且您在安全沙箱中工作),您应该只能设置该标记的source属性(它不需要@ Embed-ded),并且可以完成:
<mx:Image source="http://someurl.com/myimagegenerator.php?id=123" />
Are you having a problem with that approach, or is it just a general-information question?
您是否遇到过这种方法的问题,还是仅仅是一般信息问题?
#3
Take a look a Loader
看看装载机
var loader:Loader = new Loader();
loader.load(new URLRequest("http://www.yoursite.com/yourasp.aspx?img=01001"));
addChild(loader);