Форум 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)
-   -   цикличное движение (http://www.flasher.ru/forum/showthread.php?t=112743)

StachelDraht 06.06.2008 16:46

цикличное движение
 
Привет!
Делаю баннер который выдирает информацию из xml файла (картинки и ссылки).
Все картинки должны циклически прокручиваться. Подскажите, как это осуществить.
Вот код, того что написано на данный момент:
Код:

function countXML(loaded) {
    if (loaded) {
        var ch_nodes:Array = xml_doc.childNodes[0].childNodes;
        for (var i = 0; i<ch_nodes.length; i++) {
            _root.createEmptyMovieClip("mc"+i,_root.getNextHighestDepth());
            _root['mc'+i].createEmptyMovieClip("container",_root.getNextHighestDepth());
            _root['mc'+i].container.loadMovie(ch_nodes[i].childNodes[0].firstChild.nodeValue);
            _root['mc'+i]._y = i*82;
                        _root['mc'+i].onEnterFrame = function ()
                        {
                                this._y -= 0.3;
                        };
                        _root['mc'+i].onRollOver = function ()
                        {
                                this.stop;
                        };
            _root['mc'+i].link=ch_nodes[i].childNodes[1].firstChild.nodeValue;
            _root['mc'+i].onRelease = function() {
                getURL(this.link,"_blank");
            };
        }
    } else {
        trace("Can't load file");
    }
}
xml_doc = new XML();
xml_doc.ignoreWhite = true;
xml_doc.onLoad = countXML;
xml_doc.load("data.xml");

и жедательно что бы при наведении на картинку анимация останавливалась.
Код:

                        _root['mc'+i].onRollOver = function ()
                        {
                                this.stop;
                        };


Спасибо!

Волгоградец 06.06.2008 17:46

stop () останавливают временную шкалу клипа. Он не может остановить то, что вы сами ему задаете.
Код:

_root['mc'+i].onEnterFrame = function () {
  this._y -= 0.3;
  this.onRollOver = function (){
      delete this.onEnterFrame
  }
};


StachelDraht 07.06.2008 10:34

тогда останавливается только одна картинка, все остальные едут дальше

Волгоградец 07.06.2008 10:50

Код:

for (var i = 0; i<ch_nodes.length; i++) {
  _root.createEmptyMovieClip("mc"+i,_root.getNextHighestDepth());
  _root['mc'+i].createEmptyMovieClip("container",_root.getNextHighestDepth());
  _root['mc'+i].container.loadMovie(ch_nodes[i].childNodes[0].firstChild.nodeValue);
  _root['mc'+i]._y = i*82;
  _root['mc'+i].onEnterFrame = function () {
      this._y -= 0.3;
      this.onRollOver = function (){
      delete this.onEnterFrame
      }
  };           
  _root['mc'+i].link=ch_nodes[i].childNodes[1].firstChild.nodeValue;
  _root['mc'+i].onRelease = function() {
      getURL(this.link,"_blank");
  };
}



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

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