Question : Calling multiple dynamically created MCs

I am trying to add a listener to one button, that will access various other movieclips (playing the 2nd frame to the end frame) of multiple movieClips (specifically: mc4, mc5, mc6, mc7).

In line 72, I am able to specify the correct mc instance and verify via a trace statement, but I really want to gotoAndPlay on frame two for mc4, mc5, mc6, mc7. Should be simple, but it isn't so far.

The "mssMC.gotoAndPlay(2);" code works fine for the MC instance I click on, but I also want to add the other instances. There will be 5 different MCs that will trigger a similar effect, each calling multiple dynamically generated MCs.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
var tempCounter:uint = 11;
var tempX:Number = 406.125;// Determined this based on the location of the 4th image in row 2
var tempY:Number = 108;
var tempScale:Number = .8725;
var tempVertical:Number = 91;
var tempStartingI:uint = 4;
var tempRow:uint=0;
var tempAlpha:Number=1;
var tempArray:Array= new Array();
 
// row 1
// addSquares(tX, tY, tStartingI, tVertical,tCounter, tScale, tAlpha) {
tempY = 17;
addSquares(tempX, tempY, tempStartingI, tempVertical, tempCounter, tempScale, tempAlpha);
//mc4.addEventListener(MouseEvent.CLICK, main);
// row 2
tempX = 134.625;
tempY = tempY+ tempVertical;
tempStartingI = 11;
tempCounter = 21;
addSquares(tempX, tempY, tempStartingI, tempVertical, tempCounter, tempScale, tempAlpha);
// row 3
tempX = 134.625;
tempY = tempY+ tempVertical;
tempStartingI = 21;
tempCounter = 31;
addSquares(tempX, tempY, tempStartingI, tempVertical, tempCounter, tempScale, tempAlpha);
// row 4
tempX = 134.625;
tempY = tempY+ tempVertical;
tempStartingI = 31;
tempCounter = 41;
addSquares(tempX, tempY, tempStartingI, tempVertical, tempCounter, tempScale, tempAlpha);
// row 5
tempX = 134.625;
tempY = tempY+ tempVertical;
tempStartingI = 41;
tempCounter = 51;
addSquares(tempX, tempY, tempStartingI, tempVertical, tempCounter, tempScale, tempAlpha);
// row 6
tempX = 134.625;
tempY = tempY+ tempVertical;
tempStartingI = 51;
tempCounter = 61;
addSquares(tempX, tempY, tempStartingI, tempVertical, tempCounter, tempScale, tempAlpha);
//
function addSquares(tX, tY, tStartingI, tVertical,tCounter, tScale, tAlpha):void {
  tY = tY + tVertical;// 156 is the location in illustrator + 50*.8725
  for (var i:uint = tStartingI; i
           
Open in New Window Select All

Answer : Calling multiple dynamically created MCs

Oh, I think it was my bad...

Here, how about this?



-V
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
function onMouseDown( e:MouseEvent ):void {
	var mssMC:MovieClip = MovieClip(e.target);
	trace( mssMC.name );
	trace( mssMC.x + ", " + mssMC.y );
	mssMC.gotoAndPlay(2);
	if (mssMC.name=="mc4") {
		MovieClip(mssMC.parent.getChildByName("mc4")).gotoAndPlay(2);
		MovieClip(mssMC.parent.getChildByName("mc5")).gotoAndPlay(2);
		MovieClip(mssMC.parent.getChildByName("mc6")).gotoAndPlay(2);
		MovieClip(mssMC.parent.getChildByName("mc59")).gotoAndPlay(2);
	}
}
Open in New Window Select All
Random Solutions  
 
programming4us programming4us