A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [MX04] I need help on how to rotate an mc using a separate button

  1. #1
    Member
    Join Date
    Sep 2006
    Posts
    43

    [MX04] I need help on how to rotate an mc using a separate button

    I need help on how to rotate an mc using a separate button. This is the actionscript I'm using...

    var sOb = "";
    var num:Number = 0;
    Ob_array = new Array("bed", "armoire", "dresser");
    Obclick = function () {
    startDrag(this, true);
    this.swapDepths(_root.getNextHighestDepth());
    this._alpha = 50;
    _root.sOb = this;
    };
    Obrelease = function () {
    this._alpha = 100;
    if (sOb.hitTest(trash._x, trash._y, true)) {
    removeMovieClip(sOb);
    }
    };
    for (var i in Ob_array) {
    var ob:MovieClip = eval(Ob_array[i]);
    ob.onPress = function() {
    var nOb:MovieClip = attachMovie(this._name, this._name+(++num), _root.getNextHighestDepth(), {_x:this._x, _y:this._y, _alpha:50});
    _root.sOb = nOb;
    nOb.onPress = Obclick;
    nOb.onRelease = nOb.onRollOut=Obrelease;
    startDrag(nOb, true);
    };
    }
    onMouseUp = function () {
    stopDrag();
    };




    Thanks
    Attached Files Attached Files

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Code:
    btnRIGHT.onPress = function(){
    	_root.sOb._rotation += 10;
    }

  3. #3
    Member
    Join Date
    Sep 2006
    Posts
    43
    do I have to create a "button" mc? Where exactly do I insert this actionscript?

  4. #4
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Yes.
    Right below your existing code is fine.
    See attached for example.
    Last edited by dawsonk; 08-22-2007 at 10:52 AM.

  5. #5
    Member
    Join Date
    Sep 2006
    Posts
    43
    Got it dawsonk! I highly appreciate your help! Thanks!!!

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