Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 3.0 (http://www.flasher.ru/forum/forumdisplay.php?f=83)
-   -   получение фрейма по метке (http://www.flasher.ru/forum/showthread.php?t=105846)

nbno 25.12.2007 13:17

получение фрейма по метке
 
Есть ли более простые способы узнать frame number по label, чем представленные ниже?
Код:

function getLabelFrame(labelName) {
        for (var i=0; i<currentLabels.length; i++) {
                var label = currentLabels[i];
                if (labelName == label.name) {
                        return label.frame;
                }
        }
}

Код:

function getLabelFrame(labelName) {
        gotoAndStop(labelName);
        return currentFrame;
}


BlooDHounD 25.12.2007 13:42

а в хелпе что написано про метод gotoAndStop ? намекаю на прочтение информации о первом аргументе.

nbno 25.12.2007 15:36

Цитата:

frame:Object — A number representing the frame number, or a string representing the label of the frame, to which the playhead is sent. If you specify a number, it is relative to the scene you specify. If you do not specify a scene, Flash Player uses the current scene to determine the global frame number at which to go to and stop. If you do specify a scene, the playhead goes to the frame number in the specified scene and stops.
Это чем-то может помочь получить номер фрейма по названию метки?

silin 25.12.2007 16:39

см. MovieClip.currentLabels

etc 25.12.2007 16:52

silin, в первый пост загляни :)

silin 25.12.2007 18:32

ох, сори..

BlooDHounD 25.12.2007 18:54

Цитата:

frame:Object — A number representing the frame number, or a string representing the label of the frame, to which the playhead is sent. If you specify a number, it is relative to the scene you specify. If you do not specify a scene, Flash Player uses the current scene to determine the global frame number at which to go to and stop. If you do specify a scene, the playhead goes to the frame number in the specified scene and stops.
выделил

nbno 25.12.2007 19:59

По-моему, мы друг друга не понимаем...
По поводу использования имени метки в виде аргумента ясно (это было использовано во втором примере). Только проблема не в переходе на фрейм по имени метки, а в получении номера фрейма/кадра, на который ссылается метка (сам переход не столь важен).

BlooDHounD 25.12.2007 21:58

звиняюсь :) не понял :) название функции сбило с толку.

ну тогда самый просто это второй :) другого нету.

etc 26.12.2007 02:02

Первый можно усовершенствовать, закешировав результаты. «Медленно» отвечать будет только в первый раз, во все последующие вызовы уже мгновенно.


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

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