How to display 20 random symbols from pool of 50?

Hi,
I have a project that plays a random symbol when a button is clicked, however I want a random symbol to be shown each time the button is pressed for 20 times.
How do I limit the display to just show 20 random symbols from a pool of 50?
This is the code I am using on the button that displays a random symbol each time clicked:
// RADOMIZE
          var myVar = Math.floor((Math.random()*4)+1);
// create symbol into container
          var container = sym.$('container');
          var myAni = sym.createChildSymbol("Symbol_" + myVar, container);
          myAni.getSymbolElement().css({
          'position': 'absolute',
          'left': 0,
          'top': 0,
Thanks

You need to shuffle the array and then randomize the 20 elements".
Here is a example showing you how to do with 4 elements:
var originalArray=['one','two','three','four','five','six','seven','eight','nine','ten'];
// shuffle the original array
originalArray.sort(function() {return 0.5 - Math.random()});
// then  limit the array to the 4 first elements
originalArray.length =4;
// the alert is to show that you have 4 elements and what they are - added 5 to show element 5 does not exist.
alert(originalArray[0] + ' ' +originalArray[1] + ' ' +originalArray[2] + ' ' +originalArray[3] + ' ' +originalArray[4]);
// randomize the elements in the new array
var myVar = Math.floor((Math.random()*3)+1);
sym.$('Text').click(function(){
          // myVar++;
     // shows one of the 4 numbers
          sym.$('Text').html(originalArray[myVar]);

Similar Messages

  • How to display a new view from a nib ?

    how to
    display a new view from a nib in the main window after clicking on a button.
    When I click a the button named for example "goToGokyo", the link to my procedure
    runs correctly because I see my NSLog message "goToGokyo button pressed".
    My nib, which name is "GokyoViewController" does exist.
    I did as follow for the moment but I'm stuck now, my nib  :
    - (IBAction)goToGokyo:(id)sender
        NSLog(@"goToGokyo button pressed");
      //[self stopSound];
      if (gokyoViewController == nil)
            GokyoViewController *aGokyoViewController = [[GokyoViewController alloc]
                                                         initWithNibName:@"GokyoViewController" bundle:nil];
            self.gokyoViewController = aGokyoViewController;
            //[aGokyoViewController release];
        [self GokyoView:gokyoViewController animated:YES completion: nil];
    Thanks in advance for your advice.
    Cheers

    I did that now :
    - (IBAction)btnLoadMyViewController:(id)sender
        NSViewController *viewController = [[NSViewController alloc] initWithNibName:@"MyView" bundle:nil];
        NSView *view = [viewController view];
        [_myWindowController.window setContentView:view];
        //view addSubview:view];
        //[self.myView addSubview:view];
    Using
    "_myWindowController.window setContentView:view];"
    or
    "[self.myView addSubview:view];"
    does not an error but does nothing !
    Would you help me one more times please ?
    Thanks in advance

  • How to display a oracle table from a java program?

    How to display a oracle table from a java program.
    Hello friends, I have written a Java program, using oracle 10g as backend.
    I want to display a oracle table as output. Im not getting how to display oracle table as a output table.. Pls help me
    Thank you

    jayanthds, you're not going to get a satisfactory
    answer to this here. it's too big a task to justbe
    quickly outlined in a forum - the reply "all youneed
    to do is to query you table and return it asJTable"
    is worthless, for example, since the solution to
    any problem can be distilled to such a
    soundbite, if need be. doesn't make the solutionany
    simpler
    essentially you're asking "how do I write adatabase
    application?". all you'll get is snippets of code
    that, when fitted together, will eventually helpyou
    do this, but you'll spend days and days comingback
    saying "right, I've done that, now what?" until
    either you or the forum gets frustrated with the
    whole affair and the process stops
    there are entire books written about this subject,
    and countless tutorials and guides on theinternet.
    you're better off going down that routehehehe.well, it's true! I used to have a manager that would outline the solution to a problem in a few lines of pseudocode, and then firmly believe that the actual solution would be just as brief and simple. shame his pseudocode included such lofty abstractions as "reformat all data"

  • Creating BOM using BDC :How to display no of records from flat file under

    Hi,
          How to display no of records from flat file under one (Alternative BOM) vertically.
        When i execute, the records are replacing one by one.
    Here my coding:
    report ZBOM1
           no standard page heading line-size 255.
    *include bdcrecx1.
    DATA: BEGIN OF bdc OCCURS 0,
           matnr(18),
           werks(4),
           stlan(1),
          END OF BDC.
    DATA: BEGIN OF BDC1 OCCURS 0,
           idnrk(18),
           MENGE(18),
           MEINS(3),
           postp(1),
          END OF bdc1.
    DATA: BEGIN OF BDCDATA OCCURS 0,
             matnr(18),
             werks(4),
             stlan(1),
             idnrk(18),
             MENGE(18),
             MEINS(3),
             postp(1),
             posnr(4),
          END OF BDCDATA.
    data: ibdcdata type  standard table of bdcdata WITH HEADER LINE.
    *start-of-selection.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'
       FILETYPE                       = 'ASC'
       HAS_FIELD_SEPARATOR            = ','
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                     =
      HEADER                         =
      TABLES
        DATA_TAB                      = BDCDATA
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *perform open_group.
    loop at bdcdata.
    perform bdc_dynpro      using 'SAPLCSDI' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29N-STLAN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29N-MATNR'
                                  'SOFTDRINKS'.
    perform bdc_field       using 'RC29N-WERKS'
                                  'WIND'.
    perform bdc_field       using 'RC29N-STLAN'
                                  '1'.
    perform bdc_field       using 'RC29N-DATUV'
                                  '16.09.2008'.
    perform bdc_dynpro      using 'SAPLCSDI' '0110'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29K-BMENG'
                                  '1'.
    perform bdc_field       using 'RC29K-STLST'
                                  '1'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-EXSTL'.
    perform bdc_dynpro      using 'SAPLCSDI' '0111'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-LABOR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLCSDI' '0140'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POSTP(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=FCBU'.
    perform bdc_field       using 'RC29P-IDNRK(01)'
                                  BDCDATA-IDNRK.
    perform bdc_field       using 'RC29P-MENGE(01)'
                                  BDCDATA-MENGE.
    perform bdc_field       using 'RC29P-MEINS(01)'
                                  BDCDATA-MEINS.
    perform bdc_field       using 'RC29P-POSTP(01)'
                                  BDCDATA-POSTP.
    perform bdc_dynpro      using 'SAPLCSDI' '0130'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POSNR'.
    perform bdc_field       using 'RC29P-POSNR'
                                   BDCDATA-POSNR.            "'0010'.
    perform bdc_field       using 'RC29P-IDNRK'
                                  BDCDATA-IDNRK.             "'15'.
    perform bdc_field       using 'RC29P-MENGE'
                                  BDCDATA-MENGE.             "'1'.
    perform bdc_field       using 'RC29P-MEINS'
                                  BDCDATA-MEINS.             "'ml'.
    perform bdc_dynpro      using 'SAPLCSDI' '0131'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POTX1'.
    perform bdc_field       using 'RC29P-SANKA'
                                  'X'.
    *perform bdc_transaction using 'CS01'.
    *perform close_group.
    CALL TRANSACTION 'CS01' USING IBDCDATA MODE 'A' UPDATE 'S'.
    REFRESH IBDCDATA.
    endloop.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR iBDCDATA.
      iBDCDATA-PROGRAM  = PROGRAM.
      iBDCDATA-DYNPRO   = DYNPRO.
      iBDCDATA-DYNBEGIN = 'X'.
      APPEND ibDCDATA .
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
    IF FVAL <> NODATA.
        CLEAR iBDCDATA.
        iBDCDATA-FNAM = FNAM.
        iBDCDATA-FVAL = FVAL.
        APPEND iBDCDATA .
    ENDIF.
    ENDFORM.

    Hi,
    the BDCDATA structure must be fnam, fval,dynbegin,dynpro,program.
    You have to declare like this and pass this in your CALL TRANSACTION statement.
    Please give some other table name for BDCDATA you declared for and also for IBDCDATA.

  • How to display a Math symbol with Subscript(like  "Xad", make the "ad" be Subscript )

    How to display a Math symbol with Subscript(like  "Xad", make the "ad" be Subscript )
    I need to show "Xad"(ad is Subscript )
    I try to find the letter subscript......but ,Unicode set is not have.....
    I try to use  X<sub>ad</sub>   show it  whit Text.htmlText,   but is not used,   I think Flex's HTML is  not support the <sub> mark.
    can you tell me , how to display a Math symbol with Subscript(like  "Xad", make the "ad" be Subscript )
    thank you very much.....

    http://blog.ggshow.com/index.php/how_to_use_subscript_aamp_superscript_in?blog=11
    http://jasonbejot.com/superscript-and-subscript-in-actionscript
    and thank you very very muck

  • How do I control Edge symbols from external javascript?

    I have come across about a dozen similar discussions, but most have presented solutions that worked in earlier versions of Edge and no longer work.
    I am trying to use Edge to build animations that can then be integrated into larger non-Edge projects. I would like to then be able to control the Edge timeline or Edge symbols from elements OUTSIDE of Edge, such as another link or button in the page.
    I cannot seem to figure out how to properly reference the Edge stage or symbols.
    I have come across several proposed solutions for referencing Edge stage, such as:    
         var comp = AdobeEdge.getComposition("EDGE-966604542");
         var stage = comp.getStage();
         var comp = $.Edge.getComposition("EDGE-966604542");
         var stage = comp.getStage();    
         var comp = Edge.getComposition("EDGE-966604542");
         var stage = comp.getStage();
         and these either DO NOTHING or throw errors about either AdobeEdge or Edge or comp being undefined.
         Does anyone have a solution that really works with the current version of Edge Animate?
    Thanks
    Scott

    i created a Trigger @ 0ms and moved the function there...
    function hello(){
         alert("hello");
    still not getting the alert to fire with this in the external js:
    var comp = AdobeEdge.getComposition(compId).getStage();
    comp.hello();
    any thoughts?

  • How do you remove a symbol from the stage in Edge animate?

    Hello-
    I'm wondering how to remove a symbol from the stage in Edge Animate so you can jump to another place in the timeline.  In Flash, the symbol was only on the stage for the amount of frames you indicated.  Not sure how it works here.
    For example, I have 2 buttons on my first screen with some text that animates in.  I want the button click to take the user to another section in the timeline or (basically another scene, like in Flash)  that contains different content.  If I change the visibility the buttons are still there and will ( I assume) create problems when other elements are placed on top. 
    Or is the only way with code.  If that is the case what would that code be?
    I would appreciate any help.
    Thank you!

    What I usually do, is, once you have everything set up in the scene you are done with. highlight it all
    right click
    group elements in DIV
    Now all those items act as 1 group and then you give it a properties name, much like a symbol.
    THEN you can refer to that scene name and move it anywhere or hide it and slide in another scene that has the content for that next scene.
    basically you take all the elements that make up 1 scene, gruop it up, name it, and then in the code for the button say something like:
    on click:
    scenename.play(framenumber);
    that will then animate that scene according to any animation you gave it, such as moving to the left, off stage. while moving scene 2 that you create into the stage.
    or just have something like this hide it
    sym.$("scenename").hide();
    sym.$("scene2name").show();
    but if you do that, make sure in your CompositionReady code you hide all scenes EXCEPT the 1st one, so the user doesnt see them all instanatly anyway.

  • 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 Top-5 earners from the table,there should be no duplication

    Hi All
    Can you give me some idea about this query,
    i want a query like
    1)How to dispaly top-N earners from the Emp Table ( i want to dispaly top 5 sal )
    2)There should be no duplicaion in the sal.
    3)If Two emp's earn the same sal,the sal should be picked up only once....!!
    select distinct (sal) from emp order by sal desc;
    select distinct (sal) from emp order by sal desc;
    SAL
    5000
    3000
    2975
    2850
    2450
    1600
    1500
    1300
    1250
    1100
    950
    800
    I want to display only first 5 rows !!
    That first 5 rows i have to insert into other table..!! Please How to display only first 5 rows..!!
    Please can you give me some idea..!!
    Thank in Advance

    USE THIS QUERY
    SELECT SAL FROM (SELECT DISTINCT SAL FROM SCOTT.EMP ORDER BY SAL DESC) WHERE ROWNUM <= 5
    IF U WANT TO FIND 3 SAL OR 4 0R ANY USE THIS QUERY
    SELECT SAL FROM SCOTT.EMP A WHERE &N = (SELECT COUNT(DISTINCT B.SAL) FROM SCOTT.EMP B WHERE B.SAL <= A.SAL)
    FOR &N = GIVE UR VALUE

  • How to display method result invoke from toolbar button on ADF

    Hi,
    I don't know how to display a message error or result, it is return from the method that is invoke from de toolbar button.
    thank for your help,
    Alex

    What type of UI? Swing? JSF? What is the method you are invoking ? a backing bean method? A method in an AM? How are you binding the button to the method?
    You might want to read this first:
    http://blogs.oracle.com/shay/2007/03/02

  • How can i Use the symbols from the main html page?

    Hello!
    Im trying to find a solution for days!!
    i need to use my symbols from the html page, for example to hide the symbol i want to use: sym.$( "sym1" ).hide(); or to make it draggable (with jquery UI) i wanna use: sym.$( "sym1" ).draggable(); but it doesn't work.
    i know i can do the same from the edgeActions.js file and here is the working code:
          Symbol.bindElementAction(compId, symbolName, "document", "compositionReady", function(sym, e) {
             var ex1 = sym.$( "farmer" );
             //ex1.html( '<input type="text" />' );
             yepnope({
                 both: [
                     "libs/jquery-ui.min.js",
                     "libs/jquery-ui.css",
                 callback: function() {
             ( ex1 ).draggable();
    but the main problem is that it's always include this file as the very last .js, so in case Im trying to use the symbols from the index.html page (For example:  ( ex1 ).draggable();  ) the variables are undefined (because it read the html first)...
    Please Help, Im desperate..
    Thank you very much!!!
    Eran

    Hi, Eran-
    You will want to use the AdobeEdge.* APIs, which should give you access from external JavaScript into your Edge Animation.  The API document has information on that.  However, you will need to wait until the runtime loads, so you should use the bootstrapping method that is outlined in Josh Hatwich's post on our blog:
    http://blogs.adobe.com/edge/2012/05/15/bootstrapping-edge-compositions/
    Hope that helps!
    -Elaine

  • How to display complex type result from web service?

    Hi,
    I am trying to invoke a web service with the following code
    but I can't display the result. Can someone help me how to display
    the result?
    <cfset randomID = CreateUUID()>
    <cfset today = Now()>
    <cfset args = StructNew()>
    <cfset args.login = "wanna">
    <cfset args.key = "#DateFormat(today, 'YYYY-MM-DD')#
    #TimeFormat(today, 'hh:mm:ss')#:#Left(randomID,12)#">
    <cfset args.hash= LCase(Hash("123456" & args.key,
    "SHA"))>
    <CFINVOKE webservice="
    http://sandbox.voxbone.com/ws/services/VoxService?wsdl"
    METHOD="getCountriesList"
    AuthenticationToken="#args#"
    RETURNVARIABLE="Result">
    <cfoutput>#Result#</cfoutput>

    I have tried using that that it display the following. I was
    expecting a list of coutries but it display the following text
    only. Can you guide me in displaying list of countries?
    "object of
    voxbone.webservices.services.containers.ArrayOfCountry"
    Methods hashCode (returns int)
    equals (returns boolean)
    getCountry (returns
    [Lvoxbone.webservices.services.containers.Country;)
    getCountry (returns
    voxbone.webservices.services.containers.Country)
    getSerializer (returns interface
    org.apache.axis.encoding.Serializer)
    getDeserializer (returns interface
    org.apache.axis.encoding.Deserializer)
    getTypeDesc (returns org.apache.axis.description.TypeDesc)
    setCountry (returns void)
    setCountry (returns void)
    getClass (returns java.lang.Class)
    wait (returns void)
    wait (returns void)
    wait (returns void)
    notify (returns void)
    notifyAll (returns void)
    toString (returns java.lang.String)

  • How to display meesage in JSP from DAO.java

    Hi all,
    I have a Dao.java coding where i have my oracle queries executed.i have separate functions for every query.It should return boolean value.If the 1st functions returns true,then the second function should be called.if it returns false,i have to display some message like "You have received the message already" in my JSP.i use JSP,Servlet and Dao.
    How to execute this.How to display the message.Pardon me if its too silly.Help me out guys.
    If(true)
    call 2nd function
    else
    display message
    }

    What have you tried?
    What happened?

  • How to efficiently select random rows from a large table ?

    Hello,
    The following code will select 5 rows out of a random set of rows from the emp (employee) table
    select *
      from (
           select ename, job
             from emp
           order by dbms_random.value()
    where rownum <= 5my concern is that the inner select will cause a table scan in order to assign a random value to each row. This code when used against a large table can be a performance problem.
    Is there an efficient way of selecting random rows from a table without having to do a table scan ? (I am new to Oracle, therefore it is possible that I am missing a very simple way to perform this task.)
    thank you for your help,
    John.
    Edited by: 440bx on Jul 10, 2010 6:18 PM

    Have a look at the SAMPLE clause of the select statement. The number in parenthesis is a percentage of the table.
    SQL> create table t as select * from dba_objects;
    Table created.
    SQL> explain plan for select * from t sample (1);
    Explained.
    SQL> @xp
    PLAN_TABLE_OUTPUT
    Plan hash value: 2767392432
    | Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |      |   725 | 70325 |   289   (1)| 00:00:04 |
    |   1 |  TABLE ACCESS SAMPLE| T    |   725 | 70325 |   289   (1)| 00:00:04 |
    8 rows selected.

  • How to remove a dynamic symbol from the stage?

    I'm loading dynamically copies of a Library symbol with a button click. Question is, when I move around in the timeline, I don't want to see the symbols at certain points. Can I loop through the json file and remove each symbol from the stage? Or is there a better way of accomplishing this?
    Being new to Edge Animate, I'm also unsure as to the names of the symbols as they are placed on the stage. If I use the browser's developer tools, I can see that the divs are named Stage_90, Stage_91, Stage_92 etc. However doing something like the following does not seem to work:
    sym.$("Stage_90").hide();
    I appreciate the help. Thanks again.

    I got it. It should be:
    $("#region1").remove();  
    // # was missing.
    I actually added that to time 0 on the main timeline so when I got back there it removes the image.
    It's not working from the symbol yet but I guess I should eventually get it working from there instead.
    Thanks for your time.

Maybe you are looking for

  • How can I change my iCloud email and password?

    How can I change my iCloud email and password ? My iCloud password can't open my iCloud account any more

  • Please help me! iBooks delete all pdfs then uploads all at every sync.

    Hi everyone, I need some help, much appreciated if anyone can give me a hand. I have hundreds of heavy PDF files I use in a daily basis for Uni, about 10GB in my iPad 3 (the one pre-air) is of PDFs. I ran into an issue today for the first time ever,

  • Default Buttons

    Hi, I've got a simple application that needs a custom "search" dialog. I've created a subclass of JDialog and it comes up just fine... Basically I have a JTextField for them to put in the search, a few checkboxes for the options, and two buttons at t

  • QUESTION ABOUT FILES

    I want to delete an entry from a file and i'm trying not to load everything into memory at once. Now, what i intend doing is, as i read from the file with the data (joe.txt), if the line read from joe.txt isn't what i want to delete, i want to write

  • GotoAndPlay Just Stops

    I am using gotoAndPlay in a function with ENTER_FRAME event. I believe that it goes to the frame (used trace) but it just stops and won't play. I have been working on this for a couple of hours and the closest thing I could find to an answer was this