A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: [RESOLVED] [CS3] I hate hitTest now.

  1. #1
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287

    resolved [RESOLVED] [CS3] I hate hitTest now.

    The reason why I hate hitTest?

    It's because after X versions of Flash coming and going, Macromedia/Adobe NEVER thought to make it so movieclip-movieclip hitTests could occur without those stupid bounding boxes! I know you agree with me (if you know what I'm talking about...)

    Anyway, I'm getting to the point...

    Lets say I have four blank movieclips, named "a", "b", "c", and "d", with "a" and "b" placed on the top layer, and "c" and "d" inside of a fifth movie clip, which is also on the top layer. (Don't ask why it's like this, it's just is how I'm doing it.) I want to know how to find the hitTest of the LINE between "a" and "b" and the LINE between "c" and "d".

    I would just use hitTest, but it would only work when the lines are perfectly horizontal or vertical.

    So, any suggestions?
    --SumWunGye

  2. #2
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    HitTests between lines...simple, right?













    ...Or not?
    --SumWunGye

  3. #3
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    Could someone please post?
    --SumWunGye

  4. #4
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    well are your lines movieClip?


    are you using hitTest with a clipName? or an X/Y value? with shapeFlag set to true/false?

  5. #5
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    Quote Originally Posted by whispers
    well are your lines movieClip?


    are you using hitTest with a clipName? or an X/Y value? with shapeFlag set to true/false?
    Hello, and thanks for posting.

    I did some frustrating moving around of layers, actionscripting, et cetera, and it's definitely not working still. I should probably tell you the new layout of my flash, as the movie clips are not exactly in the same place they used to be...

    Inside of a movie clip on the main timeline, there are three frames, on one layer. The first frame only has the actionscript below:

    Code:
    _root.timey = getTimer();
    gotoAndPlay(_currentframe+1);
    The second frame has a long, line-shaped movie clip, called "arraw" (I would call it arrow, but I chose not to), a small, circular movie clip, called "slope", and a movie clip like slope, named "middle" in the middle of the stage. This code is on the layer:
    Code:
    slope._x = _xmouse;
    slope._y = _ymouse;
    arraw._x = middle._x;
    arraw._y = middle._y;
    _root.attachMovie("arraw","arraw");
    angle = Math.atan((0-(_ymouse-arraw._y))/(_xmouse-arraw._x))*(180/Math.PI);
    if (_xmouse-arraw._x<0) {
    	angle += 180;
    }
    if (_xmouse-arraw._x>=0 && 0-(_ymouse-arraw._y)<0) {
    	angle += 360;
    }
    arraw._rotation = 90-angle;
    play();
    Now, on frame three is the code, and only the code:

    Code:
    gotoAndPlay(_currentframe-1);
    Now, back to frame 2...There is a short segment of blank movie clips, in a line (see below). Each has this code:
    Code:
    onClipEvent (enterFrame) {
    	if (!_parent.arraw.hitTest(this._x, this._y, true) && getTimer()-_root.timey>3000) {
    		_parent.counter.gotoAndPlay(321);
    		_root.timey = getTimer();
    		_parent.gotoAndPlay(_parent._currentframe+2);
    	} else if (_parent.arraw.hitTest(this._x, this._y, true)) {
    		_root.timey = getTimer();
    	}
    }
    What I want the line of movieclips to do is, if not touched by arraw for more than three seconds, go to the next section of the movie...but it's as if the bounding box is there, still. It only works if I move the movie clip line way off to the side, and move the arraw so that it's bounding box is not touching the movie clips. If this isn't too confusing, I could use some help.

    Thanks.
    Attached Images Attached Images
    --SumWunGye

  6. #6
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    (You could at least SAY it's too confusing...)
    --SumWunGye

  7. #7
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    Hello? You guys there?
    --SumWunGye

  8. #8
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    Sorry I couldn't get back sooner, a lot's been going on...

    Oh! Wait! It doesn't even matter! Because no one even posted!

    Whispers at least tried but I need more than that...
    --SumWunGye

  9. #9
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    Whatever, I'll just live without it.
    --SumWunGye

  10. #10
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    to be honest.. I just dont care for your attitude anymore ...

    and your posts sound alot like whining... like someone here OWES you something..

    everyone here volunteers their time to help out because we like Flash..and we like to help others LEARN..

    it doesnt look like you try much on your own..and you just wait & pout until someone spoonfeeds you.

    the answers have either been provided for you..and you dont want to look or understand.. or suggestions have been made to help you learn for yourself.


    with the attitude you have shown.. its really no surprise that noone is helping you.

    like your 100% issue...

    good luck. :|

  11. #11
    Musical chair sumwungye's Avatar
    Join Date
    Jan 2008
    Location
    Planet Earth, third planet from the Sun
    Posts
    287
    Quote Originally Posted by whispers
    to be honest.. I just dont care for your attitude anymore ...

    and your posts sound alot like whining... like someone here OWES you something..

    everyone here volunteers their time to help out because we like Flash..and we like to help others LEARN..

    it doesnt look like you try much on your own..and you just wait & pout until someone spoonfeeds you.

    the answers have either been provided for you..and you dont want to look or understand.. or suggestions have been made to help you learn for yourself.


    with the attitude you have shown.. its really no surprise that noone is helping you.

    like your 100% issue...

    good luck. :|
    After, some looking back at what I've posted here, I can pretty much understand of what you mean...

    I know it seems like I have an "attitude" mostly because of my 6th-8th posts on this thread...I only really posted those because I was tired of having quite a few of my started threads...well...not responded to. Like, my first two threads here weren't responded to for a while...my first went a week before I had to send a message to some of the mods asking them to respond to my post.

    And I do try on my work, it's just when I have tried over and over again and can't get stuff to work that I need help. So, when I come here...I can understand why you might think I don't try, because I've, for the most part, given up on my work until I get a little help.

    And on this one, I didn't even need any help; I just got rid of the hitTest part of my work altogether.

    And I think a big reason no one came to help me here was because they took a look at my code, and didn't want to deal with fixing it...I can understand why; it is really confusing.

    Well, anyway, I'm sorry if you think of me that way, and I'll try not to seem so stuck-up about my stuff...
    --SumWunGye

  12. #12
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    its all good.. and noone here really keeps a grudge as long as you dont.

    and we've ALL been frustrated before.. especially myself.

    I think the key is to learn how to implement something.. on its own..and THEN try to work it into your projects.

    once you understand how something works on its own..it makes it easier to integrate.

    its hard for us to:

    1.) understand YOUR projects..since they are YOURS..and you know where you are going with it...etc..etc

    2.) keep up when you change code or the approach

    3.) have the wade through tons of code to find or fix something..

    not say YOU particularly..just in general.

    you will find there are TONS of people here who help....but you will also find that there are LULLS when people have to work on their own projects or do their day to day job..

    I sitll you can work in the hitTest no problem.. and if you want we can work on a basic example that you may be able to adapt to your current project needs.

    so keep a positive attitude and everyone here will to.

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