Flex 作为应用程序:如何加载图片?
我是flex新手,我习惯了flash(CS5和as3)
我试图在我的swf文件中加载图片以添加DisplacementMapFilter。
但我就是无法加载那张照片。
package
{
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
public class pano2 extends Sprite
{
public var loader_photo:Loader=new Loader();
public function pano2()
{
loader_photo.contentLoaderInfo.addEventListener(Event.COMPLETE,affichage_photo);
loader_photo.load(new URLRequest('cheval.jpg'));
addChild(loader_photo);
}
public function affichage_photo(ev:Event):void
{
}
}
}
I'm new to flex, i'm used to flash (CS5 & as3)
I'm trying to load a picture in my swf file to add a DisplacementMapFilter then.
But i'm just cant load that picture.
package
{
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
public class pano2 extends Sprite
{
public var loader_photo:Loader=new Loader();
public function pano2()
{
loader_photo.contentLoaderInfo.addEventListener(Event.COMPLETE,affichage_photo);
loader_photo.load(new URLRequest('cheval.jpg'));
addChild(loader_photo);
}
public function affichage_photo(ev:Event):void
{
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在 Flex 中执行此任务,您是否有理由尝试在 AS3 中执行此任务?
您可以使用 Mxml 轻松实现此目的:
现在使用 @Embed 确实假设您没有使用要在运行时加载的图像,但即使如此,您也可以轻松更改它。
If you are doing this in Flex is there a reason that you are attempting to do this task in AS3?
You can easily achieve this using Mxml:
Now using @Embed does assume that you aren't using an image you want to load at run time, but even so you can change that easily.