A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: this.swapDepths(this.getNextHighestDepth()); too sensitive

  1. #1
    Junior Member
    Join Date
    May 2008
    Posts
    3

    this.swapDepths(this.getNextHighestDepth()); too sensitive

    I'm creating a quiz using action script 2.0. It has a few drag and drop questions. I used this.swapDepths(this.getNextHighestDepth()); to make the current dragged movieclip come to the front. The problem i'm having is when you move on to the next question, the last movie clip you clicked on stays on the stage. Anyway of getting around this but still have the movie clip go on top of its frame only?

  2. #2
    Getting There! bitsk308's Avatar
    Join Date
    Jul 2000
    Location
    Phoenix, AZ
    Posts
    427
    not really clear on what you're asking. what do you mean 'on top of its frame only'? also, do you want the last question to fall into the background, or disappear from the stage altogether?

    also keep the scope of your function in mind. if your dragged question is 'this', then you probably want to use it's parent's .getNextHighestDepth() to move it, not it's own.

    this.swapDepths(this._parent.getNextHighestDepth() )

    the way your doing it now, you read the next available depth from within the question, and make the question go to that depth within its parent, not the parents next highest.

    Hope that clear
    _b

  3. #3
    Junior Member
    Join Date
    May 2008
    Posts
    3
    Here is the code i used

    answerTwo.onPress = function():Void {
    this.startDrag(true);
    reply_txt.text = "";
    this.swapDepths(this.getNextHighestDepth());
    xstart = 410;
    ystart = 211;
    };


    Is there anyway of canceling the this.getNextHighestDepth()); when the Movieclip is release?

  4. #4
    Getting There! bitsk308's Avatar
    Join Date
    Jul 2000
    Location
    Phoenix, AZ
    Posts
    427
    so you only want it raised to the highest depth when you're dragging it?

    you can't 'cancel' the getNextHighestDepth(), but you can just set it back when you're done. First sample the origianl depth at the onPress, then swap it up to the highest. On release just swap it back down to the origianl depth.

    answerTwo.onPress = function():Void {
    this.startDrag(true);
    reply_txt.text = "";
    this.originalDepth = this.getDepth();
    this.swapDepths(this.getNextHighestDepth());
    xstart = 410;
    ystart = 211;
    };

    answerTwo.onRelease = function(){
    this.swapDepths(this.originalDepth);
    this.stopDrag();
    }

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