• TileList组件做的一个图片浏览工具


    package
    {

    import flash.display.MovieClip;
    import fl.controls.*;
    import fl.data.DataProvider;
    import fl.events.ListEvent;

    import flash.display.Loader;
    import flash.net.URLRequest;

    import flash.events.Event;


    public class Tilelist extends MovieClip
    {
    private var imagesURL:String = "";
    private var myTileList:TileList = new TileList();
    private var imagesArr:Array = new Array();
    private var arr:Array = new Array();
    public function Tilelist()
    {
    for (var i:uint = 1; i < 5; i++)
    {
    imagesArr.push({source:imagesURL + i + ".jpg", label:"Image " + i});

    }

    var dp:DataProvider = new DataProvider(imagesArr);

    // myTileList.direction = ScrollBarDirection.VERTICAL;
    myTileList.labelField ="";

    myTileList.dataProvider = dp;
    myTileList.columnWidth = 210;
    myTileList.rowHeight = 98;
    myTileList.columnCount = 3;
    myTileList.move(-50, 280);
    myTileList.addEventListener(ListEvent.ITEM_CLICK,onGetImageHandler);
    addChild(myTileList);


    }

    private function onGetImageHandler(e:ListEvent):void
    {

    for (var j:int = 1; j < 5; j++)
    {
    var loader:Loader = new Loader();
    loader.load(new URLRequest(String("p"+ j + ".jpg")));
    arr.push(loader);

    }

    if(e.item.label == "Image 1")
    {
    arr[0].x = 200;
    arr[0].y = 50;
    stage.addChild(arr[0]);
    }else if(e.item.label == "Image 2")
    {
    arr[1].x = 200;
    arr[1].y = 50;
    stage.addChild(arr[1]);
    }else if(e.item.label == "Image 3")
    {
    arr[2].x = 200;
    arr[2].y = 50;
    stage.addChild(arr[2]);
    }else if(e.item.label == "Image 4")
    {
    arr[3].x = 200;
    arr[3].y = 50;
    stage.addChild(arr[3]);
    }

    }

    }
    }

  • 相关阅读:
    Objects in this class cannot be updated outside
    操作系统原理好书推荐
    Can't initialize OCI
    比较好的GIS blog
    栅格数据开发
    arcgis 本地地图服务 silverlight 调用报错 .
    (转载)Rasterdataset Load data耗时
    网络达人梁宏达
    arcengine总结(1)栅格数据开发
    MyNPOI V1.2发布并开放源码,让.NET Excel导出将简单进行到底【转】
  • 原文地址:https://www.cnblogs.com/yanshuoistutu/p/2725293.html
Copyright © 2020-2023  润新知