View Full Version : About arrays. NEED HELP!
murka390
September 4th, 2004, 12:24 PM
i need that to have an array with 166 numbers. ("_parent._parent.totalFrames = 167" and "q != _parent._parent.currentframe" ) is the following code correct?
myArray = [];
for (var q = 1; q != _parent._parent._currentframe && q<168; q++) {
myArray.push(q);
stringy
September 4th, 2004, 02:30 PM
i need that to have an array with 166 numbers. ("_parent._parent.totalFrames = 167" and "q != _parent._parent.currentframe" ) is the following code correct?
myArray = [];
for (var q = 1; q != _parent._parent._currentframe && q<168; q++) {
myArray.push(q);
maybe
myArray = [];
for (var q = 1; q<168; q++) {
myArray.push(q);
}
myvar = this._parent._parent._currentframe;
myArray.splice(myvar, 1);
not sure how functional this is
murka390
September 5th, 2004, 03:32 AM
i figured it out, and it works :)
var my = [];
var i = 1;
while (i<168) {
my.push(i++);
}
var current = _root._currentframe
my.splice(current-1,1)
trace(my.join());
trace(_root._currentframe);
thnx to stringy!
murka390
September 5th, 2004, 05:12 AM
now... this wery confusing problem has come while expanding that script...
while the first part works (when _root._currentframe<168, it removes _root._currentframe from the array), but the second part does not work (when _root._currentframe>167, it does not remove _roor._currentframe)
whats wrong with it???
this.onEnterFrame = function() {
var current = _root._currentframe-1;
if (_root._currentframe<168) {
var my = [];
var i = 1;
while (i<168) {
my.push(i++);
}
my.splice(current, 1);
trace(my.join());
trace(_root._currentframe);
} else if (_root._currentframe>167) {
var my = [];
var i = 168;
while (i<248) {
my.push(i++);
}
my.splice(current, 1);
trace(my.join());
trace(_root._currentframe);
}
};
stringy
September 5th, 2004, 05:42 AM
now... this wery confusing problem has come while expanding that script...
while the first part works (when _root._currentframe<168, it removes _root._currentframe from the array), but the second part does not work (when _root._currentframe>167, it does not remove _roor._currentframe)
whats wrong with it???
this.onEnterFrame = function() {
var current = _root._currentframe-1;
if (_root._currentframe<168) {
var my = [];
var i = 1;
while (i<168) {
my.push(i++);
}
my.splice(current, 1);
trace(my.join());
trace(_root._currentframe);
} else if (_root._currentframe>167) {
var my = [];
var i = 168;
while (i<248) {
my.push(i++);
}
my.splice(current, 1);
trace(my.join());
trace(_root._currentframe);
}
};
you need to use my.splice(current-167, 1);
took me a while to work out, deleting variables etc to start with
murka390
September 5th, 2004, 06:00 AM
oh, right... doh
because the array has only 80 numbers in it ( in the second case )
THNX :D
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.