A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: hitTest ! and then?

Hybrid View

  1. #1
    Junior Member
    Join Date
    Aug 2001
    Posts
    11
    Hi
    i have two questions about hittest.
    i have something like this
    onClipEvent(enterFrame) {
    if (this.hitTest(_root.rocket)) {
    points += 50;
    this._rotation += 10;
    }
    }
    then i have a textfield (dynamic) with a variable: text

    1.)how & where can i say: text = points;?
    2.)how & where can i say(if hitTest is true): gotoAndPlay(x)?
    and even a third question
    3.)is there something like globals in flash5?

    thx
    bo

  2. #2
    You can declare text=points in the frame where the dyn txt field appears...if you want.

    You can put the if hitTest==true in the onClipEvent so that it is checked every iteration...if you want.

    Yes there are globals.
    gotoAndPlay() is a global function
    getVersion() is a global function
    _quality is a global property
    _level is a global property

    global variables...um, well, the thing is, see um...
    they can be simulated with object.prototype
    object.prototype.crap=poop
    now anyMC.crap will equal poop.

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    198
    There arent really any global variables i guess... but i always use _root.variable, then in any mc to acces that var, just call _root.variable. And another thing, gotoAndPlay() is not a global function, because you have to define the target you want to play.

  4. #4
    Junior Member
    Join Date
    Aug 2001
    Posts
    11

    Smile i c

    thx guys

    unicron do u mean something like this will work ?

    onClipEvent(this.hitTest(_root.rocket)){
    do this and that;
    } ??????

    and
    i tryed the gotoAndplay(); in the MC script where i made the hitTest, but it doesn`t work at all !!
    (can it be that this is, because in the framescript of Frame 1(everything happens in Frame 1 in my Game, so far) i have: stop(); ? i thought gotoAndPlay(); will overwrite the stop();! )


    but anyway u helped me a lot guys! AS is very new to me, i know Lingo quite well, but AS is really different!

  5. #5
    Senior Member
    Join Date
    Jul 2000
    Posts
    198
    You can go like this:

    Code:
    onCLipEvent(enterframe) {
      if (hittest(mc)) {
        mcToPlay.gotoAndPlay(frame);
      }
    }

  6. #6
    Yes, I mean what Mr. Climber said.
    And Dr. Climber I do believe this gotoAdPlay() thing is a global function insofar as it can be called from any frame, button, or handler in a movie. I'm not trying to start any fires here, but Mr. Colin Moock seems to think its a global (in his book that I am blatantly copying) and I don't have the knowledge to argue with him...

    As far as the variables are concerned; globals don't exist, yet they can be simulated with .prototype and _proto_
    Since all flash mcs are born with Object as a superclass they can be effectively altered by changing object.prototype.crap and all instances will inherit the change...so says Mr. Moock.
    Not me.
    I'm just vomiting up what he wrote.
    I'm not that bright.
    I got lost in my own bathroom....

  7. #7
    Senior Member
    Join Date
    Jul 2000
    Posts
    198
    There you go... I will believe Colin Moock over me anyday... I assumed a global function was a function that efffected the whole movie... O well, I know better now.

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