A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Senior Member ::bluemoth::'s Avatar
    Join Date
    Jun 2001
    Posts
    504

    [MX04] Check if multiple of given number

    Is there a way for me to check if a value is a multiple of a given number.
    Lets say I have 3 columns, and want to make items stack at the end of each 3rd column. How can I go about it without hard-coding it like so? I'm basically wanting to set _x to 0 at the end of every 3rd item, and increase _y accordingly.

    PHP Code:
            for(){
                if (
    == || == || == || == || == 12){
                    
    rowX 0;
                } else {
                    
    rowX = ((categorymcwidth categorymargin) * c);
                }
            } 

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    PHP Code:
    var c:Number 9;
    if(
    c%== 0trace("c is a multiple of 3"); 
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    Senior Member ::bluemoth::'s Avatar
    Join Date
    Jun 2001
    Posts
    504
    Thanks, silentweed. Works great.

  4. #4
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    glad i could help
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

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