Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   маскирование в onLoadInit (http://www.flasher.ru/forum/showthread.php?t=156596)

Prior 24.05.2011 15:07

маскирование в onLoadInit
 
загружаю картинки через хмл
по циклу хочу поставить на них маску
но вот почемуто неполучаеться
посоветовали делать в onLoadInit

Код AS1/AS2:

var mcl = new MovieClipLoader();
var ml = new MovieClipLoader();
var temp = new Object();
var num = 0;
var image = [];
var code = [];
var total;
var phpfile:String;
xmlURL = 'pic/pic.xml'
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(xmlURL);
stop ();
 
 
function loadXML(loaded)
{
    if (loaded)
    {_root.phpfile = this.firstChild.attributes.phpfile;
        trace ('FILE - '+_root.phpfile);
        total = xmlData.firstChild.childNodes.length;
        for (i = 0; i < _root.total; i++)
        {
            picHolder = this.firstChild.childNodes[i];
            _root.image[i] = picHolder.attributes.image;
                        _root.code[i] = picHolder.attributes.code;
                        //trace (_root.code[i]+' - '+_root.image[i]);
                        CreateCont (i);
 
 
 
 
 
 
        }
    }
    else
    {
        content = "file not loaded!";
    }
}
 
 
 
 
function CreateCont (num) {
 
 
 
        _root.createEmptyMovieClip("cont"+num+"_mc", _root.getNextHighestDepth());
 
var mc:MovieClip = _root["cont"+num+"_mc"];
 
        mc.attachMovie("ramka","ramka_mc",1);
        mc._x=20*num;
 
        mc.createEmptyMovieClip("image_mc", 2);
        mc.image_mc._x=12;
        mc.image_mc._y=12.5;
 
 
n= mc.image_mc.getDepth();
        trace (n+' - '+mc.image_mc);
 
        mcl.addListener(temp);
        mcl.loadClip(_root.image[i], mc.image_mc);       
 
 
 
 
}
 
 
 
 
temp.onLoadStart = function ()
{
 
};
temp.onLoadProgress = function (target, bytesLoaded, bytesTotal)
{
 
};
temp.onLoadComplete = function ()
{
 
};
temp.onLoadInit = function (tgt_mc)
{
if (tgt_mc._width>283 or tgt_mc._height>178) {tgt_mc._width=tgt_mc._width*0.001;tgt_mc._height=tgt_mc._height*0.001;}
        if (tgt_mc._width<282) {
 
                n=tgt_mc._width;
                tgt_mc._width=282;
                tgt_mc._height= tgt_mc._height*282/n;
        }
        if (tgt_mc._height<177) {
                n=tgt_mc._height;
                tgt_mc._height=177;
                tgt_mc._width= tgt_mc._width*177/n;
        }
 
 
 
        tgt_mc._parent.attachMovie("maska","mask_mc",3);
        m=tgt_mc.getDepth();
        n= tgt_mc._parent.mask_mc.getDepth();
        trace (m+"  "+tgt_mc+"      "+n+"      "+tgt_mc._parent.mask_mc);
 
        tgt_mc.setMask(mask_mc);
 
 
};

для просмотра
архив с исходниками и картинками


Часовой пояс GMT +4, время: 09:50.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.