Switch statement for AS3  - Flash CS3

Hey guys, I currently have a code of a switch statement for as1- as2.
This is it:
switch (int(Math.random() * 20))
    case 0:
        hint = "The total amount of confusion in this world remains constant. It just gets shifted around.";
        break;
    case 1:
        hint = "If you experience poor performance, adjust the quality settings in your preference menu option.";
        break;
    case 2:
        hint = "Anticipation of death is better than death itself.";
        break;
    case 3:
        hint = "At the core of all well-founded belief lies belief that is unfounded.";
        break;
    case 4:
        hint = "The problem with instant gratification is that it takes too long.";
        break;
    case 5:
        hint = "Never let your schooling interfere with your education.";
        break;
    case 6:
        hint = "Beware of geeks bearing gifs.";
        break;
    case 7:
        hint = "Collaboration is essential: It allows you to blame someone else.";
        break;
    case 8:
        hint = "Read my MIPs - no new VAXes.";
        break;
    case 9:
        hint = "Where is the sea, said the fish, as they swam through it.";
        break;
    case 10:
        hint = "You can safely blame any bugs on Aoedipus, who is too busy grinding battlegrounds to do QA on her own work.";
        break;
    case 11:
        hint = "Anything worth doing is worth overdoing.";
        break;
    case 12:
        hint = "There is more to life than increasing its speed.";
        break;
    case 13:
        hint = "Don\'t worry, this will take about as long as the time it takes to play a 2v2 match with 4 ret pallies.";
        break;
    case 14:
        hint = "There is nothing worse than the brilliant image of a fuzzy concept.";
        break;
    case 15:
        hint = "If you are not part of the solution, you are part of the precipitate.";
        break;
    case 16:
        hint = "Two wrongs don\'t make a right, but three lefts do.";
        break;
    case 17:
        hint = "The heresy of today is the logic of tomorrow.";
        break;
    case 18:
        hint = "It\'s not that life is so short, it\'s just that you\'re dead a really long time.";
        break;
    case 19:
        hint = "Those who love sausage, the law, and holy canon should never watch any of them being made.";
        break;
    case 20:
        hint = "What if there were no hypothetical questions?";
        break;
} // End of switch
hint = "HINT: " + hint;
This code is for a dynamic tet with the var 'hint' (No ' ' )
But in as3 there is no var and I am having trouble converting it to AS3 coding, can someone show me the correct conversion of the code to make it work with AS3. I will make the instance name 'hint'.
Thank you ahead of time.

In addition to what other guys said, if you still want to use switch it should be:
switch (Math.round(Math.random() * 20)) - this will cover all the possible integers.
Nevertheless, I believe using switch in this case is not as efficient and scalable as using, say, array.
1. array index access is faster than switch.
2. if you need to make additions, you will need to make additions in switch while with array you just need to add/subtract member
3. if you will need to switch to a more dynamic model (say, getting hints from xml) - it will not be possible with switch
4. you may need a greater degree of randmization (Math.random is not as random as one may think) in which case resorting/reordering array is much simpler and faster.
So, I suggest you switch to the following code:
var hints:Array = [];
hints[0] = "Anticipation of death is better than death itself.";
hints[1] = "Anything worth doing is worth overdoing.";
hints[2] = "At the core of all well-founded belief lies belief that is unfounded.";
hints[3] = "Beware of geeks bearing gifs.";
hints[4] = "Collaboration is essential: It allows you to blame someone else.";
hints[5] = "Don\'t worry, this will take about as long as the time it takes to play a 2v2 match with 4 ret pallies.";
hints[6] = "If you are not part of the solution, you are part of the precipitate.";
hints[7] = "If you experience poor performance, adjust the quality settings in your preference menu option.";
hints[8] = "It\'s not that life is so short, it\'s just that you\'re dead a really long time.";
hints[9] = "Never let your schooling interfere with your education.";
hints[10] = "Read my MIPs - no new VAXes.";
hints[11] = "The heresy of today is the logic of tomorrow.";
hints[12] = "The problem with instant gratification is that it takes too long.";
hints[13] = "The total amount of confusion in this world remains constant. It just gets shifted around.";
hints[14] = "There is more to life than increasing its speed.";
hints[15] = "There is nothing worse than the brilliant image of a fuzzy concept.";
hints[16] = "Those who love sausage, the law, and holy canon should never watch any of them being made.";
hints[17] = "Two wrongs don\'t make a right, but three lefts do.";
hints[18] = "What if there were no hypothetical questions?";
hints[19] = "Where is the sea, said the fish, as they swam through it.";
hints[20] = "You can safely blame any bugs on Aoedipus, who is too busy grinding battlegrounds to do QA on her own work.";
hint = hints[int(Math.random() * hints.length)];
// OR
hint = hints[Math.round(Math.random() * (hints.length - 1))];

