A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [AS3] <between> command?

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    25

    Question [AS3] <between> command?

    i'm pretty sure there is no <is in between this number give or take 5 values> command, so how would i say:

    Actionscript Code:
    _root.mcMain.y <is in between> this.y <plus or minus> 5

    thanks for all help -- much appreciated!

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Code:
    if (_root.mcMain.y>this.y-5&&_root.mcMain.y<this.y+5) {
    	// do whatever
    }

  3. #3
    Junior Member
    Join Date
    Jul 2009
    Posts
    25
    ahh yes thank you! i feel dumb now -- i was using || instead of &&

    thanks again

  4. #4
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    if (Math.abs (_root.mcMain.y - this.y) < 5) would work too
    who is this? a word of friendly advice: FFS stop using AS2

  5. #5
    Junior Member
    Join Date
    Jul 2009
    Posts
    25
    ahh yes that's what i was looking for, but i couldn't get it to work lol so i tried the other suggestion and screwed it up with || not &&. but thanks!

Tags for this Thread

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