简体   繁体   English

如何从URL链接获取图像并将其用于在Flash中创建的HTML5游戏中?

[英]How can I get an image from url link and use it in HTML5 game, created in Flash?

I have my HTML5 game created in Flash and I am trying to get image from link. 我已经在Flash中创建了HTML5游戏,我正在尝试从链接中获取图像。 Let's say the image I want is at 假设我想要的图片在

http://www.flooringvillage.co.uk/ekmps/shops/flooringvillage/images/request-a-sample--547-p.jpg . http://www.flooringvillage.co.uk/ekmps/shops/flooringvillage/images/request-a-sample--547-p.jpg

In my game I already have a MovieClip with instance name pictureFromUrl . 在我的游戏中,我已经有一个MovieClip ,实例名称为pictureFromUrl So how do I set its image source the image found at the mentioned example page? 那么,如何设置其图像源为在上述示例页面中找到的图像?

this.parent.pictureFromUrl = ??

To load images inside ActionScript 3 you use the Loader class. 要在ActionScript 3中加载图像,请使用Loader类。

var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.load(new URLRequest("HERE GOES YOUR IMAGE URL"));

private function loadComplete(event:Event):void
{
     pictureFromUrl.addChild(loader.content);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何与JS / CSS / HTML5动画一起使用来获得类似动画的闪光效果? 例如PagePeel - How can I use with JS/CSS/HTML5 animation to get flash like animations? eg a PagePeel 如何将图像从 url 沿侧面输入类型文件加载到 html5 canvas? - How can I load image from url along side input type file to html5 canvas? 我无法在HTML5游戏中获得鼠标输入 - I can't get mouse input in my HTML5 game 如何使用javascript获取html5视频的缩略图? - How can I use javascript to get the thumbnail of an html5 video? 如何在不使用 Flash 的情况下在 HTML5 中复制到剪贴板? - How can I copy to clipboard in HTML5 without using flash? 如何在HTML5中没有flash的情况下将文本复制到剪贴板? - How can I copy text to the clipboard without flash in HTML5? 如何让屏幕阅读器停止将 HTML5 游戏视为文档? - How can I get a screen reader to stop treating an HTML5 game like a document? 如何从 Open Flash Chart 2 获取图像? - How can I get image from Open Flash Chart 2? 如何获取HTML以链接到浏览器(或系统)指定的URL? - How can I get HTML to link to a browser (or system) specified URL? 如何使用html / javascript使<a>链接触发嵌入式Flash对象?</a> - How can I use html/javascript to make <a> link trigger an embedded flash object?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM