代码之家  ›  专栏  ›  技术社区  ›  Emil Davtyan

在Flash中加载大图像和遮罩

  •  0
  • Emil Davtyan  · 技术社区  · 16 年前

    我正在尝试加载一个大约3000x2000像素的大图像,然后用一个小正方形遮罩它,这样以后我就可以滚动查看图像了。

    createEmptyMovieClip("container", getNextHighestDepth());
    container.createEmptyMovieClip("fullImage", container.getNextHighestDepth());
    //When I replace the above line of code with the line of code bellow the image is displayed but it still not masked.
    //createEmptyMovieClip("fullImage", getNextHighestDepth());
    
    var fullClipLoader = new MovieClipLoader();
    fullClipLoader.loadClip("fountain.jpg", fullImage);
    
    
    // Function for scrolling through the image
    fullClipLoader.onLoadComplete = function() {
        createEmptyMovieClip("mask", getNextHighestDepth());
        mask._x = 50;
        mask._y = 50;
    
        mask.beginFill(0xFF0000,50);
        mask.lineStyle(5,0xFF00FF,100);
        mask.lineTo(100,0);
        mask.lineTo(100,100);
        mask.lineTo(0,100);
        mask.lineTo(0,0);
    
        container.setMask(mask);
    /*
        fullImage._x += _level0._xmouse;
    
    
        if (fullImage._x>_level0._x) {
            fullImage._x = _level0._x;
        }
    
        if (fullImage._x<(_level0._x-(fullImage._width-_level0._width))) {
            fullImage._x = _level0._x-(fullImage._width-_level0._width);
        }
    */
    };
    
    1 回复  |  直到 12 年前
        1
  •  0
  •   heavilyinvolved    16 年前

    来自Adobe文档:

    • BitmapData对象的最大宽度和最大高度为2880像素(AS2文件)

    位图对于AS2太大。

    推荐文章