Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: FLASH: Array resizing...
From: Nathan Dicken
Date: Thu, 13 Jan 2000 21:44:38 GMT

Miles,

Glad the code worked out for you. I'll have to give that code that you
provided a try... I agree - seems like a ton of code to do the same thing
that Lingo could do in like 2 lines of code. However I've found that this
method works good and Flash seems to fly through it pretty fast.

Is your game posted up anywhere?

Take care,
Nathan


>Hey Nathan,
>
>At 5:29 AM -0800 13/01/2000, you wrote:
>>Miles,
>>
>>This is definitely possible and can get complicated pretty easy. In this
>>case, you want to access a value in the list (array) that is only 1
>>character long. If you wanted to access "AB" or "DE" and then resize the
>>list it would just take some changes to the code below...
>
>Thanks mucho for the code. Using it, I finally got it to work in my game.
>
>FYI, here are my test routines. Just create a button and Call
>"SetColorIndex" from its release command to see them in action.
>
>SetColorIndex
>-------------
>Call ("MakeColorArray")
>Set Variable: "randColor" =
>Random(Length(colorArray) + 1)
>Set Variable: "colorIndex" =
>Substring(colorArray, randColor, 1)
>Trace ("colorArray = " &
>colorArray)
>Trace ("colorIndex = " & colorIndex)
>Trace
>("----------------------")
>
>MakeColorArray
>--------------
>Set Variable: "colorArray" = 1234
>Set Variable: "tempArray" = ""
>Set Variable: "fullColors" = ""
>Set Variable: "i" = 1
>Comment: -- loop through all buckets getting their counts and colors
>Loop While (i <= 4)
> Set Variable: "curBucketColorCount" = Random(2)
> Set Variable: "curBucketColor" = i
> Trace ("curBucket = " & "bucket0" & i)
> Trace ("curBucketColorCount = " & curBucketColorCount)
> Trace ("curBucketColor = " & curBucketColor)
> If (curBucketColorCount = 1)
> Set Variable: "fullColors" = fullColors & curBucketColor
> End If
> Set Variable: "i" = i + 1
>End Loop
>Trace ("fullColors = " & fullColors)
>If (fullColors eq "")
> Comment: -- if no buckets full use all colors
> Set Variable: "tempArray" = 1234
>Else
> Comment: -- loop through colorArray comparing the entries in
>fullColors to each entry in colorArray. If there is a match don't add it to
>tempArray
> Set Variable: "j" = 1
> Loop While (j <= Length(fullColors))
> Set Variable: "giValueToFind" = SubString(fullColors, j, 1)
> If (tempArray = VOID)
> Set Variable: "giList" = colorArray
> Else
> Set Variable: "giList" = tempArray
> End If
> Call ("GetIndex")
> Set Variable: "listCount" = Length(giList)
> Set Variable: "listChoice" = giResult
> Set Variable: "listPrior" = SubString(giList, 1, listChoice - 1)
> Trace ("listPrior = " & listPrior)
> Set Variable: "listRemainder" = SubString(giList, listChoice +
>1, listCount-listChoice)
> Trace ("listRemainder = " & listRemainder)
> Set Variable: "tempArray" = listPrior & listRemainder
> Set Variable: "j" = j + 1
> End Loop
>End If
>Set Variable: "colorArray" = tempArray
>
>GetIndex
>--------
>Comment: -- the prefix gi = GetIndex. This is used so that other routines
>won't accidentally write over the values used by GetIndex and GetIndex
>won't write over the values used by other routines. giList must be a
>string.
>Comment: -- uses giValueToFind and giList as a way to pass
>parameters to this routine. The result is in giResult.
>Trace
>("giValueToFind = " & giValueToFind)
>Trace ("giList = " & giList)
>Set
>Variable: "giIndex" = 1
>Set Variable: "giFound" = "FALSE"
>Set Variable:
>"giResult" = ""
>Set Variable: "giListCount" = Length(giList)
>Loop While
>(giIndex <= giListCount)
> If ((SubString(giList, giIndex, 1) eq
>giValueToFind) AND (giFound eq "FALSE"))
> Set Variable:
>"giResult" = giIndex
> Set Variable: "giFound" = "TRUE"
>
>Else
> Set Variable: "giIndex" = giIndex + 1
> End If
>End
>Loop
>Trace ("giResult = " & giResult)
>
>
>A lot of work to just delete entries from a 1 dimensional array.
>
>Anyone have a set of generic linked list routines so that we can have array
>functions in Flash. I don't have time to write them now. Maybe later if
>someone else doesn't beat me to it.
>
>
>
>Ciao,
>
>m i l e s
>_______________________________________________________________________
>
>m i l e s l i G h T w O o d
>_______________________________________________________________________
> m i l e s G T O @ p o b o x . c o m
>_______________________________________________________________________
>multimedia development: director lingo shockwave java +1 213.353.9850
>
>
>
>
>flasher is generously supported by...
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Streaming Media WEST '99 Conference & Exhibition
> "The Worlds largest Internet Audio & Video Event"
> December 7 - 9, San Jose Convention Center, California
>
>Reserve your space today at http://www.streamingmedia.com
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> To unsubscribe or change your list settings go to
>http://www.chinwag.com/flasher or email helpatchinwag [dot] com




flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Streaming Media WEST '99 Conference & Exhibition
"The Worlds largest Internet Audio & Video Event"
December 7 - 9, San Jose Convention Center, California

Reserve your space today at http://www.streamingmedia.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  Re: FLASH: Array resizing..., m i l e s l i g h t w o

Replies
  Re: FLASH: Array resizing..., Nathan Dicken
  FLASH: Array resizing..., m i l e s l i g h t w o
  Re: FLASH: Array resizing..., m i l e s l i g h t w o

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]