Problem of conditional logic!

Hello

Recently, I've been making a Flash game, and I'm to the point where I need counters to move according to what the roll of. However, I can't make it work!

Here is my code so far. It's about 100 lines!

import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.text.TextField;
import flash.events.MouseEvent;


This stops the animation.
Stop();
This ends the current game being played and takes you back to the Welcome screen.
closeButton.addEventListener (MouseEvent.CLICK, myClosingHandler)
function myClosingHandler (evt) {}
gotoAndStop ("WelcomeScreen")
}
The code below allows you to "fullScreenButton" activate / disable Mode full-screen.
this.fullScreenButton.addEventListener (MouseEvent.MOUSE_UP, toggleFullScreenPlay);
function toggleFullScreenPlay(event:MouseEvent) {}
If (stage.displayState == "fullscreen") {}
stage.displayState = "normal";
} else {}
stage.displayState = "fullscreen";
}
}
/ * Determines the following code, with a bit of code in the next block.
whose turn it is. Some of the other code is VERY dependent on this.* /
var WhoseTurn:Number = 1;

player1Turn.visible = false;
player2Turn.Visible = true;

playDie.rollButton.addEventListener (MouseEvent.CLICK, myWhoseTurnHandler);
function myWhoseTurnHandler(event:MouseEvent):void
{
trace ("the die has been laminated.");
If (player1Turn.visible == false) {}
player1Turn.Visible = true;
player2Turn.visible = false;
WhoseTurn = 1;
} else {}
player1Turn.visible = false;
player2Turn.Visible = true;
WhoseTurn = 2;
}
}
/ Following components of code activate the counters to move along, the Commission
According to what the die rolled.*.
playDie.rollButton.addEventListener (MouseEvent.CLICK, myRollOneHandler);
function myRollOneHandler(event:MouseEvent):void
{

If (playDie.frame == "rollOne" & & WhoseTurn == 1) {}
Counter1.y = 184;
} Else if (playDie.frame == "rollOne" & & WhoseTurn == 2) {}
Counter2.y = 184;
}
}

playDie.rollButton.addEventListener (MouseEvent.CLICK, myRollTwoHandler);
function myRollTwoHandler(event:MouseEvent):void
{
If (playDie.frame == "rollTwo" & & WhoseTurn == 1) {}
Counter1.y = 288;
} Else if (playDie.frame == "rollTwo" & & WhoseTurn == 2) {}
Counter2.y = 288;
}
}

playDie.rollButton.addEventListener (MouseEvent.CLICK, myRollThreeHandler);
function myRollThreeHandler(event:MouseEvent):void
{
If (playDie.frame == "rollThree" & & WhoseTurn == 1) {}
Counter1.y = 385;
} Else if (playDie.frame == "rollThree" & & WhoseTurn == 2) {}
Counter2.y = 385;
}
}

playDie.rollButton.addEventListener (MouseEvent.CLICK, myRollFourHandler);
function myRollFourHandler(event:MouseEvent):void
{
If (playDie.frame == "rollFour" & & WhoseTurn == 1) {}
Counter1.y = 490;
} Else if (playDie.frame == "rollFour" & & WhoseTurn == 2) {}
Counter2.y = 490;
}
}

playDie.rollButton.addEventListener (MouseEvent.CLICK, myRollFiveHandler);
function myRollFiveHandler(event:MouseEvent):void
{
If (playDie.frame == "rollFive" & & WhoseTurn == 1) {}
Counter1.y = 590;
} Else if (playDie.frame == "rollFive" & & WhoseTurn == 2) {}
Counter2.y = 590;
}
}

playDie.rollButton.addEventListener (MouseEvent.CLICK, myRollSixHandler);
function myRollSixHandler(event:MouseEvent):void
{
If (playDie.frame == "rollSix" & & WhoseTurn == 1) {}
Counter1.y = 700;
} Else if (playDie.frame == "rollSix" & & WhoseTurn == 2) {}
Counter2.y = 700;
}
}

I did a variable that determines whose turn it's a button that lets you switch to fullscreen the Flash drive, blah, blah, blah. Now it there is no error in the compiler or something like that, but will not spend my counter!

An example of code that seems to be miss you somehow is below:

playDie.rollButton.addEventListener (MouseEvent.CLICK, myRollTwoHandler);
function myRollTwoHandler(event:MouseEvent):void
{
If (playDie.frame == "rollTwo" & & WhoseTurn == 1) {}
Counter1.y = 288;
} Else if (playDie.frame == "rollTwo" & & WhoseTurn == 2) {}
Counter2.y = 288;
}
}

