Boolean value does not get stored in table correctly?

Hello

I use the following table to store several variables for similar movieclips:

public var ballPlaced:Array = new Array(false, false, false);

... However, its not to store the Boolean value correctly in the table?

I use the following code in the ZoneFill and the ZoneEmpty to assign a value true or false, for example;

ballPlaced [event.target.name.substring (5)] = true;

I called a trace to ensure that when an individual ball is placed in an area of the ballPlaced Boolean is true, and that seems to work because it returns a true value... However, I then called a trace to see the status of all and that is to say that all instances of the table are false?

For example, I put ball0_mc in a box and the trace returns the following...

Placed ball0_mc (true)
Ball 0 is set, false: 1 ball is placed, false: ball 2 is set, false

In this case the second line at the beginning should read "ball 0 is placed, it's true." I know I'm missing something critical here, but can't work out why the Boolean value is not get stored in the array?

Here is my code... pointers would be greatly appreciated!

package
{
    import flash.display.MovieClip;
    import flash.display.DisplayObject;
    import flash.events.MouseEvent;
    import Ball;
       
    public class EgoGame extends MovieClip
    {
        public var _zone0Full:Boolean = false;
        public var _zone1Full:Boolean = false;
        public var _zone2Full:Boolean = false;
       
        public var ballPlaced:Array = new Array(false, false, false);
       
        public function EgoGame()
        {
            ball0_mc.addEventListener(MouseEvent.MOUSE_DOWN, zoneEmpty);
            ball1_mc.addEventListener(MouseEvent.MOUSE_DOWN, zoneEmpty);
            ball2_mc.addEventListener(MouseEvent.MOUSE_DOWN, zoneEmpty);
           
            ball0_mc.addEventListener(MouseEvent.MOUSE_UP, zoneFill);
            ball2_mc.addEventListener(MouseEvent.MOUSE_UP, zoneFill);
            ball1_mc.addEventListener(MouseEvent.MOUSE_UP, zoneFill);
           
            ball0_mc.addEventListener(MouseEvent.MOUSE_UP, playMovie);
            ball1_mc.addEventListener(MouseEvent.MOUSE_UP, playMovie);
            ball2_mc.addEventListener(MouseEvent.MOUSE_UP, playMovie);
           
               
        private function zoneEmpty(event:MouseEvent):void
        {
            if(event.target.hitTestObject(zone0_mc) && _zone0Full == true)
            {
               _zone0Full = false;
                ballPlaced[event.target.name.substring(5)] = false;
            }
            else if(event.target.hitTestObject(zone1_mc) && _zone1Full == true)
            {
                _zone1Full = false;
                ballPlaced[event.target.name.substring(5)] = false;
            }
            else if(event.target.hitTestObject(zone2_mc) && _zone2Full == true)
            {
                _zone2Full = false;
                ballPlaced[event.target.name.substring(5)] = false;
            }
            else
            {
                event.target.x = event.target._startX;
                event.target.y = event.target._startY;
                ballPlaced[event.target.name.substring(5)] = false;
            }  
            }
       
        private function zoneFill(event:MouseEvent):void
        {
            if(event.target.hitTestObject(zone0_mc) && _zone0Full == false)
            {
                event.target.x = zone0_mc.x;
                event.target.y = zone0_mc.y;
                _zone0Full = true;
                ballPlaced[event.target.name.substring(5)] = true;
                trace(event.target.name + " Placed (" + ballPlaced[event.target.name.substring(5)] + " )");
            }
            else if(event.target.hitTestObject(zone1_mc) && _zone1Full == false)
            {
                event.target.x = zone1_mc.x;
                event.target.y = zone1_mc.y;
                _zone1Full = true;
                ballPlaced[event.target.name.substring(5)] = true;
                trace(event.target.name + " Placed (" + ballPlaced[event.target.name.substring(5)] + " )");
            }
            else if(event.target.hitTestObject(zone2_mc) && _zone2Full == false)
            {
                event.target.x = zone2_mc.x;
                event.target.y = zone2_mc.y;
                _zone2Full = true;
                ballPlaced[event.target.name.substring(5)] = true;
                trace(event.target.name + " Placed (" + ballPlaced[event.target.name.substring(5)] + " )");
            }
            else
            {
                event.target.x = event.target._startX;
                event.target.y = event.target._startY;
                ballPlaced[event.target.name.substring(5)] =false;
                trace(event.target.name + " Placed (" + ballPlaced[event.target.name.substring(5)] + " )");
            }
            trace("ball 0 is placed, " + ballPlaced[0] + "  :  ball 1 is placed, " + ballPlaced[1] +"  :  ball 2 is placed, " + ballPlaced[2]);
        }
       
        private function playMovie(event:MouseEvent):void
        {
            if (ballPlaced[0] == true)
            {
                ball0_mc.gotoAndPlay(2);
            }
            else
            {
                ball0_mc.gotoAndStop(1);
            }
           
            if (ballPlaced[1] == true)
            {
                ball1_mc.gotoAndPlay(2);
            }
            else
            {
                ball1_mc.gotoAndStop(1);
            }
           
            if (ballPlaced[2] == true)
            {
                ball2_mc.gotoAndPlay(2);
            }
            else
            {
                ball2_mc.gotoAndStop(1);
            }
        }
       
       
    }
}

have you checked to see what event.target.name.substring (5) is back?  (TIP: check it out)

Tags: Adobe Animate

Similar Questions

  • AF:table value of text entry box does not get stored in the database.

    Hello
    I use af:table in my jsff page. The table contains the column of text entry box. After clicking the Create (+) button, a line has been added to the table. I got value into the text entry field and click the 'OK' button to commit the transaction. When I check the database, the entered value is not stored in the database. What I've observed, it's that if I have more than 1 table in the af: table and after entering the value into the text entry field, if I tab out and control moves to the next line, and then click the OK"" button. This time, the value you entered get stored in the database. It's look like, the value of current row is not updated until the action tab. Please help me solve this problem.

    JDeveloper version: 11.1.1.6

    Kind regards
    Suresh

    Hello

    What is the business service associated to this? Also the OK button have no immediate = true set

    Frank

  • Select in 1 table only if a value does not exist

    Hi all
    I have problems, develop a single select statement to accomplish a single return value. I tried variations of DECODE and COALESCE, but it eludes me.

    I have two tables which are as follows:

    NAME
    ID FULLNAME
    1, senior officer
    Junior 2,
    3, Mister
    4, Senor
    5, Miss

    ABBREVIATION
    ID, ABBR.
    1, Sr
    2, jr
    3, M.
    5, ms

    What I want to do is choose from the table NAME only if that the value does not exist in the ABBREVIATION table.
    Ideally if I were to do something like:

    SELECT * FROM... WHERE (ID = 1 or ID = 2 or ID = 4)...

    I would get the following output:

    1, Sr
    2, jr
    4, Senor

    Thanks for reading!

    You want an outer join.

    SELECT decode(a.abbrev, NULL, n.fullname, a.abbrev)
    FROM name n,
    abbreviation a
    WHERE n.ID = a.ID(+)
      AND ....
    

    Something like that.

    Complete example:

    with n as (
    select 1 as ID, 'Senior' as FULLNAME from dual UNION ALL
    select 2 as ID, 'Junior' as FULLNAME from dual UNION ALL
    select 3 as ID, 'Mister' as FULLNAME from dual UNION ALL
    select 4 as ID, 'Senor' as FULLNAME from dual UNION ALL
    select 5 as ID, 'Miss' as FULLNAME from dual),
    a as (
    select 1 as ID, 'Sr' as ABBREV from dual UNION ALL
    select 2 as ID, 'Jr' as ABBREV from dual UNION ALL
    select 3 as ID, 'Mr' as ABBREV from dual UNION ALL
    select 5 as ID, 'Ms' as ABBREV from dual)
    select decode(a.abbrev, NULL, n.fullname, a.abbrev)
    from a, n
    where n.id = a.id(+)
    order by n.id;
    
    ID                     DECODE(A.ABBREV,NULL,N.FULLNAME,A.ABBREV)
    ---------------------- -----------------------------------------
    1                      Sr
    2                      Jr
    3                      Mr
    4                      Senor
    5                      Ms                                        
    
    5 rows selected
    

    Published by: tk-7381344, November 17, 2008 13:31

  • Cluster of Boolean controls does not expect update

    Hello

    I'm confused about the following question: in the joint Test Cluster of Boolean controls Functionality.vi, I have a Boolean controls group, some disabled and grayed out, other permits. If I click on one of two Boolean controls permits, and then on the other hand, I want the Boolean selected first control to False. Update Cluster indicator shows the desired behavior. What confuses me, is that the new value does not update accordingly. When I clicked at least once on two Boolean values, the new value remains [TRUE, TRUE] at all times, and the structure of the event runs.

    I have a work around, as shown in the Test Cluster of Boolean controls feature Workaround.vi, but it looks like 'Nice' no, because it's more complicated than necessary. Anyone know why the new value refreshes as expected? Please notify. Thank you.

    Best regards

    Peter

    Here is a simple solution.

    Of course, you can use a container of radiobutton instead of a cluster for simpler code. Try it!

  • Reset the default value does not

    'Reset to the default value' does not work for my ListBox multicolumn, but it works for my string flags.  Someone at - he never encountered this before?

    I tried to remove all the elements and setting "default value to', but after another execution of the program, still not reset to nothing.  I have to do it programmatically in my code, and I can't do using the server reference VI Reset at the same time.  I have to define arrays of strings individually to null.

    I use a large number of nodes of property in my loop of consumer to read/write the values in the front panel.  Not sure if this is related.

    Thank you.

    This occurs because the value of a multicolumn listbox is a digital scalar or table (depending on the selection mode of the control) Express which line or the currently selected cell.

    "Reset to default" only resets the values and no other properties. In this case, it is the property of ref that hosts that we consider intuitively the value of listbox mc, but it's not.

  • OBIEE error - Datetime-01-01 value does not match the specified format

    I get this error after the promotion of Production. It works perfectly well on the Test Server.

    I am using SQL server. After launching the date as a varchar, it works fine.

    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 43113] The message returned by OBIS. [nQSError: 43119] Query Failed: [nQSError: 46046]-01-01 Datetime value does not match the specified format. (HY000)

    Gurus of OBIEE please help

    JD

    I found the solution as well.

    The Windows Server ODBC driver was old (Version 6). I have who has upgraded to SQL Server Native Client 11.0 and everything works fine.

  • addInstance does not work when the table has no rows

    I am trying to add a line to an empty table (no line) and it seems that addInstance does not work.

    table. Row. instanceManager.addInstance (1);

    Is there a different syntex if the table has no line?

    Thank you

    Try to use the shortcut to underscore for the instance Manager, it allows you to get items that do not yet exist.

    Then

    table.row.instanceManager.addInstance (1);

    becomes

    table._Row.addInstance (1);

  • Data do not get stored when entered in the online form

    Hello

    When I enter data in a form online and save its does not get recorded and the data entered is lost. Please let me know if I missed any parameters.

    Thank you
    Sravan

    Good reading this post it connects to other posts on the same topic:- does not record data values

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • Query does not get scanned with Explain plan index

    Hello
    I have a table with Index XXQP_SAMPLE_N1 in PROCESS_FLAG column. When I run the query below and see the plan to explain it, this table is to get access full table (with red color in Toad). It's not scan with the index. I also analyzed the table with command below. can anyone tell why he does not get scanned with index?

    exec DBMS_STATS.gather_table_stats ('XXQP', 'XXQP_SAMPLE', estimate_percent = > 30, cascade = > true);

    SELECT
    *
    Of
    XXQP_SAMPLE
    WHERE
    process_flag = 1;

    Thank you

    the number of records in the table to satisfy the condition process_flag = 1

    I wrote a little note on this topic. Reade case 1. It may be of your interest.

    http://karthickarp.blogspot.com/2008/12/it-is-often-asked-why-SQL-is-going-for.html

    Published by: Karthick_Arp on April 15, 2009 01:41

  • How the LED lights up when a threshold is reached, then turns off only when the value does not reach the threshold for a while?

    Hi, I want to write a program that can turn on the LED when a range of value, this is the threshold and only when the value does not reach the threshold for a period of time, say 5 seconds, then the LED will turn off, otherwise it will remain. How can I achieve this in labview? Can someone help me? Really thanks!

    I assume that you use a while loop to keep the updated value.

    Add a record to offset to your looping it initialize with a U32 (time in ms)

    Add the registry to offset to your loop that keeps the previous value of your bool

    When your reaches the threshold value => the light and set the current time in your shift register.

    In the next iteration of the loop weather check value is still above threshold

    => Y-online previous set to true?

    => Y-online the next iteration

    -Online N => turn switch on and set the current time in your shift register.

    -Online N => subtract the time current less time shift record-online more then 5 seconds?

    => Is => keep turning on

    -Online N => turn given

  • burner does not get recognized

    The computer is HP pavilion 7955, XP home edition.

    There are two features of optical disc.

    The first is a HP cd-writer. This device does not get recognized and does not appear in my computer screen. When the button open the tray, there is no green light or the drawer opens.

    The second is a DVD-ROM HITACHI GD - 8000. This device is recognized and appears in my computer screen.

    A floppy drive A appears on the screen of my computer, although there is no floppy drive.

    Hello

    · The CD burner has been recognized before?

    · Do you remember any changes made on the computer?

    You can follow the steps in the link below and check if this can help: your CD-ROM drive or DVD drive is missing or is not recognized by Windows or other programs: http://support.microsoft.com/kb/982116

  • Google chrome does not get updates

    my google chrome is not updating.after some time it says error3 and I don't know how to solve this problem, as EMI does not get the updates ive tried going by default on my settings for no result .hope could someone help me with this.

    Thank you stephanie, but in the meantime idid a system restore to see if I could fix it but now im, e get updates are disabled by the administrater ime so no further forward.

  • SA520W does not get an IP on the WAN option

    We use a SA520W as our main router and have a fiber attached to the interface default WAN connection. We would like to improve our availability using a secondary internet connection on the WAN interface option.

    We bought a router dovado tiny 4g for this another connection. It acts as a dhcp server, but the Cisco router does not get an IP address from the dovado router. The router works as expected when it is connected to a normal computer. But somehow the cisco router does not get an IP address.

    I also tried to put a static IP address for the Cisco router, but that did not help either. The dovado router is setup deliver ip in the range of 192.168.0.2 - 254

    Link is established, but State wide AREA network is down. Any ideas?

    Christian,

    Make sure that the port option is set to WAN and WAN mode = MODE of LOAD BALANCE. If not pull an ip address or to negotiate a connection.

    Jasbryan

  • I have someone using PSCS4, and when she creates a pattern fill layer, it does not get a mask.

    I have someone using PSCS4, and when she creates a pattern fill layer, it does not get a mask.

    Any ideas on how it could have turned off and how we can re-enable default?

    I check its settings panel menu and "Add default mask" is checked.

    Thank you!

    She changed the Layer palette settings to not automatically create a mask with layers of filling.

    Is not an adjustment layer, so the adjustment layer setting does not apply (and two parameters should really be in the layers palette in order to reduce the confusion).

  • a key for the table does not exist in the table

    Hi guys,.

    I imported several tables of physical layer in the administration tool. So, I want to do new foreign key between tables join in the physical schema.
    Required fields for posting a link between these tables are set up. When I press the ok button, an error message is displayed:
    "a key corresponding to the table does not exist in the table blablabla. You want to create a? »

    In fact, what is this error? I don't have all the idea about it. The number of the type of the fields is the same, the names are also the same. I think that he should not have problems to make the new foreign key. But why is it happening?

    Thank you

    Hello

    It is the primary key of the first table. You might not have set this column as the primary key of this table at the level of the db.

    Thank you
    Imtiaz.

Maybe you are looking for