[ascoders] 2.Methodenaufruf scheitert

  • From: Timo Hölzer <t.hoelzer@xxxxxxxxx>
  • To: <ascoders@xxxxxxxxxxxxx>
  • Date: Thu, 30 Jan 2003 14:03:45 +0100

Hallo zusammen!

Folgendes Problem FLASH 5 :

In der Methode einer Klasse, deren Instanz sich auf
_rootbefindet rufe ich die folgende MovieClip-Methode
für 2 Clips("p1","p2") in einem MC("phone") auf,
welcher ebenfalls auf _root liegt.

Mein Problem besteht darin, daß der 1.Aufruf der Methode
[bei generateCables()] stattfindet und die Clip gefärbt
werden.

Alle weiteren Aufrufe [skipCables()] schlagen fehl

Ein trace() in setColorHex() zeigte mir das die Methode
nicht aufgerufen wird. Wenn ich den Movie als flash6
exportiere funzt alles. Hat jemand eine Erklärung für
mich, oder noch besser eine Lösung?



die Methode
----------------------------------------------------------------------------
----
movieclip.prototype.setColorHex = function (hex) {
        if(this.colorObj == undefined) this.colorObj = new Color(this)
        this.hex = parseInt("0x"+hex)
        this.colorObj.setRGB(this.hex)
}
----------------------------------------------------------------------------
----


die Klasse
----------------------------------------------------------------------------
----
function Bomb(numCables, colors){
        this.numCables = numCables;
        this.colors = colors;
        this.space = 360/numCables
        this.init()
}

Bomb.prototype.init = function(){
        this.mixedColors = this.colors.mix(this.numCables,2);
        this.current = 0
        this.generateCables()
}


Bomb.prototype.checkCables = function(arr){
        return this.mixedColors[this.current].isEqualTo(arr)
}

Bomb.prototype.skipCables = function(){
        this.current++
        phone.p1.setColorHex(this.mixedColors[this.current][0]);
        phone.p2.setColorHex(this.mixedColors[this.current][1]);
}

Bomb.prototype.generateCables = function(){
        for(var i=0; i<this.numCables; i++){
                attachMovie("cable","cable"+i , i);
                eval("cable"+i)._x = clock._x;
                eval("cable"+i)._y = clock._y;
                eval("cable"+i)._rotation = this.space * i;
                eval("cable"+i).arr = this.mixedColors[i];
                eval("cable"+i).c1.setColorHex(this.mixedColors[i][0]);
                eval("cable"+i).c2.setColorHex(this.mixedColors[i][1]);
        }
        this.mixedColors.shake();
        phone.p1.setColorHex(this.mixedColors[this.current][0]);
        phone.p2.setColorHex(this.mixedColors[this.current][1]);
}
----------------------------------------------------------------------------
----


Tausend Dank
Timo H.

------------------------------------------------------
Archiv   : //www.freelists.org/archives/ascoders/
Optionen : //www.freelists.org/list/ascoders
------------------------------------------------------

Other related posts:

  • » [ascoders] 2.Methodenaufruf scheitert