|
-
Who needs pants?
GotoAndSotp number in array.
I have 2 mcs on the stage one is the duplicate of the other so they have the same actions. On the main timeline i have an array.
number = new Array( 4,2,1,5,7,3,7,6,4);
on the movieclips i have an if statement that when they reach a certian _y cord for them to gotoAndStop at the next corrorsponding frame according to the array. But instead of going to the next number in the array i want it to move 2 so just say its last number was number[1] which equals 2 the next postition for it to go to is number[1] + 2; which means its next position is number[3] which equals 5. I have tried this over and over but it doesnt seem to work properly it adds 2 to the number[#] instead of moveing 2 in the array can anyone help.
Thanks in AdvancE
-
Code:
place+= 2;
numbers[place];
The only time u need numbers[var or number + 2]; is when u want to just temp check that number in the array.. But u dont u want a number that u can use the next turn around so u need to use a var.. that is if i got the question right?
edit: make sure u _root. sence this is on a mc.. Just didnt see it so i thought id add that..
Last edited by xDrunkCowx; 03-24-2003 at 11:51 PM.
I'm back.
-
Who needs pants?
thanks for that, it worked but only works once
-
ism
i doubt if this is the problem but isn't "number" a reserver word (used for a method) in flash?
Graphics Attract, Motion Engages, Gameplay Addicts
XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro
-
Who needs pants?
ignore that i didt it agian and a diff way but thanks ne way for ur help Works now :P
Wah 800 Posts.
Yeah it is blink. i was just using number as an example :P
-
Well put it for everyone else!! 
PHP Code:
//
// Initialise vars
i=0
number = [4, 2, 1, 5, 7, 3, 7, 6, 4]
//
// The function
onEnterFrame = function() {
newFrame = number[i]+2
gotoAndStop(newFrame)
}
That should be about right???? Changing [i] would affect the positions of the array!
Last edited by RipX; 03-25-2003 at 04:18 AM.
-
Who needs pants?
Thats what i use but not in a function. I had it working fine but now i muddled with some of the code in the game and its stuffed
what it does now is
trak = new Array(1,2,3,4,5,6,7,8,9,10);
it starts off fine it goes like this 1,2,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10.
it kind of stuffs up at the end :P but i think i have it worked out.
-
Yeah probably need to keep it within the array
PHP Code:
if(i < array.length) {
The code
}
-
hey,
so it does work u want it to do taht 1,2,3,3,4,4 thang?
-
Senior Member
shouldnt it be numbers[i+2]; ? if it was numbers[i]+2 it would take numbers[i] and add two to that value, not pick the array value 2 along from i
[m]
-
Originally posted by mbenney
shouldnt it be numbers[i+2]; ? if it was numbers[i]+2 it would take numbers[i] and add two to that value, not pick the array value 2 along from i
[m]
That's right - I thought he wanted to add two to the frame not take contents of the array two ahead!!! That's what happens when you don't read properly and look at his example 
PHP Code:
//
// Initialise vars
i=0
number = [4, 2, 1, 5, 7, 3, 7, 6, 4]
//
// The function
onEnterFrame = function() {
newFrame = number[i+2]
if(i < number.length - 2) {
gotoAndStop(newFrame)
}
}
RipX
-
You could always just set [i] to 2 but I don't actually know how your implimenting this so it's hard to know what to put in term of code!!
RipX
-
Who needs pants?
Really appretiate the help. Just fiddling with a old engine for a game i made a while back.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|