Форум 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)
-   -   mc.startDrag(); и startDrag(mc); - это разные вещи? (http://www.flasher.ru/forum/showthread.php?t=117105)

orcpochta 19.10.2008 04:01

mc.startDrag(); и startDrag(mc); - это разные вещи?
 
Т.е. работают по разному?! :eek: :wacko:

Wolsh 19.10.2008 04:20

А где Вы нашли startDrag(mc) ? ))))

orcpochta 19.10.2008 04:25

Цитата:

Сообщение от Wolsh (Сообщение 771314)
А где Вы нашли startDrag(mc) ? ))))

startDrag function
startDrag(target:Object, [lock:Boolean, left:Number, top:Number, right:Number, bottom:Number]) : Void

Makes the target movie clip draggable while the movie plays. Only one movie clip can be dragged at a time. After a startDrag() operation is executed, the movie clip remains draggable until it is explicitly stopped by stopDrag() or until a startDrag() action for another movie clip is called.

Availability: ActionScript 1.0; Flash Player 4

Parameters
target:Object - The target path of the movie clip to drag.

lock:Boolean [optional] - A Boolean value specifying whether the draggable movie clip is locked to the center of the mouse position (true ) or locked to the point where the user first clicked the movie clip (false ).

left,top,right,bottom:Number [optional] - Values relative to the coordinates of the movie clip's parent that specify a constraint rectangle for the movie clip.

Example
The following example creates a movie clip, pic_mc, at runtime that users can drag to any location by attaching the startDrag() and stopDrag() actions to the movie clip. An image is loaded into pic_mc using the MovieClipLoader class.


Код:

var pic_mcl:MovieClipLoader = new MovieClipLoader();
pic_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg",
 this.createEmptyMovieClip("pic_mc", this.getNextHighestDepth()));
var listenerObject:Object = new Object();
listenerObject.onLoadInit = function(target_mc) {
 target_mc.onPress = function() {
 startDrag(this);
 };
 target_mc.onRelease = function() {
 stopDrag();
 };
};
pic_mcl.addListener(listenerObject);


Wolsh 19.10.2008 12:42

Так, и в чем Вы увидели разницу? Этот вариант - с использованием глобального метода, а не метода класса MovieClip. У меня работает совершенно одинаково в этом примере что startDrag(this); что this.startDrag();

aksios 19.10.2008 12:59

Разница в синтаксисе - this.startDrag(); - в 4 плеере не работал. startDrag(this); - Оставлен в 5 и up для обратной совместимости. Также как и все setProperty.

orcpochta 19.10.2008 13:18

Цитата:

Сообщение от Wolsh (Сообщение 771337)
Так, и в чем Вы увидели разницу? Этот вариант - с использованием глобального метода, а не метода класса MovieClip. У меня работает совершенно одинаково в этом примере что startDrag(this); что this.startDrag();

могу привести пример, где эти методы работают совершенно различным образом...)))
т.е. при замене строчки mc.startDrag(); на строчку startDrag(mc); получается совсем не то, что ожидалось...))

Wolsh 19.10.2008 14:11

Цитата:

могу привести пример
Так это и надо было сделать в первом посте))

orcpochta 19.10.2008 14:52

Цитата:

Сообщение от Wolsh (Сообщение 771358)
Так это и надо было сделать в первом посте))


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


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

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