Similar Messages

  • How do I update Java for Adobe Flash CS3?

    Hi,
    When I ran Secunia Software Inspector today it told me that
    the version of Java I have installed on my computer is out of date.
    It tells me that it is finding 3 out-of-date files:
    Once here:
    C:\Program Files\Java\jre1.6.0_04\bin\java.exe
    Twice here:
    C:\Windows\System32\java.exe
    and three times here:
    C:\Program Files\Adobe\Adobe Flash CS3\JVM\bin\java.exe
    I updated Java via the Sun website and consequently the first
    and second warnings disappeared when I reran the Software
    Inspector.
    The software inspector however is still finding an
    out-of-date Java version here:
    C:\Program Files\Adobe\Adobe Flash CS3\JVM\bin\java.exe
    Question is: How do I update Java for Adobe Flash CS3?
    Is it adequate to copy the updated file "java.exe" from
    "C:\Program Files\Java\jre1.6.0_04\bin\" to "C:\Program
    Files\Adobe\Adobe Flash CS3\JVM\bin\" or do I need to do anything
    else?
    Any help will be much appreciated.

    Hi
    I have the same problem of you, and the same dont find a
    solution. Me it's Kaspersky Anti Virus (AV) which find this
    problem.
    So (and I dont know if this solution is perfect), but I open
    Flash CS3 with the Java update choiced and apparently Flash
    fonctionnely well and Kaspersky dont find this
    prob now. But I dont never use Java in Flash (or without that
    I know that..), and same, I dont know at what Java is used in Flash
    I think that "JRE v 1.6.0_04" and more recent Java version is
    not good, because it's not quite the same Java application that in
    Flash CS3, In Flash CS3 it's "J2RE" and
    not "JRE".
    The history of all Java versions (and this) is here (
    http://java.sun.com/products/archive/)
    (but in all this versions... seriousely it's a true shambles !)
    If you want the last version for J2RE in this archives it's v
    1.4.2.18 but the last version is J2RE 1.4.2.19 but dont again in
    this archives
    (search on Java site, maybe first page ? I dont remember
    where I to find it...). But the problem... it's that this last
    version (19) is always detected bad by my AV...
    So I decide to use just the next version (v 1.5) and last
    version in this series (in archives site) which is the "JDK/JRE -
    5.0 v 5.0.16" but again named "Java 2 Platform
    Standard Edition (J2SE) 5.0 Update 16" in this dowload next
    archives page
    http://java.sun.com/products/archive/j2se/5.0_16/index.html),
    so well again named "Java 2" in this page (that which dont
    the case for the equivalent same download page for Java 6...)
    (Choice "JRE 5.0 Update 16" in this page)
    For instal "JRE 5.0 Update 16":
    1) Supp all files and folders in "JVM" (Java Virtual Machine)
    folder in Flash CS3 (but dont supp this folder, empty now) and save
    this contents in archive in you have
    affraid.
    2) dl "JRE 5.0 Update 16", directly in this page if you want:
    (https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/View ProductDetail-Start?ProductRef=jre-1.5.0_16-oth-JPR@CDS-CDS_Dev
    eloper)
    3) In install, choice "personal instal" (or +/- the same
    terms) and choice the "JVM" folder of you Flash CS3
    and AV dont detect this version same a bad file

  • Using a Switch statement for Infix to Prefix Expressions

    I am stuck on the numeric and operator portion of the switch statement...I have the problem also figured out in an if/else if statement and it works fine, but the requirements were for the following algorithm:
    while not end of expression
    switch next token of expression
    case space:
    case left parenthesis:
    skip it
    case numeric:
    push the string onto the stack of operands
    case operator:
    push the operator onto the stack of operators
    case right parenthesis:
    pop two operands from operand stack
    pop one operator from operator stack
    form a string onto operand stack
    push the string onto operand stack
    pop the final result off the operand stack
    I know that typically case/switch statement's can only be done via char and int's. As I said I am stuck and hoping to get some pointers. This is for a homework assignment but I am really hoping for a few pointers. I am using a linked stack class as that was also the requirements. Here is the code that I have:
       import java.io.*;
       import java.util.*;
       import java.lang.*;
    /*--------------------------- PUBLIC CLASS INFIXTOPREFIX --------------------------------------*/
    /*-------------------------- INFIX TO PREFIX EXPRESSIONS --------------------------------------*/
        public class infixToPrefix {
          private static LinkedStack operators = new LinkedStack();
          private static LinkedStack operands = new LinkedStack();
            // Class variable for keyboard input
          private static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
             // Repeatedly reads in infix expressions and evaluates them
           public static void main(String[] args) throws IOException {
          // variables
             String expression, response = "y";
          // obtain input of infix expression from user
             while (response.charAt(0) == 'y') {
                System.out.println("Enter a parenthesized infix expression.");          // prompt the user
                System.out.println("Example: ( ( 13 + 2 ) * ( 10 + ( 8 / 3 ) ) )");
                System.out.print("Or as: ((13+2)*(10+(8/3))):  ");
                expression = stdin.readLine();     // read input from the user
             // output prefix expression and ask user if they would like to continue          
                System.out.println("The Prefix expression is: " + prefix(expression));     // output expression
                System.out.println("Evaluate another? y or n: ");          // check with user for anymore expressions
                response = stdin.readLine();     // read input from user
                if (response.charAt(0) == 'n') {          // is user chooses n, output the statement
                   System.out.println("Thank you and have a great day!");
                }     // end if statement
             }     // end while statement
          }     // end method main
       /*------------- CONVERSION OF AN INFIX EXPRESSION TO A PREFIX EXPRESSION ------------*/ 
       /*--------------------------- USING A SWITCH STATEMENT ------------------------------*/
           private static String prefix(String expression) {
                // variables
             String symbol, operandA, operandB, operator, stringA, outcome;
               // initialize tokenizer
             StringTokenizer tokenizer = new StringTokenizer(expression, " +-*/() ", true);     
             while (tokenizer.hasMoreTokens()) {
                symbol = tokenizer.nextToken();     // initialize symbol     
                switch (expression) {
                   case ' ':
                      break;     // accounting for spaces
                   case '(':
                      break;     // skipping the left parenthesis
                   case (Character.isDigit(symbol.charAt(0))):      // case numeric
                      operands.push(symbol);                                   // push the string onto the stack of operands
                      break;
                   case (!symbol.equals(" ") && !symbol.equals("(")):     // case operator
                      operators.push(symbol);                                             // push the operator onto the stack of operators
                      break;
                   case ')':
                      operandA = (String)operands.pop();     // pop off first operand
                      operandB = (String)operands.pop();     // pop off second operand
                      operator = (String)operators.pop();     // pop off operator
                      stringA = operator + " " + operandB + " " + operandA;          // form the new string
                      operands.push(stringA);
                      break;
                }     // end switch statement
             }     // end while statement
             outcome = (String)operands.pop();     // pop off the outcome
             return outcome;     // return outcome
          }     // end method prefix
       }     // end class infixToPrefixAny help would be greatly appreciated!

    so, i did what flounder suggested:
             char e = expression.charAt(0);
             while (tokenizer.hasMoreTokens()) {
                symbol = tokenizer.nextToken();     // initialize symbol     
                switch (e) {
                   case ' ':
                      break;     // accounting for spaces
                   case '(':
                      break;     // skipping the left parenthesis
                   case '0':
                   case '1':
                   case '2':
                   case '3':
                   case '4':
                   case '5':
                   case '6':
                   case '7':
                   case '8':
                   case '9':
                      operands.push(symbol);     // push the string onto the stack of operands
                      break;                               // case numeric
                   case '+':
                   case '-':
                   case '*':
                   case '/':
                      operators.push(symbol);     // push the operator onto the stack of operators
                      break;                               // case operator
                   case ')':
                      operandA = (String)operands.pop();     // pop off first operand
                      operandB = (String)operands.pop();     // pop off second operand
                      operator = (String)operators.pop();     // pop off operator
                      stringA = operator + " " + operandB + " " + operandA;          // form the new string
                      operands.push(stringA);
                      break;
                   default:
                }     // end switch statement
             }     // end while statement
             outcome = (String)operands.pop();     // pop off the outcome
             return outcome;     // return outcomeafter this, I am able to compile the code free of errors and I am able to enter the infix expression, however, the moment enter is hit it provides the following errors:
    Exception in thread "main" java.lang.NullPointerException
         at LinkedStack$Node.access$100(LinkedStack.java:11)
         at LinkedStack.pop(LinkedStack.java:44)
         at infixToPrefix.prefix(infixToPrefix.java:119)
         at infixToPrefix.main(infixToPrefix.java:59)
    Any ideas as to why? I am still looking through seeing if I can't figure it out, but any suggestions? Here is the linked stack code:
        public class LinkedStack {
       /*--------------- LINKED LIST NODE ---------------*/
           private class Node {
             private Object data;
             private Node previous;
          }     // end class node
       /*--------------  VARIABLES --------------*/
          private Node top;
      /*-- Push Method: pushes object onto LinkedStack --*/     
           public void push(Object data) {
             Node newTop = new Node();
             newTop.data = data;
             newTop.previous = top;
             top = newTop;
          }     // end function push
       /*--- Pop Method: pop obejct off of LinkedStack ---*/
           public Object pop()      {
             Object data = top.data;
             top = top.previous;
             return data;
          }     // end function pop
       } // end class linked stackEdited by: drmsndrgns on Mar 12, 2008 8:10 AM
    Edited by: drmsndrgns on Mar 12, 2008 8:14 AM
    Edited by: drmsndrgns on Mar 12, 2008 8:26 AM

  • Recommend Books, Helping Material for Adobe Flash CS3 ACE

    Hi fellas
    Please recommend me some books, helping material, blogs, links which could be helpful in the preparation of the Adobe Flash CS3 Ace Exam.
    Thanks in advance.

    Here is the official Adobe ACE prep resources page.
    It lists out each product exam, and gives a link to download a pdf regarding that exam.  The pdf details the breakdown of questions, the number of questions there are, the percentage necessary to pass, and approx 10 sample questions.
    http://partners.adobe.com/public/ace/main.html

  • Flash CS3 Component Help?

    I have a menu component I've created in Flash CS3. I'm
    running into a small problem. Currently, in Flash, I create an
    array in the first frame of the movie and then assign a
    "menu_items" property (an array) on my menu object as that array.
    The array is an array of specialized menu item objects that is
    defined in a separate class. In Flex, I would like to do this:
    <mxml:macMenu>
    <mxml:macMenuItem image="btn1.png" click="{clickHandler}"
    />
    <mxml:macMenuItem image="btn2.png" click="{clickHandler}"
    />
    .....etc
    </mxml:macMenu>
    I'm not quite sure how I can get my object to realize the
    children should be part of the array inside of macMenu called
    "menu_item" and at the same time make sure they are an instance of
    my menu item class.
    I have posted the full AS3/Flash CS3 source of my menu at
    http://www.adambergman.com/as3/macMenu.html
    Any help or ideas are appreciated!!!

    Hi Rajesh,
    I've seen your query all over the internet, so I should warn you I don't believe it's possible to disable a List Item.
    For that you should use Josh Tynjala's open source Advanced List (http://code.google.com/p/flextoolbox/downloads/list).
    Best Regards,
    Filipe.

  • Methods & Switch Statement in java.. HELP!!

    hi all...
    i am having a slight problem as i am constructing a method --> menu() which handles displaying
    menu options on the screen, prompting the user to select A, B, C, D, S or Q... and then returns the user
    input to the main method!!!
    i am having issues with switch statement which processes the return from menu() methd,,,
    could you please help?!!
    here is my code...
    import java.text.*;
    import java.io.*;
    public class StudentDriver
       public static void main(String[] args) throws IOException
          for(;;)
             /* Switch statement for menu manipulation */
             switch(menu())
                   case A: System.out.println("You have selected option A");
                                  break;
                   case B: System.out.println("You have selected option B");
                                  break;
                   case C: System.out.println("You have selected option C");
                                  break;
                   case D: System.out.println("You have selected option D");
                                  break;
                   case S: System.out.println("You have selected option S");
                                  break;
                   case Q: System.out.println("\n\n\n\n\n\n\t\t Thank you for using our system..." +
                                                                    "\n\n\t\t\t Good Bye \n\n\n\n");
                                  exit(0);    
       static char menu()
          char option;
          BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));       
          System.out.println("\n\n");
          System.out.println("\n\t\t_________________________");
          System.out.println("\t\t|                       |");
          System.out.println("\t\t| Student Manager Menu  |");
          System.out.println("\t\t|_______________________|");
          System.out.println("\n\t________________________________________");
          System.out.println("\t| \t\t\t\t\t|");
          System.out.println("\t| Add new student\t\t A \t|");
          System.out.println("\t| Add credits\t\t\t B \t|");
          System.out.println("\t| Display one record\t\t C \t|");
          System.out.println("\t| Show the average credits\t D \t|");
          System.out.println("\t| \t\t\t\t\t|");
          System.out.println("\t| Save the changes\t\t S \t|");
          System.out.println("\t| Quit\t\t\t\t Q \t|");
          System.out.println("\t|_______________________________________|\n");
          System.out.print("\t  Your Choice: ");
          option = stdin.readLine();
             return option;
    }Thanking your help in advance...
    yours...
    khalid

    Hi,
    There are few changes which u need to make for making ur code work.
    1) In main method, in switch case change case A: to case 'A':
    Characters should be represented in single quotes.
    2) in case 'Q' change exit(0) to System.exit(0);
    3) The method static char menu() { should be changed to static char menu() throws IOException   {
    4) Change option = stdin.readLine(); to
    option = (char)stdin.read();
    Then compile and run ur code. This will work.
    Or else just copy the below code
    import java.text.*;
    import java.io.*;
    public class StudentDriver{
         public static void main(String[] args) throws IOException {
              for(;;) {
                   /* Switch statement for menu manipulation */
                   switch(menu()) {
                        case 'A': System.out.println("You have selected option A");
                        break;
                        case 'B': System.out.println("You have selected option B");
                        break;
                        case 'C': System.out.println("You have selected option C");
                        break;
                        case 'D': System.out.println("You have selected option D");
                        break;
                        case 'S': System.out.println("You have selected option S");
                        break;
                        case 'Q':
                        System.out.println("\n\n\n\n\n\n\t\t Thank you for using our system..." +
                        "\n\n\t\t\t Good Bye \n\n\n\n");
                        System.exit(0);
         static char menu() throws IOException {
              char option;
              BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
              System.out.println("\n\n");
              System.out.println("\n\t\t_________________________");
              System.out.println("\t\t| |");
              System.out.println("\t\t| Student Manager Menu |");
              System.out.println("\t\t|_______________________|");
              System.out.println("\n\t________________________________________");
              System.out.println("\t| \t\t\t\t\t|");
              System.out.println("\t| Add new student\t\t A \t|");
              System.out.println("\t| Add credits\t\t\t B \t|");
              System.out.println("\t| Display one record\t\t C \t|");
              System.out.println("\t| Show the average credits\t D \t|");
              System.out.println("\t| \t\t\t\t\t|");
              System.out.println("\t| Save the changes\t\t S \t|");
              System.out.println("\t| Quit\t\t\t\t Q \t|");
              System.out.println("\t|_______________________________________|\n");
              System.out.print("\t Your Choice: ");
              option = (char)stdin.read();
              return option;
    regards
    Karthik

  • Java switch statement

    Is it possible to have a switch statement for multiple values. By this i mean, if a user types in a number between 1-3, it should print out the line
    System.out.println("Well done you got a First");break; So can i have a switch statement which is like
    case 1-3:  System.out.println("Well done you got a First");break;

    This will work:
    case 1:
    case 2:
    case 3:
       System.out.println("Well done you got a First");
    break;No, there's no way to express a "range" in a case statement though.

  • Probel installing Flash CS3

    I recently downloaded the trial for adobe flash CS3. I tried
    to install it, using the setup.exe in the main folder, but for some
    reason, this message keeps on popping up. I don't know why!
    If anyone could help that would be terrific! Thanks in
    advance!
    Error Message Image:
    http://img529.imageshack.us/img529/782/untitled1dq5.png

    Hi. I've got same problem. I downloaded Trial from Adobe.com
    and it wants CD. On some forum I read, that you've got to burn
    files on CD but i didn't try that.
    P.S. Sorry for my english ;)

  • I need some advice on switch statements

    I need to make an applet that accepts 2 things: a product # and how many of a product someone is buying. I have to display the total cost of a product and all the products bought together. My code so far is this:
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class store extends Applet implements Actionlistener
         Float runningTotal, overallTotal, howmany;
         TextField txtproductnumber, txthowmany;
         Label lblproductnumber, lblhowmany
         Public void init ()
              lblproductnumber = new Label("Product number:");
              txtproductnumber = new TextField(2);
              add (lblproductnumber);
              add (txtproductnumber);
              lblhowmany = new Label("How many:");
              txthowmany = new TextField(2);
              txthowmany.addActionListener(this);
              add (lblhowmany);
              add (txthowmany);
         public void paint (Graphics g)
              g.drawString ("The total for this purchase is $" + runningtotal, 40, 120);
              g.drawString ("The total for all purchases this session is $" + overalltotal, 40, 140);     
         public void actionPerformed(ActionEvent e)
              productnumber      = Float.valueOf(txtproductnumber.getText());     
              howmany      = Float.valueOf(txthowmany.getText());
         public static void main(string args[])
              switch(runningTotal)
                   Case 1:
                   Case 2:               
                   Case 3:
                   Case 4:
                   Case 5:
    }I got to this point and just froze on what to do next, I'm not even sure if this is going in the right direction... any help appreciated and I have 15 duke dollars assigned to be handed out amongst those who help.
    Thanks!

    Or you can create an int variable say option. Then use an if statement to determine the value of option. Then you can use option in switch statement.
    for example
        if(args[0]=="abcd")
           option=1;
        else
           option=2;
        switch(option){
            case 1:
            case 2:
        }

  • Please i need help istalling Flash CS3

    i downloaded the 30 day trial for Adobe Flash CS3
    Professional and the first time i ran the setup, it passed the
    initialization and the window for installation came up but then my
    comp froze so i restared it. now when i try to run the set up it
    says 'initializing Adobe Flash CS3'
    after it initializes it, it says:
    'Setup already running'
    "You can only install one adobe product at a time. please
    install the other adobe product before attempting to install Adoce
    Flash CS3"
    , and no i do not have another adobe intallation window
    running.
    PLZ HELPP

    Check Task manager to see if its running in there if so
    endtask it. then try again

  • AS3 - 1) Countdown Timer to the designated Date for Live-Broadcast-Event yet to take place; 2) Detect End of Live Stream on FLVPlayback with FLVPlayback.isLive = true - ActionScript 3 - flash cs3 cs4

    Hi folks,
    Ronny's here again on forums, having particularly 2 (two) questions/problems to resolve:
    1) Countdown Timer to the designated Date for Live-Broadcast-Event yet to take place
    2) Detect End of Live Stream on FLVPlayback with FLVPlayback.isLive = true
    attached is the .zip file (as3_Countdown Timer_ver 1.0.1_by Ronny Depp.zip) with all flash source files containing:
    a) The FLash Source (file: timer_module.fla) - (FLA flash source file - Flash CS3 Professional, Flash Player 9, actionscript 3.0)
    b) com.othenticmedia.utils.dateAndTimeManagement package including 2 .as actionscript 3.0 Class files.
           i) com.othenticmedia.utils.dateAndTimeManagement.DateAndTimeManager Class in the said package. (file: DateAndTimeManager.as)
           ii) com.othenticmedia.utils.dateAndTimeManagement.CountdownTimer Class in the package. (file: CountdownTimer.as)
    c) The compiled SWF file version of this Application's blueprint. (file: timer_module.swf).
    What i need to confirm is: ........................................................ see the next post of mine. (for Problems  need to be Resolved)

    Problems to Resolve:
    Problem#1) - Countdown Timer to the designated Date for Live-Broadcast-Event yet to take place.
    Problem#2) - Detect End of Live Stream on FLVPlayback with FLVPlayback.isLive = true;
    Problem#1 Description:
    I need to pinpoint the Logical TimeSync Exception, i am still unable to figure out. That is I'm using a webservice in my Application to Synchronize the Time with the actual ET (eastern time) with accomodation of auto-adjustment for EDT GMT-4 (eastern daylight time) & EST GMT-5 (eastern standard time), times. I am using the zipcode: "10012" to pass it to the Web Service in urlRequest object, to retrieve the Current ET eastern time according to EDT & EST time settings for Manhattan/Brooklyn areas or others within  New York, NY 10012.
    Currently the Web Service is returning accurate date/time based on local EDT GMT-4 daylight time.
    Is there some defined set of dates for EDT & EST times for New York region that I can check for to ensure the correct Dates/Times for Eastern Time in New York area ??? I am using NY zipcodes because i am sure to get correct ET values.
    The Major Problem Part: is I need to correct the time by 2 seconds or approx. 2 secs, some millisecs.
    When I retrieve the Time Value from WebService, it lags behind for 2 seconds as compared to DateObj i create using computer's local time, on my Windows XP Service Pack 2 with Automatic Updates turned-on. And I'm sure about my Windows will be having latest updates for Time Management already installed. I also added the 2 secs. to the TimeSync(ed) Date to make correction to this Date obj.
    I call my custom fucntion addSeconds(dateObj:Date, secs:int) to add 2 seconds to the Date by Converting Seconds to Milliseconds.
    Please comb through the as code in files attached and Help Me Out !!!
    Problem#2 Description:
    Secondly I need to Detect the End of Stream state while using FLVPlayback component, an rtmp:// live Stream from FLASH MEDIA SERVER.
    I need to Play a YuMe Post-Roll Ad when Steam Finishes/Ends.
    Live Broadcast Stream Event starts every night on Wednesdays & Saturdays exactly  at 10:59 PM EDT GMT-4.
    Live Events only Streams/Broadcasts the stream for 50secs. exactly. When [playback stopped] it plays a PostRoll Ad and after the CountdownTimer again comes back to life. The Next upcoming Event is calculated & the Countdown begins until Next Event's time/date is reached.
    Here is the  code on the frame 1 on the MainTimeline: (rest of the params like source, volume, skinAutoHide are Set using Property Inspector for FLVPlayback instance on Stage)
    //myStream instance of FLVPlayback is on the Stage
    myStream.isLive = true;// Frame 1 Actions in the FLA
    myStream.addEventListener(VideoEvent.COMPLETE, onEndOfStream);
    myStream.addEventListener(VideoEvent.STATE_CHANGE, onState);
    myStream.addEventListener(String(VideoError.NO_CONNECTION), onStreamError);
    myStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
    /*if(myStream.stopped){
         trace("tracy: "+myStream.state);
    } else if(myStream.state == VideoState.STOPPED){
         trace("tracy: "+myStream.state);
    function onStreamError(event:VideoError) {
         trace(event.code + "\n\t" + event);
    function onState(event:VideoEvent) {
         trace(event.state + "\n\t" + event.toString());
    function onEndOfStream(event:VideoEvent) {
         trace(event.state + "\n\t" + event.toString());
    function netStatusHandler(event:NetStatusEvent):void {
         switch (event.info.code) {
              case "NetConnection.Connect.Success":
                   //connectStream();
                   break;
              case "NetStream.Play.StreamNotFound":
                   trace("Stream not found: "/* + myStream.source*/);
                   break;

  • DateChooser Component for Flash CS3, AS3.0

    Where and how do I get the datechooser for Flash CS3, AS3.0?

    which version of flash cs3 do you have?

  • Flash CS3: AS3 - ReferenceError #1065 Variable is not defined

    I have developed several actionscript classes. Two of these
    classes are associated with MovieClip objects in the library. The
    MovieClips have their Linkage Base Classes set to their respective
    package and class locations and when I check the Linkage settings
    (using the check mark icon) Flash CS3 reports that it can find the
    associated classes for both MovieClips.
    When I check the syntax of my code there are no problems, and
    when I test the Flash movie no Compile Errors are shown. Yet, in
    the output window I get the following error:
    ReferenceError: Error #1065: Variable class1 is not defined.
    ReferenceError: Error #1065: Variable class2 is not defined.
    I have placed class1 and class2 in the above error messages
    to represent the classes that are associated with the MovieClip.
    Am I missing an import command somewhere? I have the base
    class path properly set in the preferences of Flash CS3.
    Thanks,

    It appears that this issue was due to some of my classes not
    being marked as public. I had been following examples from AS2 that
    had the classes marked as dynamic without a private or public
    identifier. Apparently, AS3 assumes all unmarked classes are
    private.

  • Creating metadata in Flash CS3 and reading it in AS3

    Is there a way to store metadata in a library symbol in Flash
    CS3, and then read it in AS3? For example, I want to have the
    following code run:
    m_Metadata = 'You're cool!'
    I need this data before I can play the movie clip. Is there a
    way to store this? I've been trying to find a solution, but it
    looks like I'm just going to have to load in a separate XML file
    with the data.
    Thanks!

    Unfortunately there's no simple way to add instance level
    code in Flash CS3 or CS4 with AS3. This is a significant authoring
    tool deficiency in my opinion.
    Making a component... depending on what you want to do, there
    can be a lot of overhead. There may also be some very flaky/buggy
    behavior in Flash CS3 with custom components if your experience is
    anything like mine. However, for basic metadata, try this:
    1. Select the Symbol in the Library
    2. Right click, choose Component Definition...
    3. In the Parameters data grid you can add
    parameters/properties. Make sure you set the "Variable" field as a
    unique identifier for each parameter. These are the properties
    you'll use in AS at runtime to retrieve the values.
    4. Now on each instance on the canvas you can go to the
    Parameters tab and enter custom values for each parameter.
    5. At runtime, you should be able to access the values via
    instance_name.variable_name
    I believe that will work without actually creating a
    component class and making it functional.

  • Adobe AIR update for Flash CS3

    Hi, i'm having some trouble installing the adobe air update
    for flash CS3.
    I've installed it like 5 times, it always says that the
    installation is complete.
    But when i go to flash and try to make an AIR file it's not
    in the list, the only things i see are those:
    image

    ow, totally my bad, i switched the splash screen and that
    screen.
    Problem solved

Maybe you are looking for

  • IPad 2 download button is not working

    I'm using iPad2, and I'm trying to download  a previously downloaded items and the download button (the cloud button) does not exist and therefore I'm unable to download. What could be the problem?

  • ANN: XML Parser for Java Release 1.0.1.4

    A new maintenance release of the Oracle Parser for Java is available for download. It has the following fixes and changes: Bug fixes for #893971, i.e XML parser cannot parse documents from InputStream; #900146 normalize() is wrong if the literal cont

  • Sending a Photoshop image to iPhoto

    This sounds like something that should be easy but I am having a problem. I created an image in Photoshop and want to place it in my iPhoto library. Help

  • Error in workflow : Record has links

    Hi, One of the record went into error at last step of workflow (step name :stop where it checks in the record). Now the record is still checked out and when I try to cancel /roll back/delete, every time it shows error "record has links". I have verif

  • Regarding Java Process

    Hi, I created a java Process using Runtime.getRuntime().exec() . How can i use this process to launch another java application? What & how parameter should be given inside exec() method? plz help me