Ask a Question related to Macromedia Director Lingo, Design and Development.

  1. #1

    Default List Related Fun

    Hello,

    Coming from a flash background I'm always trying to recreate things that seemed simple in Flash's actionscript in Director. I'm using 8.5 and what I'm trying to create is a 2 dimensional array..

    In Flash it was as easy as:

    function createObject(objA, objB){

    this.objA= objA;
    this.objB= objB;

    }


    var anArray = new Array(2);
    anArray[0] = new createObject("Bob","Uncle");
    anArray[1] = new createObject("Brad","Village Idiot");

    Once this was set finding an object was easy...
    anArray[1].objB would equal "Village Idiot".

    So its this I'm trying to achieve, an easy way to create a 2D array, populate it and then how to access it... I've been looking everywhere for pointers but there are only notes on one dimensional arrays (straight forward lists).

    Any pointers would be greatly appreciated on this matter.

    Many thanks for your time,
    Meeesta


    meeesta webforumsuser@macromedia.com Guest

  2. Similar Questions and Discussions

    1. ASP Coding Problem, XMLDOM-related (or just language-related!)
      Hi, I'm hoping someone can help me with this problem. I'm not sure whether the problem lies with the software or with my understanding of the...
    2. IE7 Related
      Should I upgrade the IE7 version that shipped with Windows Vista Feb06 CTP or is it the latest and/or the only version that can work with this build...
    3. Multi-line TextBox - Paste text with numbered list, bullet list, tab character
      Hi All, I need a server control that's exactly like a multi-line TextBox, but also allow users to paste text with numbered list, bullet list, and...
    4. #25625 [NEW]: [chm] bug on ref.ftp.html | ftp_*list cant retrive ftp list on some ftpd
      From: sentomas at hotmail dot com Operating system: freebad PHP version: 4.3.3 PHP Bug Type: FTP related Bug description: ...
    5. Subset of values in value list - related only
      Chris: Thank you so much for your help. I found an article on the FM site as you suggested that I think will answer all my questions. Regarding...
  3. #2

    Default Re: List Related Fun

    > Coming from a flash background I'm always trying to recreate things that
    seemed simple in Flash's actionscript in Director. I'm using 8.5 and what
    I'm trying to create is a 2 dimensional array..

    I didn't know you could use Flash's actionscript in Director. ;)


    Since I don't know Actionscript well, I can only guess what this array
    actually looks like. So I'm going to take a stab. Are the entries "bob"
    and "uncle" representing a property/data pair?

    If so then you'd want a property list

    propList = [:]
    propList.addProp ("Bob", "Uncle")
    propList.addProp ("Brad", "Village Idiot")

    or you could hard code it as

    propList = ["Bob": "Uncle", "Brad": "Village Idiot"]

    You would access the pairs several ways but one way is:

    propList ["Bob"]

    which would equal "Uncle"

    but you could also get values by position, get properties by value, etc.


    A true two dimensional array would look something like:

    twoDimArray = [["Bob", "Uncle"], ["Brad", "Village Idiot"]]

    or could be assembled:

    twoDimArray = []
    twoDimArray.add (["Bob", "Uncle"])
    twoDimArray.add (["Brad", "Village Idiot"])

    In this case you could access values by number or find a values position

    twoDimArray [1] would give ["Bob", "Uncle"] but
    twoDimArray [1][2] would give "Bob"

    twoDimArray.getOne (["Bob", "Uncle"]) would give 1 as a result

    >
    > In Flash it was as easy as:
    >
    > function createObject(objA, objB){
    >
    > this.objA= objA;
    > this.objB= objB;
    >
    > }
    >
    >
    > var anArray = new Array(2);
    > anArray[0] = new createObject("Bob","Uncle");
    > anArray[1] = new createObject("Brad","Village Idiot");
    >
    > Once this was set finding an object was easy...
    > anArray[1].objB would equal "Village Idiot".
    >
    > So its this I'm trying to achieve, an easy way to create a 2D array,
    populate it and then how to access it... I've been looking everywhere for
    pointers but there are only notes on one dimensional arrays (straight
    forward lists).
    >
    > Any pointers would be greatly appreciated on this matter.
    >
    > Many thanks for your time,
    > Meeesta
    >
    >

    Word of Mouth Productions Guest

  4. #3

    Default Re: List Related Fun

    Thanks for the responses... I've actually managed to get a 2d 'array' (okay list) running in Director now.. and how to collect info from it.

    Now at the moment I've got a list drives on the users machine, now what I want to do is check each one individually for type and size.. And thanks to buddy API I can do that...

    discsList = baDiskList()

    which gives me a list of -

    discsList[1] = "A:\"
    discsList[2] = "C:\"
    discsList[3] = "D:\"
    discsList[4] = "E:\"
    discsList[5] = "F:\"

    Now obviously this will change from machine to machine so the length of the list will change. How do I extract this?

    The previous example I gave from Flash (by the way I'd never try Actionscript in Director ;-)) -

    var anArray = new Array(2);
    anArray[0] = new createObject("Bob","Uncle");
    anArray[1] = new createObject("Brad","Village Idiot");

    To get the length of this was as easy as -
    var arraySize = anArray.length

    which in this case would return a length of 2. I tried discsList.length -

    repeat with i = 1 to discsList.length
    -- Lingo of a madman --
    end repeat

    (okay so I did try a little Actionscript in Director) but with the predictable errors and flames from the keyboard.

    So again in a nutshell how do create a repeat with loop with the maximum loop value being the last list element?

    If you can answer this I promise I'll leave you all alone.

    Thanks for your time.

    Cheers,
    Meeesta



    meeesta webforumsuser@macromedia.com Guest

  5. #4

    Default Re: List Related Fun

    Oooops.. found it..

    ..count

    If anyone already posted a response, thanxs anyhow.


    meeesta webforumsuser@macromedia.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139