-
OOP script problem
I'm still pretty new to OOP in Flash so i need some help to point out the mistake in my script coz currently, i can't get what i want to work.
Basically, when the mouse hitTest any of the 9 smaller box named t1, t2, t3, t4, t5, t6, t7, t8, t9, all of which are inside the mc bigbox.... the smaller box will change tint.
you can also d/l my fla
Will really appreciate your help. Thanx!
////////////////////////////////////////////////////////////////
//Cursor Class
////////////////////////////////////////////////////////////////
function Cursor(myMouse, x, y) {
this._x = x;
this._y = y;
this.myMouse = _root.mousecursor;
}
Cursor.prototype.drag = function() {
Mouse.hide();
this.myMouse.startDrag(this);
updateAfterEvent();
};
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
//Drag Class
////////////////////////////////////////////////////////////////
Drag.prototype = new Cursor();
function Drag(myMouse, x, y, myObject, Objx, Objy, myTriggers) {
super(myMouse, x, y);
this.myObject = _root.bigbox;
this.Objx = _root.bigbox._x;
this.Objy = _root.bigbox._y;
this.myTriggers = myTriggers;
}
Drag.prototype.update = function() {
super.update();
this.trigger();
this.changetint();
this.test();
}
Drag.prototype.test = function() {
trace("test");
}
Drag.prototype.trigger = function(myMouse, myObject, myTriggers) {
var trig = [t1, t2, t3, t4, t5, t6, t7, t8, t9];
for (var i = 0; i < trig.length; i++) {
if (this.myMouse.hitTest(this.myObject.trig[i])){
trace("yes");
this.changetint();
}
}
}
Drag.prototype.changetint = function() {
// changetint
}
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
//onEnterFrame
////////////////////////////////////////////////////////////////
var cur = new Cursor(this, _parent._xmouse, _parent._ymouse);
var dra = new Drag(myMouse, _root._xmouse, _root._ymouse, myObject, Objx, Objy, myTriggers);
this.onEnterFrame = function() {
cur.drag();
dra.update();
};
////////////////////////////////////////////////////////////////
-
Just make sure your that the class that use MovieClip method (like onEnterFrame or startDrag) are derived from the MovieClip method and that the are associated with a linkage object in the library
-
i didn't have any linked object. I name the mc instance manually....
still kinda fuzzy here.... :confused: