A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: OOP script problem

  1. #1
    Junior Member
    Join Date
    Sep 2002
    Posts
    22

    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();
    };
    ////////////////////////////////////////////////////////////////
    Last edited by Ling Nightsky; 07-28-2003 at 02:15 PM.

  2. #2
    Senior Front End Developper
    Join Date
    Dec 2000
    Location
    Montréal
    Posts
    568
    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

  3. #3
    Junior Member
    Join Date
    Sep 2002
    Posts
    22
    i didn't have any linked object. I name the mc instance manually....
    still kinda fuzzy here....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center