bringing a movie to the top????  
Author Message
Ashish123





PostPosted: 2004-8-20 13:54:06 Top

flash-actionscript, bringing a movie to the top???? Hi

This problem could be solved by assigning proper depth to each MC. Here is
explaining the same withh few steps:

1. Assuming u have 10 MC. Now attach those to the stage using attachMovie()
2. Assign unique depth tto each MC ( say 1,2,3 ....,11)
3. Now when u click on a Particular Instance to drag then set its depth using
swapDepth(15) // 15 or the heighest depth than the given to other MC)
4. Once it stops dragging then set its swapDepth back to the orignal. But
first u need to store its inital depth using getDepth() in to a variable.

I hope this would help u !!

Ashish

 
nicname





PostPosted: 2004-8-20 14:09:00 Top

flash-actionscript >> bringing a movie to the top???? Thanks for that... but i'm not sure where to put the attachMovie() action script....
 
Sky Strider





PostPosted: 2004-8-20 14:38:00 Top

flash-actionscript >> bringing a movie to the top???? To answer your question about where to place attachMovie() you could just put
that on the first frame of the main timeline or the movie clip that the jigsaw
puzzle resides. Just make sure you don't come back to that frame unless your
re-initializing the puzzle....so put a stop() on the second frame or whatever
actions you may want on following frames...just make sure it never loops back
to frame one and no gotoAndPlay() actions point to the first frame.

If you want code to make each jigsaw piece act how the windows in Microsoft
Windows act (they stack on top of each other and keep their order, but bring
the active window to the front without losing the rest of the order, etc, etc)
then I could give it to you, although I may struggle explaining my code, lol.
If you just want to bring one piece to the front and then put it back when
done, then Ashish's way is perfectly fine.

Best of Luck ^_^

Sky Strider

 
 
nicname





PostPosted: 2004-8-20 15:02:00 Top

flash-actionscript >> bringing a movie to the top???? Sorry Guys but i'm bit jackass at times...
Does the code below go on a frame 1 on the timeline? (i'm only using 2 frames
with a stop on each, the first frame is where they do the jigsaw and the second
frame is a completed jigsaw for those who dont want to do the jigsaw and just
press a button on frame 1 to see it finished)
What replaces "myMovieClip"?
What replaces "idName" is it the name of the movie clip that I want to drag
around? (my movie clips are named "piece1" to "piece9")
What replaces "newName" is this the Indentifier name I gave each movie in the
linkage box?
And "depth" is the equilivent to the z index in html?
And do i need a line of code for each movie? (as in the code below)
And do I still need to place each movie on the stage manually? (I prosume I
would)

myMovieClip.attachMovie(idName, newName, depth);

---------------------------------------------------------------------

??????.attachMovie(piece1,pitt1,1);
??????.attachMovie(piece2,pitt2,2);
??????.attachMovie(piece3,pitt3,3);
??????.attachMovie(piece4,pitt4,4);
??????.attachMovie(piece5,pitt5,5);
??????.attachMovie(piece6,pitt6,6);
??????.attachMovie(piece7,pitt7,7);
??????.attachMovie(piece8,pitt8,8);
??????.attachMovie(piece9,pitt9,9);

 
 
Sky Strider





PostPosted: 2004-8-20 15:36:00 Top

flash-actionscript >> bringing a movie to the top???? Ok, good questions. If you look up attachMovie in the help it explains it
pretty good.

First off, yes the attachMovie() code can be placed on your first frame with a
stop() on it. The thing you need to realize is that you DO NOT want to manually
place an instance of the movieclip on the stage because that is exactly what
attachMovie() does, therefore there is no instance names created manually.
Delete all the jigsaw INSTANCES, not the movieclips in the library.

Understanding what I have just said clears it up for you to easily understand
the answers to the rest of your questions.

"myMovieClip" should be "this" in this case because you want to attach the
movie clips (jigsaw pieces) to the current movie timeline (whether thats the
main timeline or inside another movieclip). Make sense? Either way, using
"this.attachMovieClip()" will work.

"idName" is the linkage name you gave to each movie clip in the library
(which, by the way, i am happy to see you figured out on your own how to make
movie clips linked ^_^)

"newName" is the instance name you want to give to the instance you are
creating via attachMovie(). So after you have attached the movieclip you can
control the instance by this name. Like when you want to change or get its
depth you go: newName.swapDepth(15); newName.getDepth();

"depth" is most definately invisioned as z order, although i dont know if it
is the same as z index in html. Instances placed manually on the stage start at
a depth of something less than -16 000 or whatever. Thus something in depth 1
will render above something on depth 0.

As for your last two questions, yes and no. The way you did your code was laid
out correctly, but ur idName and newName were likely wrong. You do need a line
of code of each jigsaw movie but do NOT manually place the movie's as instances
on the stage as i already said.

Well i think that covers it all, i hope that helps out a ton. If anything is
unlcear, ask away and i'll try explaining it better.

Hope that helps!

Sky Strider

 
 
nicname





PostPosted: 2004-8-21 8:04:00 Top

flash-actionscript >> bringing a movie to the top???? Sorry but I must be missing something???

you can view it at http://www.mediablue.com.au/jigsaw.swf

I have a stage and in frame 1, I have 9 movies called space1 space2 and so on
till space9. I have a stop on frame1.
I have also put nine movies on the stag called piece1 and so on... so you can
drag then into place and when they get close they slide in to the exact
postion. The only problem is they go behind other pieces when your draging
them...
I have followed the help menu and what has been written in the forum and I
cant seem to attach the movies...
This is what i have done.. Removed all the movies named "piece1" to "piece9"
Then on frame 1 I've attached the script as below.
"this" has no referance any where else. but am i to guess it ties them all
together?
"brad1" is the linkage name i used with the movie "piece1"
"brad2" is the linkage name i used with the movie "piece2"
and so on... In the linkage box I have export for actionscript and export in
the first frame ticked..
"pitt1" ect is a name i've only used in this code, but I'm guessing it used to
call the movies later?
and the number is the depth order...
I'm also wondering if it was working where it would place the movies on the
stage?
The only other script is the script that i use on each movie (piece1 etc)
which at the bottom of the code below so they will drag and place...
The only other thing I have done is added the instance names in the propety
box... movie "space1" has a instance name of space1 and so on... And when the
movies "peice1 ect" were manualy placed on the stage they had an instance name
of peice1 and so on...
If you can see where i'm going wrong that would be great... If I get this
part right then I just have to swap depths, but i can work that out after i
sort this part out...
Thanks


this.attachMovie(brad1,pitt1,1);
this.attachMovie(brad2,pitt2,2);
this.attachMovie(brad3,pitt3,3);
this.attachMovie(brad4,pitt4,4);
this.attachMovie(brad5,pitt5,5);
this.attachMovie(brad6,pitt6,6);
this.attachMovie(brad7,pitt7,7);
this.attachMovie(brad8,pitt8,8);
this.attachMovie(brad9,pitt9,9);

---------------------------------
on (press) {
startDrag ();
}
on (release) {
if (substring(getProperty("", _name), 6, 2) eq substring(getProperty("",
_droptarget), 7, 2)) {
setProperty ("", _x, getProperty("/Space" add substring(getProperty("",
_name), 6, 2), _x));
setProperty ("", _y, getProperty("/Space" add substring(getProperty("",
_name), 6, 2), _y));
stopDrag ();
} else {
stopDrag ();
}
}