Displaying random colour in director

Hi, I hope someone can help me with this. Basically I’m
creating a game which consists of empty squares on the screen that
the user fills in with colours, this would be done by the user
pressing different keys, for example if ‘A’ was pressed
the program would identify the key that was pressed and also
identify the colour that is has been allocated ‘RED’
for instance, then it would randomly select an empty square and
fill it with the colour red.
The following code randomly selects a square from a global
list and eliminates it from the list once it has been selected, so
that the program does not select the same square again, as well as
check if any squares are empty.
However I have a problem in terms of getting the program to
fill the selected square with a colour, I have tried everything but
seem to get nowhere
. Hope someone can help me with this.
Thanks in advance
on keydown
global gList
vMax = gList.count
if not vMax then
exit
end if
vIndex = random(vMax)
vSquare = gList[vIndex>
gList.deleteAt(vIndex)
if the keypressed="A" then vColour = rgb(255,0,0)and
vColour=vSquare
else
if the keypressed="B" then vColour = rgb(255,128,0)and
vColour=vSquare
end if
end if
end keyDown

Thanks for the tip
I really appreciate it, I had to tweak my code a bit
but it works now
heehee. However I had another question, don't know if
you can help with this again or anyone else at all, is it possible
for me to define a range from which the colour can be chosen, for
example rgb (255,255.255) to rgb(200,200,200)??....as I’m not
sure if Director recognises the colours in-between the two sets I
have specified i.e: rgb(225,225,225)?

Similar Messages

  • There are randomly coloured pixels appearing on my MacBook Pro LED when I attempt to open or preview a media file.  Is this the graphics card?

    I recently had to switch out the hard drive on my Early 2011 13" MacBook Pro.  When I got the computer back from the Apple Store I began loading my old content onto the machine.  When previewing and opening files, they would appear with randomly coloured splotches of pixels on them.    This continues to happen when browsing folders on my machine.
    The files do not show up with splotches on other computers, and are not in the same places each time I open the file, which leads me to believe they are problems with my machine and not the files themselves.
    I hypothesise this is the graphics card, but I don't know enough about the hardware to know for sure.  Any help would be greatly appreciated.
    See examples below.

    To follow-up.  The problem has gotten worse, as it not only displays glitches during file previews, but imprints glitches on exported files.  No good.
    There are many issues popping up now related to 15" and 17" MacBook Pros from 2011, and I wonder if this is a related issue.   In either case, I would love a response from someone at Apple about this issue.
    See possibly related issue here:
    2011 MacBook Pro and Discrete Graphics Card
    And some updated screenshots of exported files:

  • Random coloured squares occurring all over my Mid 2010 21.5" iMac

    Ever since I got my iMac repaired by replacing my graphics card my iMac has had a display problem with random white/random coloured blocks appearing all over my screen. I reset the RAM and the problem went a away for a while. But it has returned and I tried reseting the RAM again but nothing happened this time. Please help!

    For some uknown reason, some ISP provided wireless modems (which are often low cost / old technology boxes geared for Win XX clients) don't like iMacs. And, they don't like lots of clients connected to them either. If wondering, my ISP provided me a 2-Wire modem (which is both wired and wireless) and it worked great with 1 wireless and 1 "wired" client. Then, my son added his PS3. Then, my wife added her new iMac. Next thing I know, we're getting unexpectd time-outs and line drops. Somedays it runs great and other days, it drops 5 times within the same hour. After lots of research, it appears the 2-Wire box is NOT iMac friendly. And, it doesn't like many clients either. It's simply "too old or too tired" for our many new technology clients. Today, I'm "on the hunt" for a NEW Technology ISP Modem / wireless box repacement. It's time I upgraded my old technology wire/wireless box anyway.
    Perhaps your existing ISP Modem/Wireless box isn't Mac friendly either? Perhaps you need to upgrade its firmware, change its internal setting or simply replace it - with a "Mac certified" modem box? Something I learned the hard way...
    Good luck....
    Message was edited by: Jack99

  • Menu toolbar icons not displayed in colour when deployed on the Web

    Hello!
    We are developing an application using Forms6i on Windows NT.
    Our problem is that menu toolbar icons are not displayed in colour when the application is deployed on the Web using lookAndFeel = generic. This is the case both when using Microsoft IE5 and Netscape 4.5. When lookAndFeel = oracle, however, the icons are displayed in colour.
    The icons are stored as *.gif files in the same directory as the application *.html file. It does not help to create a virtual path /web_icons/ in the www listener and edit the parameter default.icons.iconpath in the file Registry.dat.
    When running the application as client/server, the menu toolbar icons are displayed in colour as expected.
    Any ideas on how to solve this problem?
    Regards,
    Kjell Pedersen
    Nera SatCom AS
    Norway
    null

    Hi,
    I got the same problem and I didn't figure out, how to solve this problem.
    But did you try to printout the form anyway? I guess you will see the icons on the printout, won't you?
    Regards
    Dirk

  • When I watch any videos the pixels of the video go random colours

    when ever I watch videos or even go on facetime the screen goes blurry and random colours but only where the video is not the whole screen

    Most YouTube content requires Flash. Apple does not support Flash for iOS devices.
    Try using the pre installed YouTube app. 

  • How to split a html page without frames and display random questions

    1) In my online examination application i need to display timer at the top of the page. even if the user
    scrolls down the timer should be visible. is there any way to do this without frames.
    2) questions are displayed randomly for each user. iam using rand() function to retrieve the questions from mysql database. now the problem is if the user refresh the page another set of questions are displayed. how to avoid this.
    thanks

    Hi Thanuja,
    Can you try it with the one below..... and checkout whether tht works or not
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
      </head>
    <script language="javascript">
    var i=0
    function showDate()
    i=i+1
    document.getElementById("staticcontent").innerHTML= "<center><b>Time :  " + i +" secs</b></center>"
    setTimeout("showDate()",1000)
    </script>
    <body onload="showDate()"> 
    <div id="staticcontent" style="position:absolute; border:1px solid black; background-color: lightyellow; width: 135px;">
    </div>
    <script type="text/javascript">
    //define universal reference to "staticcontent"
    var crossobj=document.all? document.all.staticcontent : document.getElementById("staticcontent")
    //define reference to the body object in IE
    var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
    function positionit(){
    //define universal dsoc left point
    var dsocleft=document.all? iebody.scrollLeft : pageXOffset
    //define universal dsoc top point
    var dsoctop=document.all? iebody.scrollTop : pageYOffset
    //if the user is using IE 4+ or Firefox/ NS6+
    if (document.all||document.getElementById){
    crossobj.style.left=parseInt(dsocleft)+5+"px"
    crossobj.style.top=dsoctop+5+"px"
    setInterval("positionit()",100)
    </script>
    <%
    /* JSP LOGIC*/
    %>
    <!-- Customized HTML content -->
    </body>
    </html>REGARDS,
    RaHuL

  • Why does Mozilla Firefox display white colour checkered in yellow?

    The browser displays white colours as checkered. And clearly it is not an issue of wrong backgound - checs change when I scroll a page up or down. I've tried reinstalling Firefox but nothing changed. What may cause the problem?

    Try to disable hardware acceleration.
    *Tools > Options > Advanced > General > Browsing: "Use hardware acceleration when available"
    If disabling hardware acceleration works then check if there is an update available for your graphics display driver.
    *https://support.mozilla.org/kb/how-do-i-upgrade-my-graphics-drivers
    You can also try to disable color management.<br />
    You can set the pref gfx.color_management.mode to 0 on the about:config page to disable Color Management.<br />
    You need to close and restart Firefox to make the change effective.
    See:
    * http://kb.mozillazine.org/gfx.color_management.mode

  • Display Random Tables in Siena

    Hello. I am wanting to display random quotations. So I was thinking about creating excel tables and then displaying them...but how do we leverage the Random function? My apology for the newbie question...I am an analyst, not a programmer, but I would think
    this would be easy to do.
    Essentially, every time the user opens the application, a random text table is displayed.
    Also, I want to have a button to refresh the quote.
    Can anyone provide an example or point to an example of this happening?
    Thanks,
    Chris

    Hi Chris,
    We are definitely happy to have you here! Your question is definitely welcome as Siena is not about being an analyst or programmer, but about having ideas.
    Another approach for this would be to leverage the
    Shuffle() function on your excel data source. Consider the following:
    1) Add a horizontal 'Text Gallery', called Gallery1
    This will allow you to view the quotes data you have stored in your excel data sheet. We also assume your data is in a table called "myQuotes" and therefore, the
    'Items' property of this will be Shuffle(myQuotes)
    2) Add a 'Label', called Label1
    This will be used to display your quotes. Say you have a column called "Quote" with the "myQuotes" data set. Then we will set the
    'Text' property of Label1 to First(Gallery2!AllItems)!Quote. This way every time,
    Shuffle() gives us a re-ordered list of the quotes,
    First() takes the first one of the top and forwards that into Label1.
    3) Taking this further with a button, we will add a Button to the canvas, called
    Button1
    This button will be used to switch to the next or new quote. We will accomplish this via the
    Refresh() function, where we call thus function on the Data Source. Now the caveat here is that, excel does not work with
    Refresh() since it is a static source of data. If you used the Azure Mobile Services data source for example and we keep the same name for the table, then you could do
    Refresh(myQuotes).
    This will allow us refresh the source, which in turn will be shuffled into the gallery, from which we pick the first one to display in the label.
    4) Now that this is all said and done. You can now hide Gallery1
    from your users via selecting Gallery1 and setting its 'Visible'
    property to 'false'
    Hope this inspires some other ideas.

  • I was updating my ipod touch to iso 6.1 ans when it restarted after the update it froze and i held the lock button and home button down to restart it and it goes to random colour screens

    I was updating my ipod touch  to iso 6.1 (i think) and when my ipod restarted after the update it froze on the loading bar so i held the lock and home buttons down to restart my ipod it showed the apple logo for a few seconds then the screen went random colours.  I tried to let the battery drain  then plug it into the computer but it doesen't recognize it when i connect it.
    Please help!!!

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • Volume button displays randomly on screen

    volume button displays randomly on screen

    It sounds like you have some sort of Backup software that mounts an external drive or network drive periodically.
    Generally Macs become less responsive during backups -- and that might explain the jerky mouse movement.

  • My Screen Display Has Random Coloured Lines?(IPad Mini3)

    I do not know how this happened. All I did was put it in my bag and when I took it out to read some books this is what appeared...Please Help It Would Mean Alot...

    jazcan
    I think you meant to link to the 'Tap tap tap' solution(?) > Re: iPad dropped, now with red screen/background ... although the success story adds credibility!
    (tiny connector ribbons w/ plugs on the ends that sometimes jiggle loose can sometimes be UNjiggled)
    FWIW, I have an old PowerBook that got wacky display, and it indeed was the ribbon connection - old PBs can be easily user serviceable, but iPads no can do.
    ÇÇÇ

  • IMac hooked up to HDTV - display and colours

    Hi
    I have hooked up my iMac to my HDTV Panasonic TC 26LX70
    It works pretty well, i have 2 issues though:
    Each time i hook up the imac to the hdtv, the display for my imac changes automatically. I tried to find the good setting in systems preferences but so far nothing great. I still have the display of the imac re-initializing eah time
    The colours on the HDTV are not as good as on the iMac screens, they are more "HDTV" like, too bright, too flashy. How can i get the same ones than on the mac?
    Please I would appreciate your opinions
    Thx

    If you have it set to +Mirror Displays+ in System Preferences Displays pane Arrangement tab, you should uncheck that setting. Then, the two screens together will show an extended Desktop, as represented in the diagram on that preference pane, and you will be able to set the resolution on the two screens independently. So you can use the optimum settings for each screen; the standard HD resolution for most HDTVs is 1920x1080 (1080p).

  • Thunderbolt display changes colour temperature when in full screen mode

    27" Thunderbolt Display connected to MacBook Air (2011) changes colour temperature when in full screen mode. Switching any setting in System Preferences/Displays changes it back to the correct colour. I have also seen this on a 24" LED Display (Display Port) connected to a Mac Book Pro (2011).

    I describe my problem here. I think it's similar, can you see if the console gives you the same error?
    https://discussions.apple.com/message/20162986#20162986

  • Macbook Pro will only display basic colours

    I set up my macbook pro to run dual monitors with my 20 inch LG display. It worked fine for a bit but then decided to run to only basically colours, probably 256 colours. I then shut it off and tried it again the next day thinking it was a heat issue, and the problem was still there.
    I tried to change it in the options menu and it already says it is set to millions of colours. The weird part is that when I boot windows the colour is fine and I have no trouble playing games.
    Does anyone know any solutions to this problem, or have they heard of it before?

    Open the Universal Access pane of System Preferences, click on Seeing, and move the Contrast slider all the way to the left unless it's there already.
    (21549)

  • Page Displaying Randomly in Dreamweaver CS5

    Has anyone had any issues with a page loading randomly and other times displaying the message "Internet Explorer cannot display the webpage".  This is when you view the site in IE8 after highlighting index.htm and pressing F12 from Dreamweaver.  I'm building the site using Dreamweaver CS5.  Things I've done so far to try and work out where it is failing: 
    1. I have a number of other menu items working perfectly.  I have checked the code against the other menus that are working perfectly. This includes comparing menu.htm, menu.js and checking the code at the top of page01.htm.
    2. Copied the code into validator.w3.org and check it.
    3. Cleared the cache, browsing history etc.
    Appreciate any suggestions.

    Thanks so much Murray.  Late yesterday afternoon, I fixed it the "hard" way by copying one of the working folders and replacing all the text from the page that wasn't displaying correctly.  It seems to have fixed the issue. Thanks again for your offer to look at the code.

Maybe you are looking for

  • Changing details in Service PO

    In a Service PO, the problem I am facing is that entering in Purchase Order "Item Category in Purchasing Document" (column I) the value D (services) automatically declares the unit in terms of AU (Activity Unit). Hence, when I go for the output (prin

  • DW CC new document types limited?

    I just installed DW CC, and the dialog for "File...New...Blank Page" is limited to 12 types, and the starter layouts are also few. (For example, just 2 layouts for a HTML page). CFM and CFC are not even on the Page Type list. I do see the starter fil

  • Unable to map a disk drive connected to the Airport Extreme

    I just bought an Airport Extreme and connected a disk (Iomega Minimax) though the USB. I can see that the disk is connected (in the AirPort tool, and I can manually map it on my laptop (XP) using the IP-adress. Unfortunately I also have a PC (also an

  • Address book -- exporting addresses

    Does anyone know how to export e-mail addressses from the address book so that they can be used in gmail? Thanks! susan

  • Downloading a movie on Apple tv takes forever why

    Downloading an Apple tv movie takes so long why, operator ?