In advance i apologize about the weak explanation, its the best i can do lol.
I have a hit test object which is called timeblock. I have created several timeblocks with a loop and added them to a _timeblock array and added them to the stage. These timeblocks are inside a timeline class. In the frame code i have created several timelines with a loop and added them to the stage in different y positions.
I have some movieclip objects which when hits a timeblock should move to that timeblock’s x and y position. This works fine with one timeline but with an array of these timeblock objects the movieclip goes to the wrong y position but right x?
I have omitted most of the code because there’s a lot and its mostly irrelevant.
Timeline Class
[LEFT][COLOR=#993300]public[/COLOR] [COLOR=#993300]function[/COLOR] checkTarget[COLOR=#000000]([/COLOR]event:MouseEvent[COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#993300]var[/COLOR] [COLOR=#993300]sound[/COLOR]:Sound = [COLOR=#993300]MovieClip[/COLOR][COLOR=#000000]([/COLOR]root[COLOR=#000000])[/COLOR].[COLOR=#993300]sound[/COLOR];
[COLOR=#993300]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#993300]var[/COLOR] i:[COLOR=#993300]int[/COLOR] = [COLOR=#000000]0[/COLOR]; i < _timeBlocks.[COLOR=#993300]length[/COLOR]; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR]event.[COLOR=#993300]target[/COLOR].[COLOR=#000000]hitTestObject[/COLOR][COLOR=#000000]([/COLOR][COLOR=#993300]this[/COLOR]._timeBlocks[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
event.[COLOR=#000000]currentTarget[/COLOR].[COLOR=#000000]x[/COLOR] = _timeBlocks[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#000000]x[/COLOR];
event.[COLOR=#000000]currentTarget[/COLOR].[COLOR=#000000]y[/COLOR] = _timeBlocks[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#000000]y[/COLOR];
event.[COLOR=#000000]currentTarget[/COLOR].[COLOR=#000000]disable[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
addtoTimeline[COLOR=#000000]([/COLOR][COLOR=#993300]sound[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[/LEFT]
**FRAME CODE (main class)
**This is one the functions which should be used by the timeline class to check whether its hit the timeblocks
[LEFT][COLOR=#993300]function[/COLOR] newGuitar[COLOR=#000000]([/COLOR]event:MouseEvent[COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#993300]var[/COLOR] guitar:Guitar = [COLOR=#993300]new[/COLOR] Guitar[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
addChild[COLOR=#000000]([/COLOR]guitar[COLOR=#000000])[/COLOR];
soundMC.[COLOR=#993300]push[/COLOR][COLOR=#000000]([/COLOR]guitar[COLOR=#000000])[/COLOR];
guitar.[COLOR=#000000]x[/COLOR] = [COLOR=#000000]200[/COLOR];
guitar.[COLOR=#000000]y[/COLOR] = [COLOR=#000000]200[/COLOR];
guitar.[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000000]MOUSE_UP[/COLOR], checkTarget[COLOR=#000000])[/COLOR];
[COLOR=#993300]sound[/COLOR] = [COLOR=#993300]new[/COLOR] techFill[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[/LEFT]
Thanks in advance