Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 16 of 16
  1. #11

    Default

    THANK YOU SO MUCH! I have been looking for the answer to this all day!
    Just trying to understand your actionscript, why can't we say
    'var random_number = random(13)'? Why must there be a +1?

    Also, what is a var?

    Thanks

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #12
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    581

    Default

    var is the creation code for a variable in flash.

    Woops, I messed up with that code. It should be random(13) + 1;
    Why do we say 13 + 1? In computer stuff, we usually start with the number 0 instead of 1. If you have a list or an array of numbers, we refer to the first place as 0, the second as 1, and so on.
    With the random function, it will spit out 1 of 13 numbers. However, the number 0 is included. This means it will spit out 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12, if you put 13 in it. So, we need to add 1 to the final number to get from 1-13.
    Sorry about that mistake.

    Please ask anything else that seems fishy. I'm currently playing a game, so half my attention to detail is gone. xD
    Last edited by Vlykarye; 03-18-2012 at 04:27 AM.

  4. #13

    Default

    So doesn't that mean you could just write 'random(14)'?
    Thank you so much btw, would it be ok if I emailed you with my little AS2 dilemmas from now on? How long does it usually take you to reply? I would really appreciate that

  5. #14
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    581

    Default

    If you use random(14), then you might get a 0, but there is no such thing as a 0th frame in flash. Frames start at 1.
    I'll give you a different email address by emailing you. You can use that and i'll answer pretty quickly.

  6. #15

    Default

    Thank you so much Also, what is a var? Where can I learn more about AS2 and AS3?

  7. #16
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    581

    Default

    var is a type. Google search what programming types are.
    If you want to learn the difference between AS2 and AS3, then google search that as well. I'm not the best teacher for flash anymore since I program in C++ now.
    I can help with certain flash things because I have had a lot of experience with it, but I don't know too much off the top of my head anymore.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial