-
The ActionScript Master
Well there is Prototypes and Array in the Q
Hoi
this has me jumping
i got this from http://proto.layer51.com/d.aspx?f=749
but its not working
code:
Array.prototype.findAndRemove = function(toRemove) {
this = this.toString().split(toRemove+",").join("").split (",");
trace(this)// this trace shows that the toRemove has been removed
};
myArray = new Array(1, 2, 3, 3, 5, 6, 7, 8, 3, 0);
myArray.findAndRemove(3);
trace(myArray);//but when i trace myArray nothing has changed!!
its as if the change of the prototype function is not saved!!
is there some one who knows more about Prototype stuff here
Thanks
Master64
useing:XP,MX
don't send me PM's because i never check it so if you what to contact me use Email
-
Senior Member
Hi,
you could try this instead,
code:
Array.prototype.findAndRemove = function(toRemove) {
return this.toString().split(toRemove+",").join("").split (",");
};
myArray = new Array(1, 2, 3, 3, 5, 6, 7, 8, 3, 0);
myArray = myArray.findAndRemove(3);
trace(myArray);
-
The ActionScript Master
Hoi
your right but that function should just work as it is
thanks
Master64
useing:XP,MX
don't send me PM's because i never check it so if you what to contact me use Email
-
half as fun, double the price
make sure you're exporting in Flash 6. It wont work in 5.
-
The ActionScript Master
Hoi
that was one of the fisrt thing i checked becaues i am always messing up there
Master64
useing:XP,MX
don't send me PM's because i never check it so if you what to contact me use Email
-
half as fun, double the price
Does that mean you figured out your problem?
-
The ActionScript Master
no
Master64
useing:XP,MX
don't send me PM's because i never check it so if you what to contact me use Email
-
half as fun, double the price
return the this =
then set array var to function call
-
The ActionScript Master
Hoi
well i have a blank movie wiht no thing in it just this on the first frame
code:
Array.prototype.findAndRemove = function(toRemove) {
this = this.toString().split(toRemove+",").join("").split (",");
trace(this);
// this trace shows that the toRemove has been removed
};
myArray = new Array(1, 2, 3, 3, 5, 6, 7, 8, 3, 0);
myArray.findAndRemove(3);
trace(myArray);
//but when i trace myArray nothing has changed!!
and this is what i get in my output window
1,2,5,6,7,8,0
1,2,3,3,5,6,7,8,3,0
thanks
Master64
useing:XP,MX
don't send me PM's because i never check it so if you what to contact me use Email
-
The ActionScript Master
Originally posted by senocular
return the this =
then set array var to function call
sorry but i don't get it
Master64
useing:XP,MX
don't send me PM's because i never check it so if you what to contact me use Email
-
half as fun, double the price
-
The ActionScript Master
ok
but the function does work with you?
well then its my computer
thanks for you help
Last edited by Master64; 07-23-2003 at 12:52 PM.
Master64
useing:XP,MX
don't send me PM's because i never check it so if you what to contact me use Email
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
|