[转帖]as3.0 loader载入图片改变图片大小

 

?View Code ACTIONSCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package  {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.display.Loader;
	import flash.net.URLRequest;
 
	public class Main extends Sprite{
		private var photoUrl:URLRequest = new URLRequest("1.jpg");
		private var photoLoad:Loader = new Loader();
		private var contain:Sprite = new Sprite();
 
		public function Main() {
			init();
		}
		private function init():void {
			addChild(contain);
			photoLoad.load(photoUrl);
			photoLoad.contentLoaderInfo.addEventListener(Event.COMPLETE, photo_fun);
		}
		private function photo_fun(e:Event):void {
			photoLoad.content.width = photoLoad.content.width / 2;
			photoLoad.content.height = photoLoad.content.height / 2;
			contain.x = this.stage.stageWidth / 2 - photoLoad.content.width / 2;
			contain.y = this.stage.stageHeight / 2 - photoLoad.content.height / 2;
			contain.addChild(photoLoad);
		}
	}
}

content 这个属性。

转帖自:http://www.cnblogs.com/faily201/articles/2167480.html

“[转帖]as3.0 loader载入图片改变图片大小”暂时没有评论

Leave a Reply:

昵称 (必填):
电子邮箱:
个人网站:
内容 (必填):
[:firstface06:] [:firstface05:] [:firstface04:] [:firstface03:] [:firstface02:] [:firstface01:] [:face44:] [:face43:] [:face42:] [:face41:] [:face40:] [:face39:] [:face38:] [:face37:] [:face36:] [:face35:] [:face34:] [:face33:] [:face32:] [:face31:] [:face30:] [:face29:] [:face28:] [:face27:] [:face26:] [:face25:] [:face24:] [:face23:] [:face22:] [:face21:] [:face20:] [:face19:] [:face18:] [:face17:] [:face16:] [:face15:] [:face14:] [:face13:] [:face12:] [:face11:] [:face10:] [:face09:] [:face08:] [:face07:] [:face06:] [:face05:] [:face04:] [:face03:] [:face02:] [:face01:]
XHTML: 可用标签: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>