How to Display a game score throughout the Scenes

Hi there Actionscript geniuses. I have stumble upon this problem. As a novice in actionscript in particular and programming in general, I am very pleased that I manage to pull this scoreboard script ( listed below), for my quiz game. The script is simple, it adds points when clicking on the right button, and subtract points when clicking on the wrong button. The problem is that while this script works great on my first scene, it doesn't work on my next scene anymore. The buttons are not working and the score board is back to zero, it's as if the script does not exists. In both scenes the buttons and the text objects are the same symbols, as well the Instance names. The script resides inside actionscript .as file. What is missing or wrong in this script or concept?
I understand the dilemmas regarding using scenes, some people love them and some hate them. I also notice that Adobe itself warns about the use of scenes, but never the less, because of the current level of my flash pro cc 14 knowledge, I incline to use them.
package {
  import flash.display.MovieClip
  import flash.events.MouseEvent;
  public class scoreMe2 extends MovieClip {
  public function scoreMe2() {
  //Scoreboard starts here:
  var score: uint;
  function init(): void {
  score = 100;
  scorecounter.text = "SCORE:" + score.toString();
  clip.buttonMode = true;
  clip.addEventListener(MouseEvent.CLICK, on_press1);
  gButton.buttonMode = true;
  gButton.addEventListener(MouseEvent.CLICK, on_press2);
  button_2.buttonMode = true;
  button_2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene);
  //Positive button adding points
  function on_press1(event: MouseEvent): void {
  updateScore();
  function updateScore(): void {
  gotoAndStop(2);
  score += 100;
  scorecounter.text = "SCORE:" + score.toString()
  function fl_ClickToGoToScene(event: MouseEvent): void {
  MovieClip(this.root).gotoAndPlay(1, "Scene 2");
  //Negative button subtracting points
  function on_press2(event: MouseEvent): void {
  score += -20;
  scorecounter.text = "SCORE:" + score.toString();
  init();
  //Scoreboard ends here:

It's not really a matter of love or hate, it's a matter of practicality.  Scenes work well for uscripted animations that flow from one section to the next.  When you start involving coding and navigation you are heading into a troublesome realm if you choose to use scenes.  They are simply problematic when you start to try to use them with code.
Your best bet is to create separate movieclips as your scenes and place them along the timeline of the first scene.  That way you can easily have all your variables at the ready by having them in a layer that extends the length of the timeline needed.  You should be able to convert to this somewhat easily if you just copy the scene timelines into movieclips.

Similar Messages

  • I am using a 3GS phone and want to switch to a 4, how can i transfer my current game scores to the new phone?

    i am using a 3GS and want to switch to a 4, how can i transfer my current game scores to the new phone?

    http://support.apple.com/kb/ht2109

  • How to display properties of dimension on the input form and report in bpc

    Dear Expert,
    Please tell me how to display properties of dimension on the input form and report in bpc. I can only display dimension number.
    thanks so much
    hungth

    Hi Hungh,
    If your are using BPC 10 with EPM add in client, you can use the function:
    EPMDimensionProperty ()
    This function retrieves the properties of a specified dimension in a specified cell range.
    Thanks, Safa

  • How to display multi-channel image in the 'proxy'?

    There're many examples to show how to display composite channels in the 'proxy'. But I don't find any example to show how to display multi-channel image in the 'proxy'. I found that I can use PSPixelOverlay to display alpha channel data like this:
    int nSpotChannel = gChannelCount - 4;
    PSPixelOverlay* overlay = new PSPixelOverlay[nSpotChannel];
    for(int i = 0; i < nSpotChannel; i++){
           if( i != (nSpotChannel - 1) )
                 overlay[i].next = overlay + i + 1;
           else
           overlay[i].next = NULL;
           overlay[i].data = gChannelData + (4 + i) * nPlaneBytes;
           overlay[i].rowBytes = gProxyRect.Width() * gDocDesc->depth / 8;
           overlay[i].colBytes = 1;
           overlay[i].r  = 230;
           overlay[i].g = 161;
           overlay[i].b = 174;
           overlay[i].opacity = 255;
           overlay[i].overlayAlgorithm = kStandardAlphaOverlay;
    pixels.pixelOverlays = overlay;
    Then, Seeing red part, it will trigger a new problem, that is how to get the color value of the alpha channel by plung-in itself? It seems that no channel color value info is in FilterRecord.
    If you have other solution, please tell me. Many thanks!

    This is what I've been doing - was just curious if there was a way to see a more cohesive image.
    If the individual EQ plugins are in fact the answer, is there any way to smooth how the Analyzer displays? The image I posted above, all of the tonal curves are very smooth. The analyzer tool shows a lot of peaks and valleys within the overall curve and it's hard to pinpoint each instrument's "sweet spot." Vocals for example are very hard to spot.
    - Morgan

  • How to display language key (0LANGU) in the query for BW report

    Hi,
    Can someone tell me how to display language key (0LANGU) in the query? I want to display which language (English or French) is used for material description in BW report. Thx.

    hi,
    check if the infoobject is kept as lang dependent or not  for material text, else you need to create a masterdata attribute with text and lang keys and do corresponding mapping, so then it can be displayed in your report
    regards
    laksh

  • How do you save "game state" so the user can continue next time?

    I'm not sure what the correct game terminology is for this, but how do you save "game state" so the user can continue next time?
    This seems like a pretty important feature for building some games, we don't want users to have to start over everytime.
    Any ideas if this is possible?

    Check out my blog post on the PersistenceManager:
    http://www.unitedmindset.com/jonbcampos/2010/11/01/flex-4-5-persistencemanager/
    This will help you understand how to store the data. When the app starts up again get the state information from the persistencemanager and reset you game to the state you need. It requires a bit of code for the startup, but it is relatively simple.

  • How to display my country flag on the task bar in osx mavericks?

    How to display my country flag on the task bar in osx mavericks?

    System Preferences > Keyboard > Input Sources
    Checkmark the box beside "Show Input menu in menu bar".

  • How do I sync game scores to new device?

    Game Center shows scores and achievements for the games I migrated to my new iPhone 5c, but the games boot up without them, as if brand new. How can I get them to acknowledge the Game Center data?
    Sideline: Why does Apple permit bogus high scores in Game Center? That hack must be 9,223,372,036,854,775,807 years old.

    Hi Sonnyboy89,
    I am a little unclear as to what you are trying to do with Game Center on the iPads, but you can enter each user’s Apple ID in Game Center on their device using the steps in this article -
    Using Game Center on your Mac or iOS device
    http://support.apple.com/kb/HT4314
    Thanks for using Apple Support Communities.
    Best,
    Brett L

  • How to display UI elements dynamically on the click of a radiobutton

    hi all,
    I have created two radio buttons rb1, rb2 dynamically.  If i click on rb1, ......
    one label, one inputfield (ie., some UI elements ) must be displayed in the same view & if i click on rb2, other UI elements must display. 
    can anyone tell how to display UI elements which were created dynamically on the click of a radio button.
    thanks & regards,
    vila

    Hi,
    1. Create a context attribute name visible1 of type type     com.sap.ide.webdynpro.uielementdefinitions.Visibility(using brose button in the type property of context)
    2. Bind this context to all tha elements of that you want to make visible when radio button 1 is clicked to their visibility property.
    3. Create a context attribute name visible2 of type com.sap.ide.webdynpro.uielementdefinitions.Visibility(using brose button in the type property of context)
    4. Bind this context to all tha elements of that you want to make visible when radio button 2 is clicked to their visibility property.
    5. Create actions for both radio button1 say action1 and for radio button2 say action2.
    6. In action1 write this line of code
    wdContext.currentContextElement.setVisible1(WDVisibility.VISIBLE);
    wdContext.currentContextElement.setVisible2(WDVisibility.BLANK);
    7. In action2 write this line of code
    wdContext.currentContextElement.setVisible2(WDVisibility.VISIBLE);
    wdContext.currentContextElement.setVisible1(WDVisibility.BLANK);
    Regards,
    Murtuza

  • How to display Doc file format in the JEditPane?

    At this time , JEditPane supports RTF and HTML file format ,but
    Could anyone tell me how to display DOC file format using JEditPane
    or other JTextComponents?
    Thx a lot!
    Caton

    Hi,
    there is no support for doc files (M$ Word?) in Java. You would have to create your own classes for that eventually subclassing JEditorPane, EditorKit, Document etc. As well you'd need your own reader for the doc format.
    The problem I see with that however is that there is nothing such as thedoc file format. Microsoft just saves anything produced by MS Word into files ending with .doc. But, if there is anything such as a .doc file format, it changes more often than the weather in April.
    Ulrich

  • How to display HTML formatted text in the field with Item Style: Raw Text

    How can I display HTML formatted text in the field with Item Style: Raw Text.
    Currently the Item Style is Raw Text, but the text is being displayed along with HTML tags without formatting.
    Regards

    Hi,
    Use Item Style formattedText.
    Regards,
    Gyan

  • How to display header fields names in the next page in report6i

    how to display repeat header field names into the next page in report6i urgent plz......
    When i am runing report in 1st page only the header information is displaying in 2 page the header info is not displaying only records are displaying.So i want to display the header info in 2nd page also.
    Plz help out.

    Hello,
    Go to the report layout model and select those items/objects which are not getting display on next page and open the property pallet by pressing F4 key and set the property Print Object On to All Pages then it will display on all pages.
    -Ammad

  • How to display all tagged photos from the whole catalogue?

    Hi,
    I have been googleling around, but have not found the right information. I am trying to find all my tagged photos of all imported photos, but it would only show the tagged photos from a specific folder when I select that specific folder or from the timeline, in which I already knew that some tagged photos belong in those folders.
    My question is...how can I search tagged photos from the whole catalogue without going through the timeline or clicking each folder and subfolder to view them. I would like that the organizer display all tagged items from all my folders and subfolders at once.
    Sorry if this has been answered and I was not able to find the right forum or information.
    Many thanks in advance!
    Dreamy

    Thanks a lot!

  • How to display only selected columns in the table on the tableview

    Hi All,
    I am displaying in the below tableview the data from the SFLIGHTS tables in the tableview using flow logic. It displays all the columns in the database table. How can I set in the code to display only selected columns and not all columns.
    Also, in these columns displayed I want to make the key columns of SFLIGHT as non editable and the rest of the columns in SFLIGHT editiable. Can you please kindly share the code to implement this.
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content design="design2003" >
      <htmlb:page>
        <htmlb:form>
          <htmlb:tableView id              = "tv1"
                           visibleRowCount = "10"
                           selectionMode   = "lineEdit"
                           table           = "<%= flights %>"
                           filter = "SERVER"
                           sort = "server"
                           iterator        = "<%= iterator %>" />
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    Thanks
    Karen

    Hi,
       Please try this code.
    <!-- To display Table control on BSP page with table internal table it_hist  --!>
              <htmlb:tableView id              = "TV_HIST"
                               headerText      = "Previous History"
                               headerVisible   = "TRUE"
                               footerVisible   = "TRUE"
                               design          = "ALTERNATING"
                               selectionMode   = "LINEEDIT"
                               visibleRowCount = "5"
                               fillUpEmptyRows = "TRUE"
                               table           = "<%= it_hist %>"
                               width           = "500" >
    <!--  to show selected columns give required field name --!>
    <htmlb:tableViewColumns>
      <htmlb:tableViewColumn columnName          = "FIELD1"
                                         title               = "COLUMN1"
                                         horizontalAlignment = "CENTER"
                                         width               = "65" >
                  </htmlb:tableViewColumn>
      <htmlb:tableViewColumn columnName          = "FIELD2"
                                         title               = "COLUMN2"
                                         horizontalAlignment = "CENTER"
                                         width               = "65" >
                  </htmlb:tableViewColumn>
      <htmlb:tableViewColumn columnName          = "FIELD3"
                                         title               = "COLUMN3"
                                         horizontalAlignment = "CENTER"
                                         width               = "65" >
                  </htmlb:tableViewColumn>
      <htmlb:tableViewColumn columnName          = "FIELD4"
                                         title               = "COLUMN4"
                                         horizontalAlignment = "CENTER"
                                         width               = "65" >
                  </htmlb:tableViewColumn>
    <!--  to make column editable set edit property to TRUE --!>
      <htmlb:tableViewColumn columnName          = "FIELD4"
                                         title               = "COLUMN4"
                                         edit = "TRUE"
                                         horizontalAlignment = "CENTER"
                                         width               = "65" >
                  </htmlb:tableViewColumn>
                </htmlb:tableViewColumns>
              </htmlb:tableView>

  • How to display 2  ALV grids in the output

    Hi all
    I have 2 internal tables with some data
    i want to display 1st internal table data in one grid and 2nd internal table in the second grid in the same output screen with some headings
    can anyone tell me how to do it
    or can send the sample code
    Thank you

    Hi
    see this program you can understand the flow very easily
    *& Report  ZAMIT_ALVOOPS
    REPORT  ZNNR_ALVOOPS_SCREEN.
    tables: mara,spfli.
    types: begin of ty_tab,
            matnr type mara-matnr,
            ernam type mara-ernam,
            ersda type mara-ersda,
           end of ty_tab.
    DATA ITAB1 TYPE TABLE OF SPFLI.
    DATA WA1 LIKE LINE OF ITAB1.
    DATA IO1 TYPE SPFLI-CARRID VALUE 'AA'.
    data itab type table of ty_tab.
    data wa like line of itab.
    DATA OK_CODE TYPE SY-UCOMM.
    DATA: GRID TYPE REF TO CL_GUI_ALV_GRID,
          CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: GRID1 TYPE REF TO CL_GUI_ALV_GRID,
          CONTA TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    CREATE OBJECT CONT EXPORTING CONTAINER_NAME = 'CONT1' .
    CREATE OBJECT GRID EXPORTING I_PARENT = CONT .
    CREATE OBJECT CONTA EXPORTING CONTAINER_NAME = 'CONT2' .
    CREATE OBJECT GRID1 EXPORTING I_PARENT = CONTA .
    selection-screen begin of block b1 with frame title text-100.
    select-options: s_matnr for mara-matnr.
    selection-screen end of block b1.
    select matnr ernam ersda from mara into corresponding fields of table itab up to 15 rows
    where matnr in s_matnr .
    call selection-screen 100.
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    if ok_code = 'PB1'.
    leave to screen 0.
    else.
    leave to screen 100.
    endif.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    SELECT * FROM SPFLI INTO
      CORRESPONDING FIELDS OF TABLE ITAB1 WHERE CARRID = IO1.
    CALL METHOD grid->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
       I_BUFFER_ACTIVE               =
       I_BYPASSING_BUFFER            =
       I_CONSISTENCY_CHECK           =
        I_STRUCTURE_NAME              = 'MARA'
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
       IS_LAYOUT                     =
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
       IR_SALV_ADAPTER               =
      CHANGING
        IT_OUTTAB                     = itab.
       IT_FIELDCATALOG               =
       IT_SORT                       =
       IT_FILTER                     =
    EXCEPTIONS
       INVALID_PARAMETER_COMBINATION = 1
       PROGRAM_ERROR                 = 2
       TOO_MANY_LINES                = 3
       others                        = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
       CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME = 'SPFLI'
        CHANGING
          IT_OUTTAB        = ITAB1.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    <b>Reward if usefull</b>

Maybe you are looking for

  • Exchange 2010 SP3 Failing to Install "The remote procedure call failed"

    I am getting an error while trying to upgrade the first Mailbox server in the organization to SP3. The CAS and HUB servers already upgraded without any issues. Any help is greatly appreciated. Here is the exchange setup logs output: [11/15/2014 09:10

  • Bi 7.0 SD report for previous year, month, current month, rolling 30days.

    I have Sales document type in rows and in column, I have no of sales documents. Now, I need sales documents in rows and no of sales documents in columns according to created on date: 0calday of types as follows List of columns: Previous year    last

  • How to add attachments to appointment?

    appointment.Attachments.AddFileAttachment(file.Name, stream); //appointment.Attachments[0].IsInline = true; disabled in Outlook 2007 appointment.Save(WellKnownFolderName.Calendar, SendInvitationsMode.SendToAllAndSaveCopy); The recipient can't see the

  • Need assistance with Flashing Question Mark

    I recently bought a used MacBook Pro. The computer is in excellent shape, and nothing physically wrong with the computer at all. The MBP came with OSX already installed and running, and also had Boot Camp and Windows XP running on it as well. Since I

  • ALSB passing NTLM security credentials to end point URL in business service

    Hi, We are using AXIS API to pass NTLM authentication details to SharePoint Web Service by setting the user name and password details as below. call.setUsername call.setPassword This is working fine when we invoke the MOSS search WSDL directly. Howev