How to create a sequence of flashes ...

hey i'm trying to create a simple version of a simon says game. where the applet will have (some image) and it will flash (some image) in differnent sequences. i want it to randomly choose a sequence - that's the first part... then I would like to have the sequence extended on the next time around... I can't really explain it but here is some code that I have but I can't really understand it
  //     Setup the sequence array
  public void sequence() {
    int prev1= 0, prev2= 0, curr;
    for (int a= 0; a<imgSquare; a++) {
      while (prev1 == (curr= rand(7) + 1) || prev2 == curr) ;
      prev2= prev1; prev1= seq[a]= curr;
    seqLength= min_seqLength;
   //     Random numbers
  int rand(int siz) {
    return Math.abs(rand.nextInt()) % siz;
  } i think this is what is supposed to happen, but i'm very new to java so I am not really sure what to do first.
I would like to have seven squares on the applet and each applet flashes in different sequences, the first one short, the next one longer...and so on.
can anybody please help me out with this???
how should I structure this program and where should I start first?
Thank you in advance

The basic idea here is,
--> Store the images in an array of size 7
loop {
--> Randomly generate an integer in the range 0 to 6
--> Get the image out of the array with this random index
--> Update the image on your applet square(or whatever)
} // end loop
regds,
CA

Similar Messages

  • How to create a SEQUENCE in MSSQL2005

    Hi
    I am also having a similar problem which opened the thread
    Actually i am using a Repositery which is created in MSSQL2005.
    Now i want to create a SEQUENCE similar to Oracle and populate My surrogate Key Column.
    Can u tell me how to create a SEQUENCE in MSSQL2005?
    Does anyone is having the sql syntax?
    Thanks
    Gourisankar

    Hi Gourisankar,
    There is no sequence concept in MS SQL Server rather it has IDENTITY.
    In MS SQL Server if you declare a column type as a Identity it will be auto increment when a new record inserts.
    So in you underlying table create a column as ID and type as "Identity" and in your mapping leave that field un mapped.
    Have a look and google more on "identity in ms sql server" ;)
    http://www.sqlteam.com/article/autonumbering-identity-columns
    http://www.craigsmullins.com/ssu_0599.htm
    Thanks,
    G

  • Need to learn how to create a slideshow in Flash

    Hello All,
    I'm new to Flash and I need to learn how to do a slideshow with exactly the same features as can be found in this link:
    http://www.esppromo.com/index.asp
    Just like at the link above, it needs to play through the slides automatically once the page is loaded, each slide needs to link to a specific URL, and I need controls similar to the boxes at the bottom so the viewer can click on any specific slide they wish to view (I'd like to have numbers in the boxes though). The transitions don't have to slide across like this. If a fade is easier, that would be fine.
    Since I've looked online, but can't find any tutorials for doing this in Flash Professional, I think I'll pick up a book on Flash. There are some online tutorials that are close but nothing that is exactly what I'm looking for.
    I'm just wondering if anyone can recommend a particular book that covers creating this type of slide show with the links and controls exactly as I need it to be. I see these types of slide shows on a lot of sites now, so I'm hoping that maybe someone else on this forum has had to learn how to do this and can recommend a book they used?
    I was looking at Adobe Flash Professional CS5 Classroom in a Book and it looked like it may be what I'm after, but I am rather cautious, as I don't want to end up with instructions that are close to what I am looking for, but not quite right.
    Actually, I thought I'd be able to do this fairly easily with Flash Catalyst, so I updated to Adobe CS5 Design Premium. I found that Flash Catalyst can be used to create a slide show like this, but unfortunately it won't play automatically when the page loads and the viewer has to manually click through the slides, which is not what I need. I could be wrong, but from what I've read, I need Flash Builder to add code so the slide show will play automatically if I create it in Flash Catalyst. Since it's not an option for me to buy more software at this time, I've decided to learn how to do this in Flash Professional.
    I really want to learn how to do this. I expect to go on and create more using Flash, but for now I just REALLY need to figure this slide show out.
    If anyone can help out, I'd really appreciate it!
    Thanks,
    William

    Edit:
    i'm sorry. it is a huge work to type this and will be confusing as hell. i'm already up to 1 full word page of explanation. Though i am able to do it, explaning it in full lengh is ... well.. very hard. Way harder than it is to make your flash itself.
    I can however point you to some element you should read about how to make them:
    - How to use timeline in flash cs4
    - how to create a button in flash cs4
    - How to make "CLASSIC TWEEN" in flash cs4
    - How to use ActionScript 2 ( AS2) basic command like : GetUrl, Gotoandplay, Stop and how to put those script in the right location. ( AS2 allow you to put script directly on the button itself. however it is best to put it in the Action Layer that you will have to build in the timeline.
    - How to import thing in library.
    keep in mind that what you want to make is mostly a Logic probleme...
    - Image 1 click = GetURL X,
    - After Y time, Switch image 1 to image 2 with animation. Do the same for the button.
    - If you click on button 1 while being on image 3, you have to set all the reverse animation in the timeline, and use a lot of Gotoandplay.
    Hope this help you a little.
    I'm sorry. i really wanted to help you do it, but it is just a monstruous job to write all this.

  • How to Create Test Sequence Document in HTML using command line

    How to Create Test Sequence Document  in HTML using command line
    I have lot of sequences and I want to create Test Sequence Documentation in HTML format using Command Line automatically, is there a way to automate this task using .bat file or using   C#  .Net

    If you aren't able to figure out how to call a C++ DLL in .net then there may be another option.  Unfortunately I don't know how to do this off the top of my head and I don't have an example.
    The other option would be to change docgen.seq a little bit to the dialog doesn't display and you just hardcode the options.  Then you can use a command line to call testexec.exe: http://zone.ni.com/reference/en-XX/help/370052K-01/tsfundamentals/infotopics/startup_opt/
    Hope this helps,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • How to Create a Sequence Number from BI Publisher Layout editor?

    How to Create a Sequence Number (1,2,3,4,......,etc) from BI Publisher Layout editor

    Thank you for your replay, but <?position()?> we can used it in template builder only not from BI layout editor
    I found a solution in this case we can used the following query.
    SELECT
    ROW_NUMBER() OVER(order by item_status) as Row,

  • How to create a sequence DDL in a procedure

    Hello,
    i have a simple question but i dont find a solution here.
    How to create a sequence DDL in a procedure ?
    Thank 's

    Use Native Dynamic Sql. Look at the EXECUTE IMMEDIATE command.
    declare
    begin
       execute immediate 'create sequence xx_seq ';
    end;
    /Of course you need explicit permission to create a sequence. NOT through a ROLE.

  • How to create volume slider for flash cs 5 using action script 2.0?

    how to create volume slider for flash cs 5 using action script 2.0?the output should like if user want to hear sound in slow pitch,medium pitch or high pitch(slow to high pitch anything).i have attach this sound to button with using this code:
    stop();
    mySoundBtn.onRelease = function () {
              mySoundC = new Sound(this);
              mySoundC.attachSound("mySoundClip");
              mySoundC.start(0, 10);  //10 represents the number of loops
              gotoAndPlay(2);
    This sound plays till 3-4 scene ahead.
    Can anyone help me?

    Hey thnx Ned.
    this sites are really helpful.but,i have used sound through button.so how it is possible to attavh the link with slider.i have created slider also.
    Below is my slider code for sound.
    onClipEvent (load) {
        mySound1 = new Sound();
        mySound1.loadSound((myScale)+"/"+(myTanpura)+"/"+(myTanpuraSwar)+"/"+(myTanpuraTempo)+".w av", true);
        mySound1.onSoundComplete = function() {
        mySound1.start();
        mySound1.start(0.058,999);
    onClipEvent (enterFrame) {
        downloaded = mySound1.getBytesLoaded();
        total = mySound1.getBytesTotal();
        if (downloaded != total) {
            _root.dl = "You have to buy this software...";
        } else {
            complete = 1;
            _root.dl = "";
        mySound1.setVolume(ratio * 2);
    This code is working for slider.I mean it scrolls the slider.but it dosent make any effect to sound.
    Below is my button code.
    stop();
    mySoundBtn4.onRelease = function () {
              mySoundC = new Sound(this);
              mySoundC.attachSound("mySoundClip4");
              mySoundC.start(0, 300);  //10 represents the number of loops
              gotoAndPlay("play1");
    this is on button's frame.not exactly on button.
    Button and Slider both are on diffrent scene.
    Can you plese help me out?

  • How to create a Macromedia's Flash Java Player with JMF?

    How to create a Macromedia's Flash Java Player with JMF? Can you give me an example? My email:[email protected] [email protected]

    Yes, there is a way. Look up JTree in the API.-can you post some code.... i cant figure out on how to use JTree...
    i'm still confused on where will i get the entire directories of my drives...
    thanks

  • How to create a sequence for an particular item in my apex form

    Hi friends,
    I created an database application, of a form with a report, and it is working fine...
    But in my form, i have a requirement....The below are the existing fields in my form
    issue no
    created by
    start date
    status
    priority
    due date
    Among these fields in my form i need to create a 'Sequence' for my field "issue no",
    So that whenever i opened the form the 'issue number' must generate automatically like 1 for the first time, 2 for the second time and so on..
    For that i created a sequence
    CREATE SEQUENCE "ORDERS_SEQ"
    MINVALUE 1
    MAXVALUE 999999999999999999999999999
    INCREMENT BY 1
    START WITH 1000
    NOCACHE
    NOCYCLE;
    But for validation where i need to write the sequence query for the particular item 'issue no'....i dont have any idea of where to write the validation query for the sequence..
    please tell where i need to write in step wise manner..please help me friends...
    As the below is my validated sequence query for item 'issue no'
    'select seq.issue_id.nextval into issue_no'
    This is my above validation query whether the query that i mentioned is right..if not let me know the validation query..
    And also i need where to apply this validation query in steps..
    Thanks in advance
    Regards,
    Harry...

    Harry,
    Rik is on the right track. Here is a sample insert trigger: Would need to substitute you sequence ORDERS_SEQ with my sequence las_log_seq, how you define or use timestamps is up to you.
    DROP TRIGGER LASDEV.BINS1_LAS_LOG_TBL;
    CREATE OR REPLACE TRIGGER LASDEV."BINS1_LAS_LOG_TBL"
       BEFORE INSERT
       ON las_log_tbl
       FOR EACH ROW
    BEGIN
       -- Description: Insert log_seq, creation_dt, creation_id,
       --              lst_updt_dt and lst_updt_id.
       -- Maintenance:
       -- Date        Actor          Action
       -- ====        =====          ======
       -- 07-Sep-2010 J. Wells       Create.
       :new.creation_id := nvl( v( 'app_user' ), user );
       :new.creation_dt := SYSDATE;
       :new.lst_updt_dt := :new.creation_dt;
       :new.lst_updt_id := :new.creation_id;
        SELECT las_log_seq.NEXTVAL
          INTO :new.las_log_seq
          FROM DUAL;
    END bins1_las_log_tbl;
    /Heff

  • How to create a sequence based on name, country, city, year, month, number

    Hello,
    I am using Application Express 4.2.1.00.08
    I am new to apex and i need some help in creating a sequence.
    I am creating an application where i profile people and i need to create an auto sequence that when the person is added to the database he will have his own sequence based on his name, country, city, year he was added, month he was added and his number.
    This is a bit tricky because each person will have a different name, country city etc.
    How can this be done ?

    Hello,
    I have to create a sequence so that when for example an employee is added using a form his ID will be saved based on his name, country, city, year he was created, month he was created and his number.
    However, each employee is diff, so when you add another employee to the form his ID will be different, different name, country, city etc..
    This has to be automatically generated.. is this possible?

  • How to create a sequence in Answers?

    Hi everyone,
    I want to know if it's possible to create a sequence in Answers and how.
    I have a Pivot table that I want to assign row numbers, but when I use RCOUNT(1) in a Dummy column I end up with 1 in all rows.
    This is the format of my pivot table.
    -------------------------------------Measure---
    ---------------------------------Y-1-------Y----
    Order(DUMMY)---Code---Desc-- 2009 ----- 2010
    1 435 idn 1 2
    1 53 dvf 3 1
    1 123 asd 8 4
    I've tried to do RCOUNT(1 by Y) but then I end up having the double of rows.
    Can it be done???
    Thanks in Advanced

    Try doing this:
    1) Create a dummy column and call it DUMMY with this in the fx:
    CASE WHEN 1=0 THEN tablename.columname ELSE 'whatever' END
    2) You can hide this column.
    3) Then in your "sequence" column, click on the fx and type:
    RCOUNT(1 by DUMMY)
    where "DUMMY" is the column created in step 1.

  • How to create a sequence using Toplink for DUAL table

    Hi All,
    How do I create below sequence using TOPLINK
    CREATE sequence my_seq start WITH 1;
    Regards,
    Dheeraj

    Hi Dheeraj,
    Sequence Object should be created in Database and specify the type of sequence that will be used in toplink to create sequence value.For example,sequence objects created in database needs to be configured using Native Sequence.
    For more information refer to the below link.Use JDeveloper Toplink Wizards for declarative programming of Toplink native Sequencing.
    http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/reldscfg003.htm.
    Regards,
    P.Vinay Kumar

  • How to create a sequence number to insert values to database

    I am working on the application for the client to insert their vendor informaton to our database. We have a refvendor table and vendorid is primary key. I was asked for the vendorid to be a sequential number. I am not sure if the DBA set up the vendor id to be a sequential number by creating sequence or is this something i can do myself. if so can you help me how i can create and make the vendor id a sequentiial number. Thank you
    Tablename is Refvendor
    vendorId, vendorname, dbestaus

    user452051 wrote:
    thank you for the reply. I am still learning about sequence. so the value from seq.netval will be inserted to the vendor id field. my first number will be 00001,00002,00003,00004,.... How can I do for the sequence to start with 00001If you create a sequence as shown, it will start with 1
    ,..... and my other question if I delete sequence 00002 will the number be re-arranged?no
    There will be gaps in the numbers.

  • How to create a Sequence;

    Hi All,
    I have a master block and child block;
    I need to create sequence number in child block like 1 2 3 4
    Line #
    1....date1.....12......
    2....date2.....xxx....
    3....xxx........xxx....
    4..........
    When i create new customer and its detail it should start with new sequence
    and some one query the records and open it then this should continue the sequence.
    Thx.
    Message was edited by:
    J.Harsha

    Jan, I have created the multi records it is fine,
    This is about how to get the sequence numbers,
    Lets say some one open one record and it have 5 detail records.
    if he is in second detail record and try to insert a new record i want to show
    Line id 6
    I was trying with
    SELECT nvl(MAX(LINE_PERIOD)+1,0) INTO l_LINE_PERIOD FROM XX_RATE_LINE RL
    WHERE RL.CUSTOMER_ID=:MSF_V.CUSTOMER_ID;
    if l_line_period>4 then -- we gave default 4 records
    bk_id := Find_Block('MSF_LINE');
    --last_record;
    :line_period := Get_Block_Property( bk_id, MAX_RECORDS_FETCHED)+1;
    --CURRENT_RECORD);
    --MAX_RECORDS_FETCHED
    end if;
    CURRENT_RECORD is good if some one navigating properly always into the last record.
    Message was edited by:
    J.Harsha

  • How to create a sequence in oracle forms6i

    Oracle forms 6i
    Hai All
    I am working in leave application entry so i need to create a sequence for giving a unique number for each entry
    Pls tell me the steps how to created and how to call the sequence from database
    Thanks in Advance
    Srikkanth.m

    Hi,
    Create sequence <sequence_name>
    Start with <number>
    increment by <number>
    in database
    eg:- create sequence test_seq
    start with 1
    increment by 1;
    in forms
    you can assign value in pre-insert trigger
    Declare
    cursor cur_seq is
    select test_seq.nextval from dual;
    begin
    open cur_seq;
    fetch cur_seq into :item_key ; /* :item_key give name of ur primary key field*/
    close cur_seq;
    end;

Maybe you are looking for