Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   Общие вопросы о Flash (не затрагивающие ActionScript) (http://www.flasher.ru/forum/forumdisplay.php?f=60)
-   -   JSFL shape.isGroup не работает (http://www.flasher.ru/forum/showthread.php?t=121356)

chingachgoog 13.02.2009 20:26

JSFL shape.isGroup не работает
 
Код:

fl.outputPanel.clear ();
var curElement=fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0]
fl.trace("элемент "+curElement.elementType+" группирован? "+curElement.isGroup)

Рисуем любую фигуру (прямоугольник) и проверяем - работает только если ВРУЧНУЮ выделять нужный элемент.

Изменяем:

Код:

fl.outputPanel.clear ();
fl.getDocumentDOM().selectNone()
fl.getDocumentDOM().selection=[fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0]]
var curElement=fl.getDocumentDOM().selection[0]
fl.trace("элемент "+curElement.elementType+" группирован? "+curElement.isGroup)

Работает.

add:

NB! (или да здравствует святой хелп от адоба!)

Undocumented JSAPI feature: isGroup property is available for any type of stage Element, not only for shapes

add2:

Ага, еще немного проясняется насчет шейпов, оказывается шейпами могут быть вовсе и не шейпы:
http://livedocs.adobe.com/flash/9.0/...=00004384.html
Цитата:

Сообщение от комметарии святого хелпа адоба
As soon as you group any set of elements on stage, they become a "shape" which is a group. The contents of the group would be a symbol and a text element, in this case. But the group itself is considered a shape.


To check an object's type, you display its constructor or use the instanceof operator. These are standard JS tools that are not unique to the flash JS API.

Код:

var obj = fl.getDocumentDOM().selection[0];
fl.trace("selected obj is a Shape: " + (obj instanceof Shape));
fl.trace("constructor function for selected obj:\n\n" + obj.constructor + "\n");


add3:

В общем только в одном месте я нашел правдоподобное объяснение феномену:
http://dynamicflash.com/jsfl/#Shape
Цитата:

Properties
Name____________Description
isGroup ............... Returns true if selected element is a group
Но, почему это срабатывает, только когда ссылка на элемент получена не напрямую, а только из массива selection - я пока не понял.


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

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