Форум Flasher.ru
Ближайшие курсы в Школе RealTime
Список интенсивных курсов: [см.]  
  
Специальные предложения: [см.]  
  
 
Блоги Правила Справка Пользователи Календарь Сообщения за день
 

Вернуться   Форум Flasher.ru > Flash > Серверные технологии и Flash

Версия для печати  Отправить по электронной почте    « Предыдущая тема | Следующая тема »  
Опции темы Опции просмотра
 
Создать новую тему  
Старый 08.06.2006, 17:53
muad вне форума Посмотреть профиль Отправить личное сообщение для muad Найти все сообщения от muad
  № 1  
Ответить с цитированием
muad

Регистрация: May 2006
Сообщений: 9
По умолчанию Панарамный скрипт

Имеется панарамный скрипт. который из любой панарамной фотки делает 3D визуализацию.
задача сделать так чтобы он работал не по клику на картинке
а автоматом медленно прокручивался..
подскажите господа кодеры. где тут что подкрутить

Код:
this.createBox = function(name:String, x:Number, y:Number, w:Number, h:Number, target:MovieClip) {
	// This function creates the rectangles that are used as masks
	if (target == undefined) {
		target = this;
	}
	var box:MovieClip = target.createEmptyMovieClip(name, this.currentDepth++);
	box._x = x;
	box._y = y;
	// Use the Drawing API to draw a rectangle.
	box.lineStyle(undefined);
	box.moveTo(0, 0);
	box.beginFill(0x000000, 30);
	box.lineTo(w, 0);
	box.lineTo(w, h);
	box.lineTo(0, h);
	box.lineTo(0, 0);
	box.endFill();
	return (box);
};
this.redrawStrips = function() {
	// Redraw (reposition) all photos.
	// Masks remain where they are.
	var tpos:Number;
	var cpos:Number = 0;
	// Create local variables to handle the
	// properties of each strip, photoList[i]:
	// mx: mask clip _x location
	// mw: mask clip _width property
	// pw: photo clip _width property
	// s: strip scaling factor
	var mx:Number;
	var mw:Number;
	var pw:Number;
	var s:Number;
	for (var i = 0; i<this.photoList.length; i++) {
		mx = photoList[i].mask._x;
		mw = photoList[i].mask._width;
		pw = photoList[i].photo._width;
		s = photoList[i].scale;
		tpos = mx-((cpos+xpos)*s);
		// Update the photo x scroll position,
		// looping it back to the start if required.
		while (tpos>mx+mw) {
			tpos -= pw;
		}
		while (tpos+pw<mx) {
			tpos += pw;
		}
		// Fill in the gap between the start and end
		// of the pano to make it appear continuous.
		if ((tpos>mx) && (tpos<mx+mw)) {
			// Duplicate for filling, left
			var alt:MovieClip = photoList[i].photo.duplicateMovieClip("alternatePhoto", 998);
			alt._x = tpos-pw;
			var altM:MovieClip = photoList[i].mask.duplicateMovieClip("alternateMask", 997);
			alt.setMask(altM);
		} else if ((tpos+pw>mx) && (tpos+pw<mx+mw)) {
			// Duplicate for filling, right
			var alt:MovieClip = photoList[i].photo.duplicateMovieClip("alternatePhoto", 998);
			alt._x = tpos+pw;
			var altM:MovieClip = photoList[i].mask.duplicateMovieClip("alternateMask", 997);
			alt.setMask(altM);
		}
		// Move the current photo clip
		photoList[i].photo._x = tpos;
		cpos += mw/s;
	}
};
// Movement control
arrow.onMouseMove = function() {
	this.isInside = this._parent._xmouse>0 && this._parent._xmouse<this._parent.viewWidth && this._parent._ymouse>0 && this._parent._ymouse<this._parent.viewHeight;
	if (this.isInside) {
		// Arrow is over the pano, so show the custom
		// arrow cursor instead of the standard mouse pointer.
		if (!this._visible) {
			Mouse.hide();
			this._visible = true;
		}
		if (this._visible) {
			// Show the left arrow or right arrow frame depending on whether
			// it is to the left or right, and make the custom cursor mouse.
			this.gotoAndStop((this._parent._xmouse<this._parent.viewWidth/2) ? "left" : "right");
		}
	} else {
		// Arrow is not over the pano, so show the standard mouse
		// pointer instead of our custom cursor.
		if (this._visible) {
			Mouse.show();
			this._visible = false;
		}
	}
};
arrow.onMouseDown = function() {
	// If mouse is down, change xpos to create the scroll effect
	// when redrawStrips( ) is called.
	this.onEnterFrame = function() {
		if (this.isInside) {
			this._parent.xpos -= ((this._parent.viewWidth/2)-this._x)/10;
			// Max moving speed.
			this._parent.redrawStrips();
		}
	};
};
arrow.onMouseUp = function() {
	this.onEnterFrame = undefined;
};
// MAIN CODE
Stage.scaleMode = "noScale";
Stage.align = "C";
// Sets quality options.
// This is of course optional, but it's really faster at LOW and MEDIUM quality settings,
// while MEDIUM looks the same as HIGH quality overall
_quality = "MEDIUM";
//
// Sets the panorama viewer options
var viewWidth:Number = 450;
// width of the view panel, in pixels
var viewHeight:Number = 400;
// height of the view panel, in pixels
var precision:Number = 8;
// precision (1 = slower/more precise, more = faster/less precise)
var viewFOV:Number = 60;
// Field-of-view angle, in degrees (1 = flat, 180 = fisheye-like)
// Starts.. sets initial values
var xpos:Number = 0;
// Displacement/offset variable. Basically how many "pixels" the pano has turned to the right.
var currentDepth:Number = 100;
// For new movieclips
var photoList:Array = [];
// "strip Subscription list" for faster reference
while (viewWidth%precision != 0) {
	viewWidth++;
}
// Makes the viewWidth coincide with strip sizes
// Creates all strips..
var boxCount:Number = 0;
var stripMask:MovieClip, stripPhoto:MovieClip;
var posX:Number, ang:Number, h:Number;
var viewTotal:Number = (viewHeight*180)/viewFOV;
for (var i = 0; i<viewWidth; i += precision) {
	// Finds the correct height/scale for this strip
	posX = ((viewWidth/2)-(i+(precision/2)));
	ang = Math.asin(Math.abs(posX/(viewTotal/2)));
	h = (Math.cos(ang)*(viewTotal/2)-viewTotal/2)*-1;
	// Creates mask box
	stripMask = this.createBox("box_"+boxCount, i, s, precision, viewHeight);
	// Duplicates photo
	stripPhoto = this.photo.duplicateMovieClip("photo_"+boxCount, 1000+boxCount);
	stripPhoto._y = -h;
	stripPhoto._yscale = stripPhoto._xscale=((viewHeight+h*2)/photo._height)*100;
	stripPhoto.setMask(stripMask);
	photoList.push({photo:stripPhoto, mask:stripMask, scale:stripPhoto._xscale/100});
	boxCount++;
}
arrow.startDrag(true);
photo._visible = false;
this.redrawStrips();
stop();

Создать новую тему   Часовой пояс GMT +4, время: 00:29.
Быстрый переход
  « Предыдущая тема | Следующая тема »  

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.


 


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


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