Friday, June 22, 2007

For dotcomers You want to move a movie clip in front of or behind another movie clip

Problem
You want to move a movie clip in front of or behind another movie clip, button, or text field. dotcomers
Solution
FlashMX MultiRental.3pod rental sewa projector proyektor lcd infocus plasma soundsistem jakarta proudly present http://greateventsupport.com/filezilla/local-file-list/menus-and-toolbars.html
Use layers or the arrangement commands to adjust the order of instances at authoring time.
Use the swapDepths( ) method to change the stacking order of any two instances at runtime. dotcomers
Discussion
FlashMX MultiRental.3pod rental sewa projector proyektor lcd infocus plasma soundsistem jakarta proudly present http://greateventsupport.com/filezilla/proxy/site-manager.html
When you are working with multiple movie clip, button, and/or text field instances on the stage at the same time, you need to be aware of their stacking order. For example, if you have a movie clip that is supposed to animate behind a text field, you need to make sure that the text field appears in front of the movie clip. You can make these kinds of adjustments at authoring time either by placing the instances on different layers and arranging the layer order or by changing the order using the arrangement commands. You can move an instance forward or back by selecting the instance and then choosing Modify Arrange Bring Forward/Send Back/Bring to Front/Send to Back.
The authoring time techniques work just fine when you want to maintain a constant stacking order of all the instances in the movie. But when you want the order to change, you need to use ActionScript to effect that change at runtime using the swapDepths( ) method. In some cases, it is important that you be able to programmatically change the depths of instances in this way. For example, if you create a puzzle in which the user can drag the pieces around on stage, you want to make sure that the piece that is currently being dragged appears on top of all the other pieces. http://greateventsupport.com/filezilla/file-views/index.html
In order to understand how to use swapDepths( )a relatively easy methodyou first need to understand how Flash determines stacking order. For the convenience of the developer, Flash uses layers within the authoring environment. However, the exported SWF does not contain any information about layers. Instead, it knows only about depths: whole number values determining the stacking order. Every instance in the movie is assigned its own depth whether you assign it explicitly using the attachMovie( ), duplicateMovieClip( ), createEmptyMovieClip( ), or createTextField( ) methods, or whether it is done automatically for all authoring time instances. But regardless of how the instances are created, they all must have a unique depth. The depth determines the stacking order in which they appear on the stage. An instance of greater depth appears on top of an instance of lesser depth.
http://greateventsupport.com/filezilla/asciibinary/configuration.html

You can use the swapDepths( ) method to switch the depths of any two instances. You should invoke the method from one of the instances, and pass a reference to the other instance to the method as a parameter. For instance, if you want to switch the depths of two movie clips on the same timeline named mSquare and mCircle, your code could look like this:
mSquare.swapDepths(mCircle);

The preceding example could also be written:
mCircle.swapDepths(mSquare);

Both the examples result in the same thingthe two movie clip instances change positions in the stacking order.

http://greateventsupport.com/freehand/replacing-missing/resources-learning-freehand.html
There are many scenarios in which you may want to change the stacking order of instances in your movie. One common example was mentioned earlierensuring that the movie clip that is selected or being dragged appears on top of all the other instances. And another example is that of creating animations that appear to move in three dimensions. For example, if you have two movie clips that appear to spin in a loop along the z-axis (meaning they seem to move back into the screen), you need to make sure that the movie clip that is currently appearing to be nearer to the viewer has a higher depth.
Here is a simple example with two movie clip instances named circle and square on the main timeline. The two movie clips are slightly overlapping. The circle movie clip has the following actions:http://greateventsupport.com/freehand/freehand-lessons/index.html

mCircle.onPress = function():Void {
this.swapDepths(mSquare);
};

In this example, each time the user clicks the circle, the circle and square appear to change order. You can also create a slightly more intelligent system by which the circle is always brought to the front of the square when it is clicked by adding a conditional statement that uses the getDepth( ) method to compare the current depths of the two movie clips. In this slightly modified code, the depths are changed only if the depth of mCircle is not already greater than the depth of mSquare:

No comments: