View Full Version : (F5) Need answer fast..
phorte
April 17th, 2003, 06:14 AM
Okay.. Is there anyway to have a ceratin part of a script make certain values a certain value for only that part of the script and then have the same script later on but have to show different values.. that was confusing right?? lol.. anyway..
If I have this script
sign1._x = 170;
sign1._y = ay;
sign1.txtmc.txt = _root.atxt;
sign1.body._width = aw;
sign1.point._x = aw
and i then want to repeat this script but with a chang that all the "1"s are "2"s and all the "a"s are "b"s (atxt become btxt for example)
Im not really sure how to do this.. i was think of like having a loop function and everytime it does the script it changes thoose values but then im not so sure how to change a into b.. anway..
Thank you in advance and anyone who helps me this will get a chocolate bar.. =D lol..
/Aussie Devil/
senocular
April 17th, 2003, 06:54 AM
startLetter = "a";
startNumber = 1;
char = startLetter.charCodeAt(0);
for (i=0;i<10;i++){
num = i + startNumber;
let = String.fromCharCode(i+char);
this["sign"+num]._x = 170;
this["sign"+num]._y = this[let+"y"];
this["sign"+num].txtmc.txt = _root[let+"txt"];
this["sign"+num].body._width = this[let+"w"];
this["sign"+num].point._x = this[let+"w"];
}
;)
kode
April 17th, 2003, 06:54 AM
there must be an easier way than this... but i don't feel like thinking right now. :P
var i, a = "ab";
for (i=1; i<=a.length; i++) {
this["sign"+i]._x = 170;
this["sign"+i]._y = this[a.charAt(i-1)+"y"];
this["sign"+i].txtmc.txt = this[a.charAt(i-1)+"txt"];
this["sign"+i].body._width = this[a.charAt(i-1)+"w"];
this["sign"+i].point._x = this[a.charAt(i-1)+"w"];
}
just change this to _root or _parent depending on where those variables were defined. ;)
phorte
April 17th, 2003, 07:57 AM
hmmm.. okay.. im not that much of an actionscript expect.. so.. these scripts a little overwhelming.. so.. if u dont mind.. could u sorta explain whats happening in them..??
like.. what exactly is a string?? or how do thoose ; thing work?? or wait.. i tried your script senocular although it didnt work.. sorry.. but then i tried your kax.. and it worked.. but not tottaly sure exactly how..
thanks for all your work..
EDIT: I was just looking thourgh and i think i sorta get it now.. and i only have one thing to say: "you guys are genius's!!!" That is amazing.. i would never of thought of doin that.. but now i know about that.. and i am learning.. good.. i wish i was as good as you guys.. anyway.. Thankyou Thank you Thank you..
/Aussie Devil/
kode
April 17th, 2003, 10:11 AM
sorry... i had a little problem here and i couldn't reply before. :-\
anyway, if you still have any questions about the script... just ask, i'll try to explain it. ;)
phorte
April 17th, 2003, 11:20 AM
That okay.. Its okay.. i worked out how it worked.. and a think that while, for etc functions can be very usefull.. i never would have know about them if u hadnt told me.. thanks for that.. =D
Thank you once again.. and sure if i have anymore questions i will ask u.. thanks..
//Scotty//
kode
April 17th, 2003, 11:23 AM
anytime. =)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.