---
title: "as3 加载多张图片并修改图片大小例子"
author: "wdbk123"
date: "2012-10-29T11:50:43Z"
tags: []
categories: ["Web前端"]
slug: "as3"
draft: false
lastmod: "2012-10-29T11:50:43Z"
id: 1707210
url: "https://wdbk123.iteye.com/blog/1707210"
---

function loadHeadIcon():void {  
   loader = new Loader();

   context = new LoaderContext();  
   context.checkPolicyFile = true;

   loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onCom1);

   loader.load(new URLRequest(boatDataArr\[flag].imgurl),context);  
 

  }  
  function onCom1(e:Event):void {  
   var l:Loader=e.target.loader;  
   var bit:BitmapData=new BitmapData(l.width,l.height);  
   bit.draw(l.content);  
   var b:Bitmap=new Bitmap(bit);  
   b.width=32;  
   b.height=32;

   

   flag++;  
   if (flag&lt;boatDataArr.length) {  
    loadHeadIcon();  
   } else {  
    flag = 0;  
    loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,onCom1);  
   }  
  }