Форум 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)
-   -   loadVariablesNum (http://www.flasher.ru/forum/showthread.php?t=127594)

Altera Pars 17.07.2009 21:24

loadVariablesNum
 
Пожалуйста, помогите... Не могу разобраться... Задача такова. Есть XML. В ней прописаны пути к картинкам и текстовым файлам.
Код:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<pics>
        <path header="stech/tech1/header.png">
                <pics image="stech/tech1/logo1.png" txt = "stech/tech1/logo1.txt"/>
                <pics image="stech/tech1/logo2.png" txt = "stech/tech1/logo2.txt"/>
                <pics image="stech/tech1/logo3.png" txt = "stech/tech1/logo3.txt"/>
                <pics image="stech/tech1/logo4.png" txt = "stech/tech1/logo4.txt"/>
                <pics image="stech/tech1/logo5.png" txt = "stech/tech1/logo5.txt"/>
                <pics image="stech/tech1/logo6.png" txt = "stech/tech1/logo6.txt"/>
                <pics image="stech/tech1/logo7.png" txt = "stech/tech1/logo7.txt"/>
                <pics image="stech/tech1/logo8.png" txt = "stech/tech1/logo8.txt"/>
                <pics image="stech/tech1/logo9.png" txt = "stech/tech1/logo9.txt"/>
                <pics image="stech/tech1/logo10.png" txt = "stech/tech1/logo10.txt"/>
                <pics image="stech/tech1/logo11.png" txt = "stech/tech1/logo11.txt"/>
        </path>
</pics>

По нажатию на клипы, в которые подгрузились картинки, должна грузится соответствующая html.

Код AS1/AS2:

        _root.createEmptyMovieClip("ahp",_root.getNextHighestDepth());
        _root.createEmptyMovieClip("bigLoader",_root.getNextHighestDepth());
        _root.createEmptyMovieClip("butt",_root.getNextHighestDepth());
        _root.createEmptyMovieClip("foon",_root.getNextHighestDepth());
        xml_source = new XML();
        xml_source.ignoreWhite = true;
        xml_source.onLoad = function(success) {
                if(success) {
                trace("Congratulations!");
                count = this.firstChild.childNodes.length;
                count_2 = this.firstChild.firstChild.childNodes.length;
                trace(count);
                trace(count_2);
                newPosY = 40;
                for(j=0;j<count;j++) {
                this.Root = ahp.createEmptyMovieClip("ahp"+j,_root.getNextHighestDepth());
                this.Root._x = 90;
                //this.Root._y = -510;
                this.Text = _root.createEmptyMovieClip("txtt",_root.getNextHighestDepth());
                this.textBox = txtt.createEmptyMovieClip("txt"+j,j);
                this.Text._x = 90;
                        for(i=0;i<count_2;i++) {
                                this.xmlNode = this.firstChild.childNodes[j].childNodes[i];
                                this.newClip = this.Root.createEmptyMovieClip("new"+j+i,i);
                                this.newClip.ld = this.xmlNode.attributes.txt;
                                this.newClip.lds = String(this.newClip.ld);
                                this.newClip.head = this.firstChild.childNodes[j].attributes.header;
                                trace("Заголовок "+ this.newClip.head);
                                trace("Текст "+this.newClip.ld);
                                this.newThumb = this.newClip.createEmptyMovieClip("loads",i);
                                trace("Контейнер "+this.newThumb);
                                trace("ЛОГО "+this.firstChild.childNodes[j].childNodes[i].attributes.image);
                                this.newThumb.loadMovie(this.firstChild.childNodes[j].childNodes[i].attributes.image);
                                trace("КАРТИНКА "+this.firstChild.childNodes[j].childNodes[i].attributes.image)
                                this.textBox.loadMovie(this.newClip.head);
                                trace(this.newClip+" "+ahp["new"+j+i]);
                                line = Math.floor(i/9);
                                this.newClip._x = i%9*(80);
                                this.newClip._y = line*70 + 100;
                                trace("ЦИКЛ "+j);
                                trace("ЦИКЛ "+i)
                                this.newClip.onRollOver = function() {
                                        trace(this);
                                }
                                this.newClip.onRelease = function() {
                                        //foon.unloadMovie();
                                        foon.attachMovie("fon","fon0",100);
                                        loadVariablesNum(this.ld,this.getNextHighestDepth());
                                        bigLoader._x = 210;
                                        bigLoader._y = 100;
                                        bigLoader.createEmptyMovieClip("btn",this.getNextHighestDepth());
                                        butt.attachMovie("btn","btnn",this.getNextHighestDepth());
                                        butt._x = 740;
                                        butt._y = 105;
                                        butt.enabled = true;
                                        butt._visible = true;
                                }
                                butt.onRelease = function() {
                                        foon.unloadMovie();
                                        bigLoader.unloadMovie();
                                        this.enabled = false;
                                        this._visible  = false;
                                        trace(this.btnn);
                                        _root.butt.btnn.removeMovieClip();
                                        trace(this.btnn);
                                        geo.enabled = true;
                                        logics.enabled = true;
                                        clw.enabled = true;
                                        rival.enabled = true;
                                        proiz.enabled = true;
 
                                }
                        }
                        rrr = line+1;
                        bb = j*rrr*80;
                        this.Root._y = bb
                        trace("ОТСТУП "+bb);
                        this.textBox._y = bb+80;
 
 
                }
                                } else {
                                trace("не удалось загрузить");
                        }
 
 
        }
xml_source.load("stech/st.xml");

Происходит это здесь:
Код AS1/AS2:

this.newClip.onRelease = function() {
                                        //foon.unloadMovie();
                                        foon.attachMovie("fon","fon0",100);
                                        loadVariablesNum("stech/tech1/logo1.txt",this.getNextHighestDepth());
                                        bigLoader._x = 210;
                                        bigLoader._y = 100;
                                        bigLoader.createEmptyMovieClip("btn",this.getNextHighestDepth());
                                        butt.attachMovie("btn","btnn",this.getNextHighestDepth());
                                        butt._x = 740;
                                        butt._y = 105;
                                        butt.enabled = true;
                                        butt._visible = true;
                                }

С помощью loadVariablesNum.
Но, текст не отображается никак.
Не могу понять, в чем дело

silin 18.07.2009 00:00

не стал разбираться где что должно отображаться, но есть подозрение что ты не по делу используешь loadVariablesNum
она грузит переменные из файла в указанный левел плеера, а у тебя там this.getNextHighestDepth() - глубина мувика, т.е. если ты ждешь переменные в руте или мувике на этой глубине, то зря..
пользуй LoadVars, он удобнее для этих целей


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

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