A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Array???

  1. #1
    Junior Member
    Join Date
    Mar 2000
    Posts
    2

    Question

    hi!
    Does variable type in action script support "Array" like myArray(2)?
    and also can I make Matrix?

    I am trying to make Message Board using Flash and ASP

    In addition, I'd like to know why "Board" in this site is made by HTML code instead of Flash..

    if anyone knows this answer, please inform me

    thanks
    and my email address is soyeonk@yahoo.com

  2. #2
    Senior Member
    Join Date
    Feb 2000
    Posts
    195

    Lightbulb

    IMHO, there are many things for which Flash is the tool of choice.. However, there are still some things for which I believe HTML is the tool of choice. Message boards are one of them. Having tried Flash based message boards in the past, I fully believe that HTML is still the better choice for that job. You may design the worlds best power screwdriver, but you still should not use it to drive nails


    Now..

    Flash does not support Arrays, as such. However, you can simulate arrays in Flash quite easily, since the Set Variables command and the Eval command allow you to dynamically construct variable names.


    Let's say you want to creat a 10x26 array called "board".. (This is a snipit of code taken directly from a Tetris clone that I just so happen to be writing as we speak )

    <pre>
    Set Variable: "y" = 1
    Loop While (y <= 26)
    Set Variable: "x" = 1
    Loop While (x <= 10)
    Set Variable: "board" & x & "_" & y = 0
    Set Variable: "x" = x + 1
    End Loop
    Set Variable: "y" = y + 1
    End Loop
    </pre>


    Then to check the value of that array..

    Set Variable: "x" = 5
    Set Variable: "y" = 13
    Comment: I just chose those numbers as an examle
    Set Variable: "result" = Eval("board" & x & "_" & y)

    And that's it! (Gee.. I'm giving away all my secrets ) By the way.. I should be releasing that Tetris game later today.. check the Games forum if you are interested


    <EMBED src="/cgi-bin/ubb/Members/sigs/00000205.swf" quality=high WIDTH=500 HEIGHT=50 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"> </EMBED>

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