So can you Please help me! I think that I pretty much tried everything, but nothing seems to work!

Di Kun <><

here: www.kglad.com/Files/forums/game.fla

Tags: Adobe Animate

Similar Questions

  • Need help with different types of conditional logic in a custom PDF

    Oh the life of a developer - get handed something a non-geek thinks is 'easy' with an unrealistic calendar, and you've never done before :-)

    Asked me to take a PDF custom built by a member of my group and make some changes.  I am running Win7 and using Adobe Acrobat Pro DC.

    What I have to do is essentially variations around a conditional logic; for example:

    If Renseignez Checkbox1, Checkbox2 becomes locked

    If Checkbox1 is filled, ComboBox2 becomes mandatory

    If the user has completed the PDF saved as 'Customer_0123' and goes back in to make changes, may I point out what has changed?

    I'm (very very) new to JavaScript and so I was confuse through some documents, but the "most recent" document, found at Adobe is 10 years old, and I'm not sure that it is always topical.

    Any help would be appreciated...

    Thank you

    Chris

    The best way to associate scripts with boxes is to use the MouseUp event. In this case you can access the value of the new field via event.target. value.

    And Yes, it is correct re the JS Console.

  • Hierarchical queries - problem with condition "begins by".

    Hi people

    I play with the connection by and start with clause and am faced with a particular problem which I can not solve...

    My data set is:

    Create table dates_q
    (start_date date,
    end_date date)
    /
    

    REM INSERTING into dates_q
    Insert into dates_q ("START_DATE","END_DATE") values (to_date('01-JAN-14','DD-MON-RR'),to_date('10-JAN-14','DD-MON-RR'));
    Insert into dates_q ("START_DATE","END_DATE") values (to_date('11-JAN-14','DD-MON-RR'),to_date('20-JAN-14','DD-MON-RR'));
    Insert into dates_q ("START_DATE","END_DATE") values (to_date('10-MAR-14','DD-MON-RR'),to_date('20-MAR-14','DD-MON-RR'));
    Insert into dates_q ("START_DATE","END_DATE") values (to_date('21-MAR-14','DD-MON-RR'),to_date('31-MAR-14','DD-MON-RR'));
    Insert into dates_q ("START_DATE","END_DATE") values (to_date('01-APR-14','DD-MON-RR'),to_date('10-APR-14','DD-MON-RR'));
    

    Now I basically just want to get your hands on hierarchical queries and working with the syntax of various...

    What I now want is, start with the date of April 1 as my start date and work backward to build my 'tree '. The condition of my tree is between two rows; my start and end dates differ from 1 day. If they do not; I don't want these records in my tree.

    And using sys_connect_by_path, I want to get all the way from the root.

    Thus, for example,.

    SELECT a.*,
           sys_connect_by_path(start_date, '|'),
           LEVEL lvl
      FROM dates_q a
     CONNECT BY PRIOR end_date = (start_date - 1)
    

    I get the following output

    START_DATEEND_DATESYS_CONNECT_BY_PATH(START_DATE,'|')LVL
    01.01.201410.01.2014| 1 JANUARY 141
    11.01.201420.01.2014| 1 JANUARY 14 | JANUARY 11, 142
    11.01.201420.01.2014| JANUARY 11, 141
    10.03.201420.03.2014| MARCH 10, 141
    21.03.201431.03.2014| MARCH 10, 14. MARCH 21, 142
    01.04.201410.04.2014|10-MAR-14|21-MAR-14|01-APR-143
    21.03.201431.03.2014| MARCH 21, 141
    01.04.201410.04.2014| MARCH 21, 14. 1 APRIL 142
    01.04.201410.04.2014| 1 APRIL 141

    But for the moment I did not have any starting point... Now comes the FUN part...

    When I give the State of departure; I get a single row :-(

    Example of

    SELECT a.*,
           sys_connect_by_path(start_date, '|'),
           LEVEL lvl
      FROM dates_q a
     CONNECT BY PRIOR end_date = (start_date - 1)
     START WITH start_date = To_Date('01-apr-2014','dd-mon-yyyy');
    

    The result is

    START_DATEEND_DATESYS_CONNECT_BY_PATH(START_DATE,'|')LVL
    01.04.201410.04.2014| 1 APRIL 141

    Just a line...!

    I'm unable to understand this and work more and need help.

    The formation of the tree works only in a 'sense' and I'm going the other way around? Don't know what it means but just something that comes to mind. :/

    Thank you

    K

    P.S. - database is 10g R2.

    Hello

    Thanks for the display of the data of the sample; It is very useful.

    What do you expect the result will be and why?

    LEVEL = 1 contains all rows that meet the condition to START WITH.  The rows that meet the condition

    start_date = To_Date('01-apr-2014','dd-mon-yyyy')

    in this case?  Only the line you actually obtained.

    LEVEL = N (where N > 1) contains all rows that meet the conditions regarding some FRONT CONNECT BY rank level = N - 1.  Since the only line level = 1 to end_date = To_Date('10-apr-2014','dd-mon-yyyy'), lines satisfy the condition

    End_date PRIOR = (start_date - 1).

    ? None.  End_date PREREQUISITE is April 10, while rows with start_date April 11 would fulfill this condition, there is no line on LEVEL = 2 and the query stops there.

    You would have expected this from your previous results.  The line with the start_date April 1 had no children in the previous application, so there no children in any application that has the same State of CONNECT BY.

    Maybe you meant the CONNECT BY condtion to be

    End_date = BEFORE (start_date - 1).

  • conditional logic with vmware tools status

    Hi Guy,

    I am after a few tips here. I try to get a VMware tools State guests. I wrote the below which I think is logical, but doesn't seem to work lol. Maybe I think about this all wrong but any advice is appreciated.

    $VMS = get-VM-name 'some-vm1', 'some-vm2.

    foreach ($objitem to $VMS)

    {

    If ($objitem. PowerState - eq 'Receptor' - and $objitem. (- eq "guestToolsRunning") {Shutdown-VMGuest - VM $objitem - confirm: $false}

    ElseIf ($objitem. PowerState - eq 'Receptor' - and $objitem. ExtensionData.ToolsRunningStatus - eq "guestToolsNotRunning") {stop-VM - $objitem VM - confirm: $false}

    }

    Thank you very much

    Because I think he was part of the code is missing (I added it in red).

    In fact your 2nd condition is a bad property as far as I know. I think we should $objitem. ExtensionData.Guest.ToolsRunningStatus

    The script should be something like this

    $VMS = Get-VM -Name "vm1","vm2" foreach ($objitem in $VMS)
    {
        if ($objitem.PowerState -eq "PoweredOn" -and $objitem.ExtensionData.Guest.ToolsRunningStatus -eq "guestToolsRunning"){
            Shutdown-VMGuest -VM $objitem -WhatIf -Confirm:$false    }
        elseif ($objitem.PowerState -eq "PoweredOn" -and $objitem.ExtensionData.Guest.ToolsRunningStatus -eq "guestToolsNotRunning") {
            Stop-VM -VM $objitem -WhatIf -Confirm:$false    }
    }
    
  • Problem with conditional bid

    HI - hoping that this problem will be easy for someone!

    I have a page with the two regions. A region is a tabform with a SUBMIT (Reg1 label) button. Branch of the watch like going to Page 1 condition showing SUBMIT (Reg1) for the button.

    The last region has a SHIPMENT (Test label) I want to create a branch to another page, but I did it as a shipment so it records the date before leaving the page. The branch shows Go to 25 conditional Page indicating SUBMIT (Test). Everything seems good.

    However, when you press the button in the region don't want it branches to the first branch (based on the sequence). The two buttons go to the Page referenced (even they are supposed to conitional). If I change the order of the sequences, the two buttons go to the lowest order.

    What I am doing wrong?

    Thank you
    Sandie

    3.2.1 using

    Sandie,

    I'm happy that it works.

    Can you please click on the buttons 'Correct' or 'Useful' to award marks.

    Thank you.

    Robert
    http://apexjscss.blogspot.com

  • Problem in the logic of the program

    Hey

    In my application, I have a labelfield which is clickable.

    When I click it another screen gets opened and after completing certain tasks the current screen gets closed and I am moved to the screen even have labelfield.

    But this time I changed the name of the labelfield and now when I click the field label another screen becomes open.

    Suppose that it's my screen1 having the Label1 label

    Text1 = "Label1".

    Label1 = new LabelField (text1, LabelField.FOCUSSABLE)

    {

    protected boolean navigationClick (int status, int time)
    {

    If (Text1.Equals ("Label1")

    {

    UiApplication.getUiApplication.pushScreen (new MyScreen1());

    }

    Another yew (text1.equals ("Label2"))

    {

    UiApplication.getUiApplicatio.pushScreen (new MyScreen2());

    }

    Returns true;

    }

    };

    MyScreen1 is change the Labelfield as Label2 name.

    MyScreen1()

    {

    Screen1.Label1.SetText ("Label2");

    }

    The problem is when I click Label1, MyScreen1 is opened and he changed the name of the labelField.

    But when I click Label2 again MyScreen1 gets open

    You said:

    "In MyScreen1 is change the Labelfield as Label2 name.

    MyScreen1()

    {

    Screen1.Label1.SetText ("Label2");

    }"

    Then your test:

    "if (text1.equals ("Label1")"

    makes no sense, you should test the current label, for example:

    "if (label1.getText () .equals ("Label1")"

    But what good is having the screen 1 do this.  You could do this in your original example screen:

    "if (text1.equals ("Label1")

    {

    Text1 = Label2;

    Label1.SetText (Text1);

    UiApplication.getUiApplication.pushScreen (new MyScreen1());

    }"

  • Customization of the OA framework supports conditional logic?

    I want to make a non editable field according to the value of another field of recording even in forms HTML Installed Base (self-service).  I don't see anything in the documentation or on the form of customization under functional administrator that would allow me to do.

    apps version 11.4.10

    Yes, you can do the same thing. Your condition is not met by using only the customizations. You will need to extend the View object and use SPEL.

    Reference:

    http://Oracle.anilpassi.com/SPEL-in-OA-framework-with-audio-visual-Demo-2.html

  • Problem with condition on calculation

    I was faced with making a condition of PL/SQL on a page which deals with the work of calculation. The State has several if, then return false and another at the end of statements which returns true. It works fine when the IF then statement seeks a text element, but does not work when you look at a part of the select list. I tried to make the condition false when the selection list item is zero, but it is always set to true. I also tried comparing the element '% null', since that is what appears in the session information, but it does not work also.

    The only solution I've found so far is to put in a calculation of page rendering for the item selection list and pre-fill with a value. Which seems to work, but I think I shouldn't have to go through this extra step.

    Here are the PL/SQL that does not work:

    Start
    If: P950_NOTIFICATION_TYPE = "ENTRY".
    THEN RETURN FALSE;
    end if;
    If: P950_NOTIFICATION_PRIMARY_ST is null
    then return false;
    end if;
    If: P950_NOTIFICATION_REF_NO IS not NULL
    THEN RETURN FALSE;
    else return TRUE;
    end if;
    end;

    And here is the PL/SQL that works (after adding a page to pre-fill rendering calculation: P950_NOTIFICATION_PRIMARY_ST with the value "NA")

    Start
    If: P950_NOTIFICATION_TYPE = "ENTRY".
    THEN RETURN FALSE;
    end if;
    If: P950_NOTIFICATION_PRIMARY_ST = "NA".
    then return false;
    end if;
    If: P950_NOTIFICATION_REF_NO IS not NULL
    THEN RETURN FALSE;
    else return TRUE;
    end if;
    end;

    Hello

    If P950_NOTIFICATION_PRIMARY_ST is a selection list that allows null values, then it is possible that the value is in fact % null and non-null. Try:

    if :P950_NOTIFICATION_PRIMARY_ST <> '%' || 'null%'
    

    ("null %" is actually converted to NULL, you must divide the string as above for the test)

    Andy

  • Conditional logic box

    Hello!

    I use in the form of two checkboxes cb1 and cb2.
    field name: selected
    data type: Boolean

    I wrote inside a function of audit:

    If ((cb1.data = false) & & (cb2.data = false)) {}
    do something
    }
    If ((cb1.data = true) & & (cb2.data = false)) {}
    do something
    }
    If ((cb1.data = false) & & (cb2.data = true)) {}
    do something
    }
    If ((cb1.data = true) & & (cb2.data = true)) {}
    do something
    }

    It does not work...
    Go straight ahead until the last 'if' even if, for example, it should be limited to the second "If" as cb1 and cb2 is verified is not.
    What is the problem in my script?

    Thank you very much in advance for your help!

    To check if a checkbox is enabled or not you just check the selected checkbox instance property.

    Also when you're verified something, you must make sure you use 'is' who is for comparisons instead of '=', which is for the assignment of a value.

    And, because the selected property of a control checkbox is a Boolean value, you can simply use the value selected as the 'check', for example:

    and (ie. both):
    If (cb1.selected & cb2.selected) {do something}

    or:
    If (cb1.selected: cb2.selected) {do something}

    first and not the other:
    If (cb1.selected &! cb2.selected) {do something}

    You'd often such verification on the basis of event listener.

  • Problem creating conditional branching to different login Pages

    Hi all
    My requirement is very similar to what is said in this post. But I use LDAP for authentication

    Re: logon username determines the page that opens, how can I achieve this?

    I've implemented it exactly in the way that andy mentioned 3 steps. Here is my PL/SQL

    declare
    l_page varchar2 (30);
    v_role varchar2 (20);
    Start
    Select CTS_GROUP in the cts_Administrator_contacts v_role where CN_ID = LOWER(:APP_USER);
    If v_role = l_page then 'Network': = '79';
    Another l_page: = '71';
    end if;
    (wwv_flow_custom_auth_std). Login
    P_UNAME = >: P101_USERNAME,.
    P_PASSWORD = >: P101_PASSWORD,.
    P_SESSION_ID = > v ('APP_SESSION').
    P_FLOW_PAGE = >: APP_ID |': ' | l_page
    );
    end;

    When I try to connect after you change the login process, get ORA-01403: no found error...

    Can you get it someone please let me know what the problem is... Because the CN_ID with which I tried is the database... Is the problem, m because it uses the LDAP authentication... Must it be done differently...


    I also tried the following in the SQL workshop

    declare
    l_page varchar2 (30);
    v_role varchar2 (20);
    Start
    Select CTS_GROUP in the cts_Administrator_contacts v_role where CN_ID = LOWER(:APP_USER);
    If v_role = l_page then 'Network': = '79';
    Another l_page: = '71'; -default home page
    end if;
    Dbms_output.put_line (l_page);
    end;

    and it print the correct page number... I don't know that I need to change the process of connection in a different way, since I use LDAP authentication and groups are in my database... Can someone point me in the right direction...

    Thank you
    Yvette

    where CN_ID = LOWER(:APP_USER);

    You get an exception because no data found: APP_USER is null on the login page. Reference: P101_USERNAME instead.

    Scott

  • Problem in the logic of the code.

    Hello

    I wan to make a button, when I click on a paragraph gets opened and when I click again on the button the paragraph disappear.

    So, I have 10 buttons. I have to make this paragraph that dynamic label.

    How to do this?

    You can use insert to add a field/Manager on a certain position

  • Problem with conditional as C2 map

    Hello

    I'm trying to map personal 2 based on the accounts of HFM target that starts by 1 * 2 * 3 *.

    I have nothing in C2, but this should always refer to the account of the target and the result.

    Any thoughts?

    Thank you.

    Dim HFMAcc
    HFMAcc = varValues (14)

    If left(HFMAcc,1) = "1" then
    Result = "F99".
    End if

    Hello

    1. ensure that mapped account before C2 (check the sequence Calc in page size)

    2 assign a dummy value to C2 in the import format (Ex: DummyC2)

    3. set source as * in the mapping

    Concerning

  • Problem with conditional branching

    Hello

    I use apex 3.2

    I have a report different sql from I have a link to page 9 to say
    Page 9, by clicking Cancel, I have to go to the same page that I had form
    say if I came from page 1 to 9, I want to go back to page 1, and if I came 3-9, I have want to return page 9

    I tried the below

    1 create a Branch point application
    2. in the report link column I put the value of the branch of current page number
    3. on the Cancel button on the destination in the brach to Page page, I have user & branch

    But when I click on the page, I see that brach value is 0, and it tries directly 0 page that does not exist

    I also tried below
    http://Apex-notes.blogspot.com/2008/02/navigate-to-previous-page.html
    and http://dgielis.blogspot.com/2008/03/dynamic-breadcrumb-in-apex.html

    Hello

    Did you miss the point at the end:

    &BRANCH.
    

    Andy

  • Problem writing conditional Scripts

    I am really new to all this and have several questions here already.  I have been looking around for a way to solve my own question but have not found one so I'm going to ask what I'm doing wrong.  I have these boxes:

    Region Capture.jpg

    Later in the same form, I have this section:

    Region Capture3.jpg

    I am wanting to have data that are checked in the first box appear in the second so it will look like this, if the 'Good' field has been verified at the beginning of the form?

    Region Capture4.jpg

    Should what script I use?

    Another question aside.  Is there a good book, I read and study this? I hate asking questions and love learning new things.

    Start here: http://www.adobe.com/devnet/acrobat/javascript.html

  • Problem with conditional statement

    I'm becoming so whenever you click on the object it reduced opacity of 10% every time if it gets to 10% and he clicked again, it remains at 10% instead of going to 0

    I managed to do it keep going down into the fine opacity that I don't know the code to prevent it to go lower. That's what I have so far

    function fadeOut(e:MouseEvent):void {}

    instrument.Alpha-=. 1;

    }

    If (instrument.alpha <. 1) {}

    instrument.Alpha =.1

    } else {}

    instrument.Alpha-=. 1;

    }

    Oops, that should be:

    function fadeOut(e:MouseEvent):void {}

    instrument.Alpha = Math.max(.1,instrument.alpha-.1);

    }

Maybe you are looking for