4 Replies - 8105 Views - Last Post: 09 March 2007 - 05:32 AM

#1 chosen  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 51
  • Joined: 24-July 06

MovieClip depth

Post icon  Posted 07 March 2007 - 04:29 PM

Hi and thanks for viewing this thread. I have 3 movie clips that I want to place on the stage through actionscript. The movie clips are set up in an array so they can be selected however my problem is that it seems as if they are overlapping.

var shapes:Array = new Array("square", "circle", "rectangle");
var letters:Array =new Array("alpha", "beta", "gama");
var names:Array =new Array("Barney", "Sponge Bobb", "Dora");
var myAlpha:Array=[];
var one:Number;
var two:Number;
var three:Number;
function selectalpha(){
  var minNum:Number = 0;
  //Gets the lenght of an array and returns a value
  var maxNum:Number = shapes.length;
  one = Math.ceil(Math.random()*(maxNum-minNum+1))+(minNum-1);
  //pushes the value into an array
  myAlpha.push(one);
  
   minNum = 0;
   maxNum = letters.length;
  two = Math.ceil(Math.random()*(maxNum-minNum+1))+(minNum-1);
  myAlpha.push(two);
  
   minNum = 0;
   maxNum = names.length;
  three = Math.ceil(Math.random()*(maxNum-minNum+1))+(minNum-1);
  myAlpha.push(three);
  
  pulltogether(myAlpha);
 }
trace(three);
//calls the function that will place the shapes on the stage
function pulltogether(test:Array) {
 _root.createEmptyMovieClip("Placement", 2);
 Placement.attachMovie(shapes[0],Placement.getNextHighestDepth(), {_x:0, _y:0});
 Placement.attachMovie(letters[0],Placement.getNextHighestDepth+1(), {_x:0, _y:0});
 Placement.attachMovie(names[0],Placement.getNextHighestDepth+2(), {_x:0, _y:0});
  Placement._x = 190;
  Placement._y = 50;
}


I traced my depths and I got
shapes depth=1
letters depth=1
names depth =1

For some reason if all my depths are 1 only 1 of the movie clips will display

if depth are different
shapes depth=0
letters depth=2
names depth =3

They will display correctly.???

Is This A Good Question/Topic? 0
  • +

Replies To: MovieClip depth

#2 pioSko  Icon User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: MovieClip depth

Posted 08 March 2007 - 04:06 AM

If the depths are the same, then when you attach the next movieClip it "goes over the top" of the previous movieClip.

In order for them all to be displayed, each movieClip needs to have an individual depth.
Was This Post Helpful? 0
  • +
  • -

#3 Motorman007  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 08-March 07

Re: MovieClip depth

Posted 08 March 2007 - 07:07 AM

View PostpioSko, on 8 Mar, 2007 - 04:06 AM, said:

If the depths are the same, then when you attach the next movieClip it "goes over the top" of the previous movieClip.

In order for them all to be displayed, each movieClip needs to have an individual depth.


pioSko could he use something like swapping movie clip depths?



this.swapDepths(shapes);

this.swapDepths(letters);
this.swapDepths(names );

?
Was This Post Helpful? 0
  • +
  • -

#4 pioSko  Icon User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: MovieClip depth

Posted 09 March 2007 - 03:11 AM

It is unnecessary when attaching.
Generating individual depths is enough.

Instead of .getNextHighestDepth() try a static value.. 2, 4, 6 ... etc.
Was This Post Helpful? 0
  • +
  • -

#5 Motorman007  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 08-March 07

Re: MovieClip depth

Posted 09 March 2007 - 05:32 AM

View PostpioSko, on 9 Mar, 2007 - 03:11 AM, said:

It is unnecessary when attaching.
Generating individual depths is enough.

Instead of .getNextHighestDepth() try a static value.. 2, 4, 6 ... etc.



I C..
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1