![]() |
|
||||||||||
|
|||||
|
Регистрация: Aug 2015
Сообщений: 2
|
Пытаюсь самостоятельно освоить Flash
Нужно "поднять" версию проигрывателя готовой игры. При компиляции Flash6 все работает. В Flash7 спрайт стоит на месте... Дошел до момента: b = _parent.getBounds(_parent); в 6-ке trace ("b-"+b) дает b- в 7-ке trace ("b-"+b) дает b-undefined Соответственно дальше не работает. Кто может подсказать , как исправить? Сильно не пинайте, я только только начал заниматься.... |
|
|||||
|
Вы сейчас, наверное , пошутили так?
Как вы предполагаете полстороннему человеку искать место несрабатывания кода? В любом случае, вы как-то не так вызываете этот метод, ибо: getBounds (MovieClip.getBounds method)
public getBounds(bounds:Object) : Object
Returns properties that are the minimum and maximum x and y coordinate values of the movie clip, based on the bounds parameter.
Note: Use MovieClip.localToGlobal() and MovieClip.globalToLocal() methods to convert the movie clip's local coordinates to Stage coordinates, or Stage coordinates to local coordinates, respectively.
You can extend the methods and event handlers of the MovieClip class by creating a subclass.
Availability: ActionScript 1.0; Flash Player 5
Parameters
bounds:Object - The target path of the Timeline whose coordinate system you want to use as a reference point.
Returns
Object - An object with the properties xMin, xMax, yMin, and yMax.
Example
The following example creates a movie clip called square_mc. The code draws a square for that movie clip and uses MovieClip.getBounds() to display the coordinate values of the instance in the Output panel.
this.createEmptyMovieClip("square_mc", 1);
square_mc._x = 10;
square_mc._y = 10;
square_mc.beginFill(0xFF0000);
square_mc.moveTo(0, 0);
square_mc.lineTo(100, 0);
square_mc.lineTo(100, 100);
square_mc.lineTo(0, 100);
square_mc.lineTo(0, 0);
square_mc.endFill();
var bounds_obj:Object = square_mc.getBounds(this);
for (var i in bounds_obj) {
trace(i+" --> "+bounds_obj[i]);
}
The following information appears in the Output panel:
yMax --> 110
yMin --> 10
xMax --> 110
xMin --> 10
|
|
|||||
|
Регистрация: Dec 2014
Сообщений: 312
|
dark256, можно так писать
В данном случае bounds посчитается относительно stage. По крайней мере в ActionScript 3. |
|
|||||
|
Разве? По-моему посчитается относительно того-же clip, ведь в данном моменте можно сосчитать getBounds даже не добавляя clip в отображение.
|
|
|||||
|
Цитата:
|
|
|||||
|
Регистрация: Dec 2014
Сообщений: 312
|
samana, caseyryan, спасибки, только сейчас начал толком понимать как этот метод работает
![]() |
|
|||||
|
Я про то что, на выходе метода - объект.
Соотв трэйс объекта - неверно. Надо трэйсить его св-ва таки. А к какой системе координат там что цеплять - уже другая история. |
![]() |
![]() |
Часовой пояс GMT +4, время: 01:32. |
|
|
« Предыдущая тема | Следующая тема » |
|
|