[ascoders] Re: AW: Re: übergabe einer schleifen-laufvariable an onEnterFrame-fu nction
- From: <martink65@xxxxxxxxxxxxx>
- To: <ascoders@xxxxxxxxxxxxx>
- Date: Tue, 18 Mar 2003 22:30:55 +0100
herzlichen dank ralf und timo,
hab mir eure tips angesehen - ein bißchen herumprobiert, aber
irgendwas hat immer nicht geklappt. liegt aber wahrscheinlich auch daran
daß mein kopf mittlerweile ziemlich schwirrt ;-)
dann hab ich mal versucht die 'verzoegerungs'-werte mittels
onLoad in die jeweiligen clips zu laden - und es funktioniert!!!
eine eigentlich simple lösung - naja, wieder was dazugelernt ;-)))
<code>
file://array mit mc-namen und den verzoegerungs-werten
squareArr = [["square_1",2], ["square_2",3], ["square_3",4], ["square_4",2],
["square_5",3], ["square_6",4], ["square_7",2], ["square_8",3],
["square_9",4]];
bar_mc.onPress = function() {
this.startDrag(false, 0, 60, 500, 60);
for (var i = 0; i < _root.squareArr.length; i++) {
// onLoad get 'verzoegerungswert' from squareArr
_root[squareArr[i][0]].onLoad = function(){
this.verzoegerung = _root.squareArr[i][1];
trace("verzoegerung:"+this.verzoegerung);
}
// trigger onLoad
_root[squareArr[i][0]].onLoad();
//
_root[squareArr[i][0]].onEnterFrame = function() {
diffX = bar_mc._x - this._x;
trace("verzoegerung: "+this.verzoegerung);
if(diffX < 0){
this._x += Math.floor(diffX / (2 * this.verzoegerung));
}
else if(diffX > 0){
this._x += Math.ceil(diffX / (2 * this.verzoegerung));
}
trace("onPress-enterFrame-method active");
};
}
updateAfterEvent();
};
bar_mc.onRelease = function() {
this.stopDrag();
for (var i = 0; i < squareArr.length; i++) {
_root[squareArr[i][0]].onEnterFrame = function() {
diffX = bar_mc._x - this._x;
if(diffX < 0){
this._x += Math.floor(diffX / (2 * this.verzoegerung));
}
else if(diffX > 0){
this._x += Math.ceil(diffX / (2 * this.verzoegerung));
}
else if(diffX == 0){
delete this.onEnterFrame;
}
trace("onRelease-enterFrame-method active");
};
}
};
</code>
vielen dank nochmal,
martin
www.martink65.com
------------------------------------------------------
Archiv : http://www.freelists.org/archives/ascoders/
Optionen : http://www.freelists.org/list/ascoders
------------------------------------------------------
Other related posts: