Switch Case help statement...

Hello

I try to get my pages through statement of case, but...

Can someone help me... Here is my code...

This is my Code of buttons... My buttons are on the 1st image of My Florida.

stop();

btn1.addEventListener(MouseEvent.CLICK, varTest);
btn2.addEventListener(MouseEvent.CLICK, varTest2);

function varTest(event:MouseEvent):void
{
     var page = 1;
     gotoAndStop(20);
}

function varTest2(event:MouseEvent):void
{
     var page = 2;
     gotoAndStop(20);
}

and this is my 20th chassis code. (here I check variable)

import flash.events.Event;

addEventListener(Event.ENTER_FRAME,checkCaseMe);
function checkCaseMe(event:Event)
{
     switch (page)
     {
          case "1" :
               info_txt.text = "page1";
               break;
          case "2" :
               info_txt.text = "page1";
               break;
          default :
               info_txt.text = "page00";
     }
}

When I test the movie... Error has occurred (scene 1, Layer 'Actions', Frame 21, Line 6 1120: access of undefined property page. )

Can someone help please... How can I fix this...?

Thank you...

If the error is really of such code, then the problem is that you declare page inside a function, which limits its scope within the function (s).  Try instead the following...

stop();

var page:uint;

btn1.addEventListener(MouseEvent.CLICK, varTest);
btn2.addEventListener(MouseEvent.CLICK, varTest2);

function varTest(event:MouseEvent):void
{
     page = 1;
     gotoAndStop(20);
}

function varTest2(event:MouseEvent):void
{
     page = 2;
     gotoAndStop(20);
}

Tags: Adobe Animate

Similar Questions

  • How to track down where a specific enum is used in a switch case statement?

    Hi all

    I have an application of simulation of machine quite complex state that I add a 'mode' feature for. Some States in the application, rather than the blocks by default of running code, a VI a VI class for each mode will be instead (for example for modes A and B, initialization status has now Initialization_modeA and Inilitalization_modeB). This results in many cases structures everywhere, and I can't figure out how to ensure that, when adding a new mode, I have add the case of this mode of each switch case. Is it as simple as having a default case with a pop-up box? Or is it possible OOP I can handle this?

    Go right on what you told us, you could have each mode inherited from a common ancestor that defines a set of common States (or methods in this case). Whenever you want to add a new method, you can create a new class and override simply each method with this specific class has to do. Instead of having a State of init for each mode, you only then a common State of init, which would then distribute the code correct init based on what class you are using.

  • Using nested switch/case statements

    What is the best practice of two following switch/case statements?

    Is there an easier way (less code) to do this?

    Thank you.

    I think it's as clean as it gets:

  • switch case as C

    Hi all

    Is it possible to use the loop as a switch case in C. Suppose that one of my numbers to generate processes, like 1, 2, 3 4 all n, so if it generates 2 I want to perform the task mentioned in the event 3, so 2 then he must perform the tasks mentioned in the event 2. Please help me in this issue

    Here

  • doubt in the case when statement

    Hi the gems...

    I have a case when statement in a select clause... ago total three conditions in the case when statemnt.

    now my question is if all theconditions gets mapped, what happens?

    is only the first condition is executed and rest two is ignored or the third condition will overwrite the previous two?

    Please help... Thanks in advance...

    You can see it with:

    select case when 1=1 then 1
                when 2=2 then 2
                when 3=3 then 3
           end test
    from dual;
    
    TEST
    ---------
    1
    

    You get only the first result!

    Published by: hm on 18.11.2011 04:11

  • Captivate 9 - trying to switch between the States of an object when a user clicks on this object?

    Try to switch between the States of an object when a user clicks on this object? I have successfully used the function of the State of the object to change the object to a different State, but I need it back to its Normal state when it is selected again in the State has changed and then continue to turn every State when you click on it. It is an interaction of flashcard. I can do this using several objects and hide/show, but I would do it with States and unique objects.

    You're talking about custom or InBuilt States. What kind of action do you use: a simple or advanced/shared action?  If you simply switch between two States, use the approach I described in this blog post:

    1 share = 5 buttons toggle - Captivate blog

    You will probably need a user variable to track the status, but you can use the shared conditional action described in this blog.

  • Are there other ways to make more than 1 kaycode instead of doing one thing to switch-case

    OK, naked with me, because my English is not so good. And I'm still not a professional have

    I did a dance game. A game that objects will fly up to the target and you must press the right keys for them. I know this is kind of the issue on several keypress thing. But I tried to search on them. I still can't understand. And... because I'm almost done my project, but the abovemultiple-keys -How-to-do- it, I might have to recreate everything, start from 0.

    I made a function to put on screen the CSM and managed by a class.

    Then, I made a function to detect if the target hit to the right position and you press the right keys.

    Also, if you press the wrong score will be decressed.

    I "did not only a fuction detect keys and tell what to do.

    So my question is "Is there other ways to make more than 1 kaycode instead of doing one thing to switch-case, for example?"

    It is a part of my code.

    var p1:Number=37;// 37Left(Left)
    ///
    
    function makeLvl(e:Event):void
    {
              if (sTime < sTempo)
              {
                   
                        sTime++;
              }
              else
              {
            
                        sTime = 0;
                        if (SelectedLvl[sArrow] != 0)
                        {
                                  var currentArrow:MovieClip;//this will hold the current arrow
                                  if (SelectedLvl[sArrow] == 1)
                                  {
                                            //place a left arrow onto the stage
                                            currentArrow = new A1();
                                            //set the _x value of the arrow so that it is in the
                                            //right place to touch the receptor
                                            currentArrow.x = 120;
                                            //set the arrow's y coordinate off of the stage
                                            //so that the user can't see it when it appears
                                            currentArrow.y = 400;
                                            currentArrow.arrowCode = p1 ;
                                            addChild(currentArrow);//add it to stage
                                  }
    ////
    
    
    
    touchL = false;
    
    ////
    
    for (var i:int = 0; i<numChildren; i++)
              {
                        var target:Object = getChildAt(i);
                        if (target.arrowCode != null && target.hitTestObject(mcReceptor))
                        {//if the object is an arrow and the receptor is touching it
                                  if (target.arrowCode == p1)
                                  {//if left arrow
                                            touchL = true;
                                  }
    mcTxt.txtScore.text = 'Score:  ' + score;
              mcTxt.txtCombo.text = 'Combo:  ' + combo;
              mcTxt.txtScoreString.text = scoreString;
    }
    ////
    stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKeys);
    function checkKeys(e:KeyboardEvent):void
    {
              //if the left key is down and no left arrows are touching the receptor
              if (e.keyCode == p1 && ! touchL)
              {
                        changeHealth(-10);//make the health go down
                        combo = 0;
                        scoreString = 'Bad';
              }
    beginCode();
    ////
    
    
    
    

    I try to put a table and display the number to fit it in, but no luck.

    Maybe I used the wrong table?

    Any ideas? Any suggestions? -Please...

    Thank you so much.

    This may be more advanced than what you're ready for, but it is a way to do

    http://blog.Iconara.NET/2008/03/30/separating-event-handling-from-event-filtering/

    I actually did this with a 'chain of responsibility', where each link has a reminder of determineResponsibility and the handleResponsibility callback. If it does not have responsibility (because she is not responsible), it sends the request on the following link in the chain, which manages or does not work. If you are not familiar with a reminder, it is a variable of type function so that you can change what the function is called repeatedly.

    To clarify, you must provide the first link in the chain, a reference to the event, then call something like a method process() with a reference to the event. This would call determineResponsibility(), which would look at the event to see if the features of the event are what you want. If it returns true, it would be called handleResponsibility(). If it returns false, you would call process() on the following link. The advantage of this design is that you can add and delete links to manage the changing needs of your system. For example, if the character hits something that disables the good movement until the user presses the arrow to the left, remove the link to the right arrow until the user presses the left arrow, then turn on again.

    Post edited by: Amy Blankenship

  • Need help with CASE When statement in a Where Clause

    So I have a SQL (simplified for this forum)

    Select t1.*
    from table1, table2 t2 t1
    where t1.field1 = t2.field1
    and when t1.field2 is null then trunc (sysdate) < = trunc (t1.date1 + 17)
    of another trunc (sydate) > = end of trunc (t2.date2 + t2.date3)

    I end up getting an error ORA-00905: lack of keyword

    I'm sure that I just got something here involved.

    You can not make the comparison within the statement underlying case like this. Assuming you have appropriate data types, something like this should work

    Select t1.*
    from table1 t1, table2 t2
    where t1.field1 = t2.field1
      and ((t1.field2 is null and
            trunc(sysdate) <= trunc(t1.date1 + 17)) or
           trunc(sydate) > = trunc(t2.date2 + t2.date3))
    

    John

  • Need help with debugging case manipulation statement &amp; date

    Hi people,

    Can you get it someone please let me know what I am doing wrong?

    Select to_date (23-seven.-10', 'DD-MON-yy') expiry_date,.
    TO_DATE (23-sep-09', 'DD-MON-yy') order_date,.
    TO_DATE (23-seven.-10', 'DD-MON-yy')-to_date (23-sep-09', 'DD-MON-yy') diff,.
    (case diff
    When < 365 then 'low '.
    When > 365 then 'high '.
    other 'similar '.
    end)
    Double;


    ORA-00936: lack of expression
    00936 00000 - "missing expression.
    * Cause:
    * Action:
    Error on line: column 5:18


    Thanks in advance

    rogers42

    Here you go

    WITH temp_tab AS
        (SELECT to_date('23-sep-09',      'DD-MON-yy') order_date,
             to_date('23-sep-10',      'DD-MON-yy') -to_date('23-sep-09',      'DD-MON-yy') diff,
             to_date('23-sep-10',      'DD-MON-yy') expiry_date
         FROM dual)
    SELECT(
    CASE
    WHEN diff < 365 THEN 'low'
    WHEN diff > 365 THEN 'high'
    ELSE 'same'
    END)
    FROM temp_tab;
    
  • using case when statement or decode unfavorable in where clause

    Hi the gems...

    I have a problem in the following query...
    I try to use when case statement in where clause of a select query.


    Select cr.customer_name. ' - ' || CR.customer_number as cust_name,
    CR. Salary salary
    of customer_details cr
    where (case when ' > ' = ' > ' then ' cr.salary > 5000')
    When ' > ' = ' < ' then ' cr.salary < 5000'
    When ' > ' = '=' and then 'cr.salary = 5000'
    Another null
    (end);


    the expression in the when clause of the statement of the case, when comes from HQ and according to the choice I have to make the where clause.
    That is why, for the execution of the query, I put ' > ' in this place.

    If the original query will look like this (for reference):

    Select cr.customer_name. ' - ' || CR.customer_number as cust_name,
    CR. Salary salary
    of customer_details cr
    where (case when variable = ' > ' then ' cr.salary > 5000')
    When the variable = ' < ' then ' cr.salary < 5000'
    When the variable = '=' and then 'cr.salary = 5000'
    Another null
    (end);


    so, in a real case, if the user selects ' > ' then the filter will be ' where cr.salary > 5000.
    If the user selects ' < ' then the filter will be ' where cr.salary < 5000.
    If the user selects '=', then the filter will be 'where cr.salary = 5000 '.

    but I get the error "ORA 00920:invalid relational operator.

    Help, please... Thanks in advance...

    Hello

    select cr.customer_name || ' - ' ||cr.customer_number as cust_name,
           cr.salary                                      as salary
     from customer_details cr
    where (    v_variable = 'bigger'
           and cr.salary > 5000
          )
       or (    v_variable = 'less'
          and cr.salary < 5000
           )
       or (    v_variable = 'eq'
            and cr.salary = 5000
           )
    

    Published by: user6806750 on 22.12.2011 14:56
    For some reason that I can't write in sql "<', '="">", "=".

  • PL/SQL and Case &lt; href &gt; statement

    I have just a bit of code in Pl/SQL, and since I had to put this Case statement with javascript I can't get the correct syntax. Can someone please help with the ' and ' in this statement?

    Thank you

    {code}

    v_query: = "SELECT";

    v_query: =.
    v_query | Case when sd.sd_id = 1 then ' < a href = "javascript:fnc_tabAddUser (v1); ' > '
    || "< img src =" #WORKSPACE_IMAGES #sd.png ">"
    || "< /a >."
    end as open_sd | "category", | ' s1.sub_cat_1,'| '. S2.sub_cat_2,' | "program", | "sd.sd_name," | "sd.sd_date," | "s2.synopsis," | "sd.sd_id,";

    {code}

    Basically, most of the v_query is her go and where clauses but here is simply the select clause. I can post the whole code if it helps. Everything works fine until I entered the Case statement and I believe that my syntax is off. Also, I tried to read and find similar code and some mentioned using Htp.p but I don't know if necessary.

    Published by: Res Ipsa on June 22, 2011 11:49

    Published by: Res Ipsa on June 22, 2011 11:49

    Published by: Res Ipsa on June 22, 2011 11:50

    There was also a problem with your order of. There was no space for text is released which looks like this:

    '', 1) > 0ORDER BY 1 DESC 
    

    This gives a shot. I don't bother to do the tables, so it may not always work.

    DECLARE
       v_query   VARCHAR2 (4000);
       v_search_string VARCHAR2(4000);
    
    BEGIN
        v_search_string :=
        '
            '||:p1_search_string||'
             
               transform((TOKENS, "{", "}", " "))
               transform((TOKENS, "{", "}", " ; "))
               transform((TOKENS, "{", "}", "AND"))
               transform((TOKENS, "{", "}", "ACCUM"))
             
           
          
        ';
    
       v_query := 'SELECT   ';
       IF :p1_search_string IS NOT NULL
       THEN
          v_query := v_query || 'score (1) relevance, ';
       ELSE
          v_query := v_query || '''100%'' relevance, ';
       END IF;
    
       v_query :=
          v_query || 'Case when sd.sd_id = 1 then '''''
                  || 'end as open_sd, category, s1.sub_cat_1, s2.sub_cat_2, '
                  || 'program, sd.sd_name, sd.sd_date, s2.synopsis, sd.sd_id, ';
    
       IF :p1_search_string IS NOT NULL
       THEN
          v_query :=
                v_query
             || 'NVL2 '
             || '(:p1_search_string, '
             || 'ctx_doc.snippet '
             || '(''docsx'', '
             || 'ROWID, '
             || 'NVL (:p1_search_string, ''%''), '
             || ''''', '
             || ''''' '
             || '), '
             || 'NULL '
             || ') snippet ';
       ELSE
          v_query := v_query || 'NULL snippet ';
       END IF;
    
       v_query := v_query
          || 'FROM from pri_cat p
              left join sub_cat_1 s1
              on p.cat_id = s1.cat_id
              left join sub_cat_2 s2
              on s1.sub_1_id = s2.sub_1_id
              left join select_program pro
              on s2.pro_id = pro.pro_id
              left join supplemental_direct sd
              on s2.sd_id = sd.sd_id  ';
    
       IF :p1_search_string IS NOT NULL
       THEN
          v_query := v_query || 'WHERE contains (synopsis, ''' || v_search_string || ''', 1) > 0';
       END IF;
    
       v_query := v_query || ' ORDER BY 1 DESC ';
       return(v_query);
    END;
    

    See you soon,.
    Janet Tyson

  • UI: looking for advice on how to avoid many cases JS statements...

    See you soon,.

    With a simple user interface (the user can check multiple checkboxes, radio buttons or find more stuff with text editboxes), I find myself with a lot many if statements wants to know what the user actually clicked/typed.

    For example. I've got 3 boxes - I then go ahead and write several statements such as if (1 & & 2 & & 3), if (! 1 & & 2 & & 3), etc. There are so many possible combinations so this will get rather overwhelming at any time. There must be a smarter way to do this?

    Thank you

    Rasmus

    Something like this:

    If (oDialog.show () //Get all your variables

    {

    Switch (rLColoumn.selectedButton)

    {

    case 0: area var = "bleed." break;

    case 1: country var = "slug." break;

    case 2: region = "custom"; var break;

    }

    var areaValue = tLColoumn.editValue;

    ......

    oDialog.destroy ();

    } else {//bail out if the dialog box is canceled

    oDialog.destroy ();

    return;

    }

    Now use your variables to perform your functions...

    cleaning (oDoc oArray field, areaValue);

    ....

    Substances

  • cluster + case help

    Hello

    I'm learning clusters and unbundle by function name using a structure of matter. For some reason, my lead of the cluster is broken and he says the error is of the wrong data type, but I'm multiplication by a scalar, I do not understand why the error occurs and what to do to fix.

    I also have a problem with the structure of the case. So I want the deal structure something if it's false (as shown). But, I won't do anything if the structure of matter is true. How would I you in wiring and setting up the schema for the structure real deal?

    I have attached photos of my diagram of Panel and the front block.

    I hope I was clear in my question, otherwise let me know!

    I appreciate any help! Thank you!

    Hello

    Maybe you're the real part of the deal just by chance; We do not understand what is there, but as you don't mention her errors, we will assume that you have get the syntax right.

    You choose which of the editing by defining the necessary at the top case. The left arrow = previous, right arrow = then arrow down = menu. Wiring on screen change to show the wiring for the selected case.

    So try to select TRUE. Wiring, you will see, this is what happens when the input is TRUE. There is a wire out of the case, you should wire something, maybe a straight in front of the entrance, so you do nothing at the entrance of food out. If you don't wire anything out, you pass the value "default" of this type to the output, or get an error, according to a LabVIEW option setting. The default value of a number is equal to zero.

    Stem

  • multiple control for switch case structure

    I have four process past... my first process is supposed to work for 12 hours and next three deal for 1 hour each. Since I have many variable to display I use tab control. Now my question is how use two controls for the case selector one based on the tab control where the user can see the second and individual process parameters based on time where the process should be automated according to the time it's when 12 elapsed hours that the second process continues to the next process 1 HR even 3rd and 4th. can someone help me please

    I enclose my vi

    This?

  • Major question Dhcp on cisco switch please help!

    Hi Experts,
    One of our remote sites has Cisco 2811 router and switch 3650. The switch provides switching and DHCP PC to all customers.
    Please see attachment for more details files.
    Problem:
    After the expiry of the term of the DHCP lease (10 hours), some of the PC (Windows 7) on the remote site received Windows popup says that duplicate IP. Then, the network connectivity of the computer has been disconnected. After you restart the PC, then its network connectivity was back to active state.
    If all the computers have been placed in static mode, there is no problem.
    Please see the attached configuration of the router and Switch.
    Thank you very much

    It's strange this generally solves the problem of IP duplicate

    How to put the DHCP server on the router instead of this?

    what you get when you place an order 'show ip dhcp conflict '.

    also can you share the command 'show ip dhcp pool '.

    Richard

Maybe you are looking for

  • Tecra 9000: Agere minPCI wireless network card does not work

    Hello I can't get my Toshiba Tecra 9000 to work with the Agere wireless Mini-PCI card.The Wifi card is 100% working since I've tested in Tecra 9000 my friend.The drivers are properly installed. But when I switch the equipment on the side of books, th

  • Satellite P100-160 and memory upgrade

    I have a P100-160 with 2 GB of memory installed.I use Win7 (32 bit) and do some really serious graphics, and management changes.I use about 2.75 TB of hard drives (USB). Can you get it someone please let me know if I could reasonably expect to see an

  • I have an error on hp 3000dn 59.90 code

    How can I fix error code on a hp color laserjet 3000dn 59.90?

  • Problem with the HP drivers Download Page

    Don't know where best to post this topic. I have problems with the HP driver download Page. Using the Chrome browser, I installed the HP product detection utility. Once installed, I admitted that it runs, and it correctly detected my HP computer and

  • Passport for blackBerry Apps Blackberry passport application

    IAM planning to buy the passport of blackberry. I would like to know who Dose all the game store googel app run or not? I have a lot of app from the googel game to my moblie right know and want to see if this Passport for blackberry will run or not?