LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 


Prev Previous Post   Next Post Next
  #1  
Old 12-05-2004, 04:59 PM
chup's Avatar
chup chup is offline
Registered User
 
Join Date: Dec 2001
Location: Temasek Island
Posts: 216
Rep Power: 12
chup is on a distinguished road
Dynamically assign depth

HI all, I’m making this card and have the movie to remember the card _x _y the scale etc. But I have problem with the depth.

I can assign the movie to remember the depth of every movieclip, but I have problem reassign them, is this part of the script, I wonder anyone can tell me where I go wrong..

I want the selected images to appear at the same depth level in the preview as they are dragged on stage or manipulated by the user?So, for instance, I drag a pig, then a boy on the stage, then select the pig to be on top, preview needs to display them at the same depth.

Allow me to attach other file
www.dreamance.com/download/depthMXB.zip


Let me explain some of the core code



1) The Invis button at the bottom. This first assign a depth to the movie you duplicated:



Code:
on (release, releaseOutside) {
	stopDrag();
	varHolder.itemData.push(singleData);
	// 
	// swap depth
	this["item"+varHolder.itemCount].swapDepths(this.varHolder.itemCount-1);
	// 
	// save current item name
	this.varHolder.currentGraphic = myName;
}
2) item.bound.(invisbleButton). When the movie is on the stage, the user click on the movie itself to swap depth:



Code:
on (press) {
	// start drag
	startDrag(_parent);
	// 
	// swap depth
	this._parent.swapDepths(this._parent._parent.varHo  lder.itemCount-1);
	// this._parent.swapDepths(90);
	// 
	// 
	// save current item name
	this._parent._parent.varHolder.currentGraphic = this._parent._name;
	// 
}
3) Preview Button. This is update all the movieclip position and depth etc:


Code:
on (release) {
	// 
	_parent.varHolder.outData = "";
	// 
	getNextHighestDepth();
	for (i=0; i<_parent.varHolder.itemData.length; i++) {
		_parent.varHolder.itemData[i][0] = Math.round(_parent["item"+(i+1)]._x);
		_parent.varHolder.itemData[i][1] = Math.round(_parent["item"+(i+1)]._y);
		_parent.varHolder.itemData[i][2] = Math.round(_parent["item"+(i+1)].picture._xscale);
		_parent.varHolder.itemData[i][3] = Math.round(_parent["item"+(i+1)].picture._yscale);
		_parent.varHolder.itemData[i][4] = Math.round(_parent["item"+(i+1)]._rotation);
		_parent.varHolder.itemData[i][5] = _parent["item"+(i+1)].picture._currentframe;
		_parent.varHolder.itemData[i][6] = _parent["item"+(i+1)].getDepth();
		_parent.varHolder.itemData[i][7] = _parent["item"+(i+1)]._name;
		// 
		// output into data
		_parent.varHolder.outData += _parent.varHolder.itemData[i].join("/")+"-";
	}
	// 
	// 
	_parent.gotoAndPlay("preview");
}
4) Frame 45. This will echo back the data saved, and try to reposition the movieclip:


Code:
inData = varHolder.outData.split("-");
 //trace(inData);
// 
// 
for (i=0; i<inData.length; i++) {
	duplicateMovieClip(itemShow, "itemShow"+i, i);
	inSingle = inData[i].split("/");
	// 
	 this["item"+i].trace(inSingle);
	with (this["itemShow"+i]) {
		_x = inSingle[0];
		_y = inSingle[1];
		picture._xscale = inSingle[2];
		picture._yscale = inSingle[3];
		_rotation = inSingle[4];
		picture.gotoAndStop(inSingle[5]);
		swapDepths(inSingle[6]);
		// _name;
	}
}
// 
// 
// 
stop();

Thanks in advance
__________________
http://www.dreamance.com
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically assign button functions fhickler Actionscript 2.0 3 06-15-2007 03:49 PM
Storing dynamically loaded images/text Leao General Flash 1 09-28-2006 01:28 AM
Window Component depth issues? yossarian Actionscript 2.0 1 04-05-2006 03:15 PM
dynamically attach duplicated MC to dynamically created Parent debonaireFlash Flash MX 1 07-09-2005 10:25 PM
trouble with depth levels Chadrik Flash 5 Actionscript 0 05-19-2001 08:43 PM




All times are GMT. The time now is 06:44 AM.