A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: hitTest fun: trouble getting buttons to work in clickable movie clips

  1. #1
    Lunch is for wimps. erova's Avatar
    Join Date
    Mar 2002
    Location
    washington dc
    Posts
    521

    hitTest fun: trouble getting buttons to work in clickable movie clips

    hey everyone,

    i've got a button inside of a clickable movie clip that i can't get to work and it's driving me nutz.

    can anyone take a look at it and find out why the button housed in the MC isn't working?

    please see the FLA attached.
    Attached Files Attached Files

  2. #2
    Junior Member
    Join Date
    Oct 2003
    Location
    New Jersey
    Posts
    10
    Well, for what it's worth, I'm basically having the same problem. I can't get buttons to work inside a MC that uses onRollOver.

    oldnewbie suggested this to me in another thread:

    onClipEvent (enterFrame) {
    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
    if (this._currentframe < this._totalframes) {
    nextFrame();
    }
    }
    else {
    if (this._currentframe > 1) {
    prevFrame();
    }
    }
    }


    That seams to work, but I don't really think that's what hitTest was meant to do. I think it was designed to check it 2 objects hit each other, and it seems a little kludge to me to use it instead of onRollOver. There must be a way to get buttons to work, I just haven't figured it out yet.

    Oh, and here's my project, if you're interested.

    EDIT: Formatting
    Attached Files Attached Files
    Last edited by hokiewalrus; 10-22-2003 at 11:19 AM.

  3. #3
    Lunch is for wimps. erova's Avatar
    Join Date
    Mar 2002
    Location
    washington dc
    Posts
    521
    any other attempts?

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Hokiewalrus...
    I like the "someone", next time I'll let a "somebody" else proposed a solution that's more agreable to you!

  5. #5
    Lunch is for wimps. erova's Avatar
    Join Date
    Mar 2002
    Location
    washington dc
    Posts
    521
    oldnewbie--

    i downloaded the fla you gave hokie and tried it--exactly what i want to accomplish, yet just ain't working.

    i PMed you this afternoon about this issue, by the way, hopin you could take a look.

    Thanks!

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    I will in a few minutes!

  7. #7
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    2 questions.

    Is the actual ball to be the only hit area?
    What about this commented out "onPress" handler? Would that still be used, or would you do it differently?

  8. #8
    Lunch is for wimps. erova's Avatar
    Join Date
    Mar 2002
    Location
    washington dc
    Posts
    521
    hey, thanks for checkin it out, first off.

    secondly, the ball really is only there as a lame troubleshooting MC.

    i put it there so i could see an obvious difference between clicking in the movie clip itself and not just anywhere (in the real product the ball would probably be just a white block underneath the text to act as a hit area, if necessary.

    as far as the commented out Press functions, those probably will go, as that's old legacy/band-aid code from the first version of this from last year, so most likely can be discarded.

    thanks!

  9. #9
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    So your basically saying the whole of the option0_mc clip should be the hit area, right?

    How long are you still going to be around, if I have other questions?

  10. #10
    Lunch is for wimps. erova's Avatar
    Join Date
    Mar 2002
    Location
    washington dc
    Posts
    521
    Originally posted by oldnewbie
    So your basically saying the whole of the option0_mc clip should be the hit area, right?

    How long are you still going to be around, if I have other questions?
    i'll be around my email for a while, and i'd obviously like to help out as much as i can.

    on that note, option0_mc's hit area should only be the area viewable before it's clicked, since when it is clicked the area of the movie clip will greatly expand (hence the square that is revealed when it is currently clicked).

  11. #11
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Ok! I'll see what I can come up with!

  12. #12
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    This somewhat what you were going for?
    Only did the first clip... And still not understanding what you want exactly with the title. Should it fade in on rollover and fade out on rollout, the contrary to what you presently have?

    http://odin.prohosting.com/~oldnew/my_hittest_fun.swf

  13. #13
    Lunch is for wimps. erova's Avatar
    Join Date
    Mar 2002
    Location
    washington dc
    Posts
    521
    hey, thanks.

    i'm not as concerned with the rollover effects; i'm pretty sure i can take care of that.

    i've really just been getting tripped up with being able to have a button be clicked after the movie clip it is held in has been clicked.

    it's very similar to your drop-down menu you provided, where clicking on the movie clip resulted in a button revealing itself that could also be clicked.

  14. #14
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Here's the .fla then as dirty as I left it...
    Attached Files Attached Files

  15. #15
    Junior Member
    Join Date
    Oct 2003
    Location
    New Jersey
    Posts
    10
    Originally posted by oldnewbie
    Hokiewalrus...
    I like the "someone", next time I'll let a "somebody" else proposed a solution that's more agreable to you!
    Sorry I didn't properly give you credit for the fix. I couldn't remember who posted it at the time and was too lazy at the time to trudge through 56K-ville to look it up.

    I fixed it, my bad.

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