Help with button code please?

I am a novice and have just completed my first animated movie. I need help with action script.
The movie is currently looped and I have created and invisible button the size of the frame with the intention that a user can click on the movie image to stop it and on second click continue the movie from where it stopped.
I have used the AS event handler method to stop the movie. I have tested it and it works. But I cannot figure suitable code to restart the movie.
Two questions;
1. am I going about the task the right way? (should I use two buttons, one stop, one start)?
2. if my approach is feasible, can anyone give me the correct AS to re-start the movie and put me out of my misery please?

you can use the following after changing "yourbutton" and "yourmovieclip" to use suitable instance names:
yourbutton.onRelease=function(){
if(!this.toggle){
yourmovieclip.stop();
} else {
yourmovieclip.play();
this.toggle=!this.toggle;

Similar Messages

  • Multiple Users Login ( Help With The Code ) Please.

    Hi all. Please help me...
    I'm using www.wix.com to create my websites.
    but since Wix.com don't able us to have member system conecet to database, i use Flash SWF As3 files...
    Please can anyone help me with the Code?
    Username=1    /Password= 1    /Url= www.1.com
    Username=2    /Password= 2    /Url= www.2.com
    Username=2    /Password= 2    /Url= www.2.com
    *If user name 1 or 2 or 3 correct. Show massage ex: Welcome back, if not correct " Bad login"
    *When login, it will open the url but in new page after the old one closed.
    + There is anyway to add " Password recovaring box too"?
    but not connected to datdabase as i said?
    Please help me, please! i areadly have code but it don't work for more than one user.
    Thank u soooo much!!
    Loai

    Here's the code i have already,,
    but i don't know how to add more than one user + when login it open new window ( popup ) i want it to open in the same window...
    Please help.
    stop();
    //hide the password
    //pass_txt.displayAsPassword = true;
    //adding event listener to the login button
    login_mc.addEventListener(MouseEvent.CLICK, loginUser);
    function loginUser(e:MouseEvent):void{
    //if both username and password are correct let the user logged in
    if(name_txt.text == "1" && pass_txt.text == "1"){
    navigateToURL( new URLRequest( "http://www.wix.com/designersgroup/tutorials/9-1" ), "_blank" );
    display_txt.text = "Going to secure area";
    else if(name_txt.text != "1" && pass_txt.text != "1"){
    display_txt.text = "Login failed!";
    if(name_txt.text == "2" && pass_txt.text == "2"){
    navigateToURL( new URLRequest( "http://www.wix.com/designersgroup/tutorials/9-2" ), "_blank" );
    display_txt.text = "Going to secure area";
    else if(name_txt.text != "2" && pass_txt.text != "2"){
    display_txt.text = "Login failed!";

  • Help with error code, please.

    I have compiled a small AS3 script of a bouncing basketball with sound - the volume of the sound  decreasing as the bounces get smaller.
    I have obviously not done something correctly in the way I have installed the sound because I get this error message " 1180: Call to possibly undefined method bounce2 "( bounce2 is the mp3 file). Without the sound the ball bounces perfectly - it is the sound that has killed it. I am a newbie  and am trying to learn AS3 the hard way - by experience  but am stumped here - can some one help, please?   Below is my script.
    // create a ball sprite
    import flash.media.Sound;
    var initialrotationSpeed=12;
    var rotationSpeed : Number;
    var initialxVel : Number=8;
    var stage_width : Number=750;
    ball_mc.x=80;
    ball_mc.y=360;
    //setup position and velocity variables
    var xPos : Number=ball_mc.x;
    var yPos : Number=ball_mc.y;
    var xVel : Number;
    var yVel : Number=0.5;
    var grav ; Number=1;
    var vol : Number=1;
    var snd : Sound=new bounce2();
    snd.play();
    addEventListener(Event.ENTER_FRAME,onLoop,false,0,true);
    function onLoop(evt:Event) : void {
    if(ball_mc.x/stage_width));
    xVel=initialxVel*(1-(ball_mc.x/stage_width));
    yVel+=grav;
    xPos+=xVel;
    yPos+=yVel;
    if(Math.abs(yPos-560)<1&&Math.abs(yVel)<1)
    remove EventListener(Event.ENTER_FRAME,onLoop);
    else if(yPos>560){
    yPos=560;
    yVel*= -.8;
    xVel*= .8;
    vol- =0.1;
    snd.play(0,0,newSoundTransform(vol));
    ball_mc.x=xPos;
    ball_mc.y=yPos;
    if(ball_mc.xstage.stageWidth-ball_mc.width/4||ball_mc.x<0+ball_mc.width/4){
    xVel*= -1;
    addEventListener(Event.ENTER_FRAME,Rotation);
    function Rotation(event:Event):void {
    if(ball_mc.x/stage_width<1)
    ball_mc.rotation+=initialrotationSpeed*(1-ball_mc.x/stage_width);
    if(ball_mc.x<700)
    xVel=initialxVel*(1-(ball_mc.x/stage_width));
    ball_mc.x+=xVel;
    else
    removeEventListener(Event.ENTER_FRAME,Rotation);

    Thank you - that was it - "class" - or lack of .
    I am most appreciative of your assistance
    regards

  • Help with HTML code Please

    Hello,
    I am having some trouble with my HTML format. I am trying to
    have it so when I click on my thunbnail another picture shows up as
    a popup. you can see what I am trying to do at this link
    http://209.66.101.242/EZ-Templates/calendars.php
    Here is what my code looks like. If you are able to tell me
    what I have wrong I would appreciate it. Thanks in advance
    <DIV align=center><a
    onclick="return enlarge('
    http://www.brcphotography.com/holidaycards/pics/annual/CL02.jpg',event,'center',300,375)"
    href="pics/quarterly/CL08-3.jpg"><img
    src="pics/quarterly/CL08-3 thumb.gif" name="thumbnail"
    border="0" id="thumbnail"
    /></A></DIV></TD></TR>
    <TR>
    <TD>
    <DIV class=product_name
    align=center>CL08-3</DIV>

    Works fine for me in boty IE7 and FF. Did you fix it after
    posting?
    emichael brandt
    cdc3323 wrote:
    > Hello,
    >
    > I am having some trouble with my HTML format. I am
    trying to have it so when
    > I click on my thunbnail another picture shows up as a
    popup. you can see what
    > I am trying to do at this link
    http://209.66.101.242/EZ-Templates/calendars.php
    >
    > Here is what my code looks like. If you are able to tell
    me what I have wrong
    > I would appreciate it. Thanks in advance
    >
    > <DIV align=center><a
    > onclick="return
    > enlarge('
    http://www.brcphotography.com/holidaycards/pics/annual/CL02.jpg',event,
    > 'center',300,375)"
    > href="pics/quarterly/CL08-3.jpg"><img
    > src="pics/quarterly/CL08-3 thumb.gif"
    > name="thumbnail"
    > border="0" id="thumbnail"
    > /></A></DIV></TD></TR>
    > <TR>
    > <TD>
    > <DIV class=product_name
    > align=center>CL08-3</DIV>
    >
    >

  • Help with my code, please?

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.* ;
    import BreezySwing.*;
    import java.io.*;
    import TerminalIO.*;
    import java.lang.*;
    import java.util.*;
    import java.io.Serializable;
    public class FitnessCalculator extends GBFrame {
      private JTextField BMITextField, BMI2TextField, BPTextField,
    BP2TextField;
      private JLabel weightLabel, heightLabel, SystolicLabel, DiastolicLabel;
      private JMenuItem BMI, Bp;
      String BodyMassIndex, BloodPressure = "";
      int Systolic, Diastolic, weight, height;
      private JButton BodyMassCalculator, BloodPressureCalculator;
      Integer weightHeight = weight + height;
      public FitnessCalculator( ){
          setSize(400,500);
          setLocation(200,200);
          JMenu calculators = new JMenu("Calculators");
          calculators.setMnemonic(KeyEvent.VK_U);
          JMenu BP = new JMenu("BloodPressure");
          JMenuItem BPItem = new JMenuItem("BloodPressure");
          BPItem.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent e) {
                  FitnessCalculator bmiWindow = new
    FitnessCalculator("BloodPressure");
              bmiWindow.setSize(400,400);
              bmiWindow.setVisible(true);
          JMenu BMI = new JMenu("BMI");
          JMenuItem BMIItem = new JMenuItem("BMI");
          BMIItem.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent e) {
                  FitnessCalculator bmiWindow = new FitnessCalculator("BMI");
              bmiWindow.setSize(400,400);
              bmiWindow.setVisible(true);
          calculators.add(BMIItem);
          calculators.add(BPItem);
          calculators.addSeparator();
          JMenu Quit = new JMenu("Quit");
          JMenuItem quitItem = new JMenuItem("Quit");
          quitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,
           Event.CTRL_MASK));
          quitItem.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent e) {
                  System.exit(0);
          calculators.add(quitItem);
          JMenuBar menuBar = new JMenuBar();
          menuBar.add(calculators);
          setJMenuBar(menuBar);
      public FitnessCalculator(String blah){
          BodyMassIndex();
      public void BodyMassIndex(){
           JMenu calculators = new JMenu("Calculators");
          calculators.setMnemonic(KeyEvent.VK_U);
          calculators.add(new JMenuItem("BMI"));
          calculators.add(new JMenuItem("BodyFat"));
          calculators.add(new JMenuItem("BloodPressure"));
          calculators.addSeparator();
          if ( weight == 0){
                BMI2TextField.setText("Noob");
               }else{
                  if( BMI < 18.5){
                      BMI2TextField.setText("UnderWeight");
                  }else{
                   if( BMI >= 18.5 && BMI <= 24.9){
                      BMI2TextField.setText("Normal");
                  }else{
                  if( BMI >= 25 && BMI <= 29.9){
                      BMI2TextField.setText("Overweight");
                  }else{
                  if( BMI > 30){
                      BMI2TextField.setText("Obese");
                  }else{
             BMI2TextField.setText("Your BMI is :" + BMI);
       public void BloodPressure(){
           JMenu calculators = new JMenu("Calculators");
          calculators.setMnemonic(KeyEvent.VK_U);
          calculators.add(new JMenuItem("BMI"));
          calculators.add(new JMenuItem("BodyFat"));
          calculators.add(new JMenuItem("BloodPressure"));
          calculators.addSeparator();
      public String setText(String t){
          return t;
       public Integer getNumber(){
               return weightHeight;
           public void BodyMassIndexCalculator(){
           Integer BMI = (weight / (height * height) * 703);
            weightHeight = weight + height;
            weightLabel = weightLabel;
            heightLabel = heightLabel;
            if ( weight == 0){
                BMI2TextField.setText("Noob");
               }else{
                  if( BMI < 18.5){
                      BMI2TextField.setText("UnderWeight");
                  }else{
                   if( BMI >= 18.5 && BMI <= 24.9){
                      BMI2TextField.setText("Normal");
                  }else{
                  if( BMI >= 25 && BMI <= 29.9){
                      BMI2TextField.setText("Overweight");
                  }else{
                  if( BMI > 30){
                      BMI2TextField.setText("Obese");
                  }else{
             BMI2TextField.setText("Your BMI is :" + BMI);
            //BMI.setText(BMI);
              public void BloodPressureCalculator(){
           SystolicLabel = SystolicLabel;
           DiastolicLabel = DiastolicLabel;
              //BloodPressure.setText(BloodPressure);
      public void buttonClicked(JButton buttonObj){
        if ( buttonObj == BodyMassCalculator){
               double BMI = weightHeight;
            if ( weight == 0){
                BMI2TextField.setText("Noob");
               }else{
                  if( BMI < 18.5){
                      BMI2TextField.setText("UnderWeight");
                  }else{
                   if( BMI >= 18.5 && BMI <= 24.9){
                      BMI2TextField.setText("Normal");
                  }else{
                  if( BMI >= 25 && BMI <= 29.9){
                      BMI2TextField.setText("Overweight");
                  }else{
                  if( BMI > 30){
                      BMI2TextField.setText("Obese");
                  }else{
             BMI2TextField.setText("Your BMI is :" + BMI);
           if ( buttonObj == BloodPressureCalculator){
               //Integer Systolic = Systolic.getNumber();
               //Integer Diastolic = Diastolic.getNumber();
                   BP2TextField.setText("Liar");
               }else{
                   if( Systolic < 120 && Systolic > 80){
                       BP2TextField.setText("Normal");
                   }else{
                       if( Systolic > 120 && Systolic < 139){
                           BP2TextField.setText("PreHypertension");
                       }else{
                           //BP2TextField.setText("Your Bloodpressure is : ") +
    BloodPressure);
      public JMenuItem add(JMenuItem ob){
          if ( ob == BMI){
              FitnessCalculator bmiWindow = new FitnessCalculator("BMI");
              bmiWindow.setSize(400,400);
              bmiWindow.setVisible(true);
              this.setVisible(true);
          if ( ob == Bp){
              BloodPressure();
              this.setVisible(false);
          return Bp;
      public static void main(String[] args) {
      JFrame f = new FitnessCalculator(  );
      f.addWindowListener(new WindowAdapter(  ) {
        public void windowClosing(WindowEvent we) { System.exit (0); }
      f.setVisible(true);
    }When I compile it, it will show up like I want it to. But when I click the menu and go down to the calculator I want to pop up, only the window pops up. There's nothing in it. How would I take the input from the user and tell the user if they are overweight or not?
      if ( weight == 0){
                BMI2TextField.setText("Noob");
               }else{
                  if( BMI < 18.5){
                      BMI2TextField.setText("UnderWeight");
                  }else{
                   if( BMI >= 18.5 && BMI <= 24.9){
                      BMI2TextField.setText("Normal");
                  }else{
                  if( BMI >= 25 && BMI <= 29.9){
                      BMI2TextField.setText("Overweight");
                  }else{
                  if( BMI > 30){
                      BMI2TextField.setText("Obese");
                  }else{
             BMI2TextField.setText("Your BMI is :" + BMI);
    }I thought it was that, but when I open the calculator nothing shows up in the window. What do I need to do to take input from the user and output the needed info from the above text?

    What do I need to put BMI as? I don't know if having it as a MenuItem is working.
    When I compile it, it will show up like I want it to.???
    If you didn't understand, I meant that it compiles and opens a GUI window. Just a blank window with a Menu Bar. With two calculators that drop down. When I click the BodyMassIndex one a new GUI window opens up. But nothing is in it. How do I get the user to input the information and output the result of it? This is really confusing me.

  • Help with buttons :S

    hi all,
    i'm new to flash but i have an idea whats going on with webpages. I need some help with buttons! i have a website and its has a stage and 9 different flv's (screens). I've been trying to read online and i can't find out how to navigate to different screens, example below
    home          |            |
    about us     |  stage   |
    contact       |            |
    you click one one button it updates the stage. also i'm using actionscript 2.0.
    thanks for any help ahead of time
    Thank you,

    Is it a wi-fi or cellular connection that isn't working?  If its wi-fi and other people/computers/phones can connect check your settings.  If its cellular, are other people's phones (on the same carrier) working in the same location? If other people can't connect then it is likely a network problem.  If others can you may need to reset/restore you iPhone.

  • Can you help with the code to publish Flash to my own domain.

    Thank you for your help, I publish the my site to my own domain, I do not use .Mac, I tested your code and ity works well on .Mac, can you help with the code to publish to my own domain.
    Thank you again

    You appear to have just collected a variety of code snippets and thrown them together, including a section of AS2 code ( gage.onRelease = function() {... )
    The suggestion I offered yesterday still stands.  You should find a tutorial regarding AS3 and the atan2 function.  Beyond that, what you show suggests this is a school assignment.  You should seek help from your fellow students and instructor if that is the case.

  • I need help with this code error "unreachable statement"

    the error_
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errors
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    public class Tools//tool class
    private int numberOfToolItems;
    private ToolItems[] toolArray = new ToolItems[10];
    public Tools()//array of tool
    numberOfToolItems = 0;
    for(int i = 0; i < toolArray.length; i++)//for loop to create the array tools
    toolArray[i] = new ToolItems();
    }//end for loop
    }//end of array of tools
    public int search(int id)//search mehtod
    int index = 0;
    while (index < numberOfToolItems)//while and if loop search
    if(toolArray[index].getID() == id)
    return index;
    else
    index ++;
    }//en while and if loop
    return -1;
    }//end search method
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0;
    int index;
    index = search(id); <-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    }//end delete method
    public void display()//display method
    for(int i = 0; i < numberOfToolItems; i++)
    //toolArray.display(g,y,x);
    }//end display method
    public String getRecord(int i)//get record method
    // return toolArray[i].getName()+ "ID: "+toolArray[i].getID()
    }//end getrecod
    }//end class
    Edited by: ladsoftware on Oct 9, 2009 6:08 AM
    Edited by: ladsoftware on Oct 9, 2009 6:09 AM
    Edited by: ladsoftware on Oct 9, 2009 6:10 AM
    Edited by: ladsoftware on Oct 9, 2009 6:11 AM

    ladsoftware wrote:
    Subject: Re: I need help with this code error "unreachable statement"
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errorsThe compiler is telling you exactly what the problems are:
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0; // <<== HERE you return, so everyting in the if block after this is unreachable
    int index;
    index = search(id);  //< -----------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    // <<== HERE where is the return statement?
    }//end delete method
    public String getRecord(int i)//get record method
    // return toolArray.getName()+ "ID: "+toolArray[i].getID() <<== HERE you commented out the return statement
    }//end getrecod
    }//end class

  • Need help with WMI code that will send output to db

    'm new to WMI code writing, so I need some help with writing code that we can store on our server. I want this code to run when a user logs into their computer
    and talks to our server. I also want the code to:
    * check the users computer and find all installed patches
    * the date the patches were installed
    * the serial number of the users computer
    * the computer name, os version, last boot up time, and mac address
    and then have all this output to a database file. At the command prompt I've tried:
    wmic qfe get description, hotfixid
    This does return the patch information I'm looking for, but how do I combine that line of code with:
    wmic os get version, csname, serialnumber, lastbootuptime
    and
    wmic nicconfig get macaddress
    and then get all this to output to a database file?

    Thank you for the links. I checked out http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx and
    found lots of good information. I also found a good command that will print information to a text file.
    Basically what I'm trying to do is retrieve a list of all installed updates (Windows updates and 3rd party updates). I do like that the below code because it gives me the KB numbers for the Windows updates. I need this information so my IT co-workers &
    I can keep track of which of our user computers need a patch/update installed and preferably which patch/update. The minimum we want to know is which patches / updates have been installed on which computer. If you wondering why we don't have Windows automatic
    updates enable, that's because we are not allowed to.   
    This is my code so far. 
    #if you want the computer name, use this command
    get-content env:computername
    $computer = get-content env:computername
    #list of installed patches
    Get-Hotfix -ComputerName $computer#create a text file listing this information
    Get-Hotfix > 'C:\users\little e\Documents\WMI help\PowerShell\printOutPatchList.txt'
    I know you don't want to tell me the code that will print this out to a database (regardless if it's Access or SQL), and that's find. But maybe you can tell me this. Is it possible to have the results of this sent to a database file or do I need to go into
    SQL and write code for SQL to go out and grab the data from an Excel file or txt file? If I'm understanding this stuff so far, then I suspect that it can be done both ways, but the code needs to be written correctly for this to happen. If it's true, then which
    way is best (code in PowerShell to send information to SQL or SQL go get the information from the text file or Excel file)?

  • I need help with my code..

    hi guys. as the subject says I need help with my code
    the Q for my code is :
    write a program that reads a positive integer x and calculates and prints a floating point number y if :
    y = 1 ? 1/2 + 1/3 - ? + 1/x
    and this is my code
       This program that reads a positive integer x and calculates
       and prints a floating point number y if :
                 y = 1 - 1/2 + 1/3 - ? + 1/x
       import java.util.Scanner; // program uses class Scanner
        class Sh7q2
           // main method begins execution of Java application
           public static void main( String args[] )
          // create Scanner to obtain input from command window
             Scanner input = new Scanner( System.in );
             int i = 1; // i is to control the loop
             int n = 2; // n is suppose to control the number sign
             int x; // a positive integer entered by the user
             int m;
             System.out.println("Enter a positive integer");
             x = input.nextInt();
             do
                m = (int) Math.pow( -1, n)/i;
                System.out.println(m);
                   n++;
                   i++;
             while ( m >= 1/x );
          } // end method main
       } // end class Sh7q2 when I compile it there is no error
    but in the run it tells me to enter a positive integer
    suppose i entered 5
    then the result is 1...
    can anyone tell me what's wrong with my code

       This program that reads a positive integer x and calculates
       and prints a floating point number y if :
                 y = 1 - 1/2 + 1/3 - ? + 1/x
       import java.util.Scanner; // program uses class Scanner
        class Sh7q2
           // main method begins execution of Java application
           public static void main( String args[] )
          // create Scanner to obtain input from command window
             Scanner input = new Scanner( System.in );
             int i = 1; // i is to control the loop
             int n = 1; // n is suppose to control the number sign
             int x; // a positive integer entered by the user
             double m;
             int a = 1;
             double sum = 0;
             System.out.println("Enter a positive integer");
             x = input.nextInt();
             for ( i = 1; a <= x; i++)
                m =  Math.pow( -1, n+1)/i;
                sum  = sum + m;
                n++;
                a++;
             System.out.print("y = " + sum);
          } // end method main
       } // end class Sh7q2is it right :S

  • Help with access control please

    So I'm trying to set up my brother's PSP to the wirless network through MAC address timed access. What I want to do is make it so that he can only access it through certain times in the day. I'm having troubles with actually getting it to work. Everytime I set it up, the PSP only show's up as a DHCP client and not a Wireless client. I tried the option panel with the add wireless clients through the first try access. Could I get some help with this issue please? Thanks!

    Just to calm your fears... There is no conspiracy. If someone had an answer or a suggestion they would post it.

  • Help with buttons loading sections. Code looks awkward!

    Hi everyone!
    I have a class that creates a navBar with some buttons. Each button loads an external .swf and everything is working just fine BUT the code is really awkward. I also wanted to use TweenLite to add transitions from section to section.
    I also wanted to handle the "section change" process from yet another Class (SectionChange) but whenever I try it I fail miserably.
    Here's what I have (including the vars), without the SectionChange Class, that's working.
    private var _app:Sprite;
    private var _navData:Array;
    private var _loader:LoadDisplayObject;
    private var _container:Sprite = new Sprite();
    private var _currentSection:String = "";
    public function NavBar(app:Sprite, navData:Array) {
         _app = app;
         _navData = navData;
         _navData.pop();
         addChild(_container);
         build();
    private function build():void {
         for (var i:uint;i < _navData.length;i++) {
              var menuBtn:MenuBtn = new MenuBtn(_navData[i]);
              menuBtn.name = _navData[i];
              menuBtn.x = 420 + (menuBtn.width + 3) * i;
              menuBtn.y = 60;
              menuBtn.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
              addChild(menuBtn);
    private function onClick(e:MouseEvent):void {
         if (_currentSection == e.target.name + ".swf") {
              trace("Section Already Loaded");
         } else {
              _currentSection = e.target.name + ".swf";
              _loader = new LoadDisplayObject(_currentSection);
              _loader.addEventListener("displayObjectLoaded", checkChildrenNum, false, 0, true);
              _container.addChild(_loader);
              trace("Another Section were Loaded");
    private function checkChildrenNum(e:Event):void {
         if (_container.numChildren > 1) {
              _container.removeChildAt(0);
    As I said, this is working, but it's going to be a mess when I start adding the Tweens.
    So here is the same code now using the SectionChange class that I tryed to implement.
    //Inside NavBar class (same as above)
    private function onClick(e:MouseEvent):void {
    //edit: ADDING THE _sectionChange TO THE DISPLAY LIST HELPS A LOT WITH THE ERRORS and returns only one error.
         addChild(_sectionChange);
         _sectionChange = new SectionChange(e.target.name + ".swf");
    And here's the SectionChange class:
    public class SectionChange extends Sprite {
         private var _loader:LoadDisplayObject;
         private var _container:Sprite = new Sprite();
         private var _currentSection:String = "";
         public function SectionChange(currentSection:String = "") {
              if (_currentSection == currentSection) {
                   trace("Section Already Loaded");
              } else {
                   _currentSection = currentSection;
                   _loader = new LoadDisplayObject(_currentSection);
                   _loader.addEventListener("displayObjectLoaded", checkChildrenNum, false, 0, true);
                   _container.addChild(_loader);
                   trace("Another Section were Loaded");
         private function checkChildrenNum(e:Event):void {
              if (_container.numChildren > 1) {
                   _container.removeChildAt(0);
    I don't know what I'm doing wrong here but I get tons of errors with this code.
    edit: Now that I'm adding the _sectionChange to the display list I only get the following error:
    TypeError: Error #2007: Parameter child must be non-null.
        at flash.display::DisplayObjectContainer/addChild()
        at br.com.publishyours::NavBar/onClick()
    Thanks again for all the patience!
    Message was edited by: newToAS3

    I finaly understood the error and got the SectionChange to work.

  • Help With Crash Code  In PRE8 Please

    In an interest to turn some of my recent discussions in a more positive direction and in keeping with the primary function of this forum (seeking advice and solutions) and in a further effort to not continually ***** about PRE8, can someone please help with and interpret the following crash codes recently generated by PRE8?
    Thanks in advance for any help.
    Glenn
    Description
    A problem caused this program to stop interacting with Windows.
    Problem signature
    Problem Event Name:                      AppHangXProcB1
    Application Name:                           Adobe Premiere Elements.exe
    Application Version:                         8.0.0.0
    Application Timestamp:                   4aa5c87c
    Hang Signature:                                ba8e
    Hang Type:                                        32
    Waiting on Application Name:       ElementsOrganizerSyncAgent.exe
    Waiting on Application Version:    8.0.0.0
    OS Version:                                        6.0.6001.2.1.0.256.1
    Locale ID:                                           1033
    Additional Hang Signature 1:         cb0b340a390054264815ceb8e3574d53
    Additional Hang Signature 2:         84f3
    Additional Hang Signature 3:         f0a90877ec38c16fd285cc410c83433d
    Additional Hang Signature 4:         ba8e
    Additional Hang Signature 5:         cb0b340a390054264815ceb8e3574d53
    Additional Hang Signature 6:         84f3
    Additional Hang Signature 7:         f0a90877ec38c16fd285cc410c83433d
    Extra information about the problem
    Bucket ID:                                          749899167
    Description
    A problem caused this program to stop interacting with Windows.
    Problem signature
    Problem Event Name:                      AppHangXProcB1
    Application Name:                           Adobe Premiere Elements.exe
    Application Version:                         8.0.0.0
    Application Timestamp:                   4aa5c87c
    Hang Signature:                                ba8e
    Hang Type:                                        32
    Waiting on Application Name:       ElementsOrganizerSyncAgent.exe
    Waiting on Application Version:    8.0.0.0
    OS Version:                                        6.0.6001.2.1.0.256.1
    Locale ID:                                           1033
    Additional Hang Signature 1:         cb0b340a390054264815ceb8e3574d53
    Additional Hang Signature 2:         84f3
    Additional Hang Signature 3:         f0a90877ec38c16fd285cc410c83433d
    Additional Hang Signature 4:         ba8e
    Additional Hang Signature 5:         cb0b340a390054264815ceb8e3574d53
    Additional Hang Signature 6:         84f3
    Additional Hang Signature 7:         f0a90877ec38c16fd285cc410c83433d
    Extra information about the problem
    Bucket ID:                                          749899167
    Description
    A problem caused this program to stop interacting with Windows.
    Problem signature
    Problem Event Name:                      AppHangXProcB1
    Application Name:                           Adobe Premiere Elements.exe
    Application Version:                         8.0.0.0
    Application Timestamp:                   4aa5c87c
    Hang Signature:                                ba8e
    Hang Type:                                        32
    Waiting on Application Name:       ElementsOrganizerSyncAgent.exe
    Waiting on Application Version:    8.0.0.0
    OS Version:                                        6.0.6001.2.1.0.256.1
    Locale ID:                                           1033
    Additional Hang Signature 1:         cb0b340a390054264815ceb8e3574d53
    Additional Hang Signature 2:         84f3
    Additional Hang Signature 3:         f0a90877ec38c16fd285cc410c83433d
    Additional Hang Signature 4:         ba8e
    Additional Hang Signature 5:         cb0b340a390054264815ceb8e3574d53
    Additional Hang Signature 6:         84f3
    Additional Hang Signature 7:         f0a90877ec38c16fd285cc410c83433d
    Extra information about the problem
    Bucket ID:                                          749899167
    Description
    A problem caused this program to stop interacting with Windows.
    Problem signature
    Problem Event Name:                      AppHangB1
    Application Name:                           Adobe Premiere Elements.exe
    Application Version:                         8.0.0.0
    Application Timestamp:                   4aa5c87c
    Hang Signature:                                af71
    Hang Type:                                        0
    OS Version:                                        6.0.6001.2.1.0.256.1
    Locale ID:                                           1033
    Additional Hang Signature 1:         37a5e7ba79ac8a533571e7d8f2e8acd0
    Additional Hang Signature 2:         d900
    Additional Hang Signature 3:         431be4795d1c061aba02734aa57c4950
    Additional Hang Signature 4:         af71
    Additional Hang Signature 5:         37a5e7ba79ac8a533571e7d8f2e8acd0
    Additional Hang Signature 6:         d900
    Additional Hang Signature 7:         431be4795d1c061aba02734aa57c4950
    Extra information about the problem
    Bucket ID:                                          811067413
    Description
    A problem caused this program to stop interacting with Windows.
    Problem signature
    Problem Event Name:                      AppHangB1
    Application Name:                           Adobe Premiere Elements.exe
    Application Version:                         8.0.0.0
    Application Timestamp:                   4aa5c87c
    Hang Signature:                                7008
    Hang Type:                                        0
    OS Version:                                        6.0.6001.2.1.0.256.1
    Locale ID:                                           1033
    Additional Hang Signature 1:         f0af3d01fb74f43241231d4e61778ffa
    Additional Hang Signature 2:         0fb3
    Additional Hang Signature 3:         a5f1d311bc7bfa26f067b42cbdeac6af
    Additional Hang Signature 4:         7008
    Additional Hang Signature 5:         f0af3d01fb74f43241231d4e61778ffa
    Additional Hang Signature 6:         0fb3
    Additional Hang Signature 7:         a5f1d311bc7bfa26f067b42cbdeac6af
    Extra information about the problem
    Bucket ID:                                          781893170

    Here are my system specs.  Let me know if you need anything else.
    Thanks
    Glenn
    Operating System
    MS Windows Vista Ultimate SP2
               Installation Date: 06 March 2009, 02:58
               Intel Mobile Core 2 Duo T9550
                   Cores                       2
                   Threads                     2
                   Name                        Intel Mobile Core 2 Duo T9550
                   Code Name                   Penryn
                   Package                     Socket P (478)
                   Technology                  45nm
                   Specification               Intel Core2 Duo CPU  T9550 @ 2.66GHz
                   Family                      6
                   Extended family             6
                   Model                       7
                   Extended model              17
                   Stepping                    A
                   Revision                    E0
                   Instructions                MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, EM64T
                   Bus speed                   266.0 MHz
                   Rated Bus speed             1064.0 MHz
                   Stock core speed            2666 MHz
                   Stock bus speed             266 MHz
                   Average Temperature         36 °C
                   Cache
                       L1 data cache size              2 x 32 KBytes
                       L1 instructions cache size      2 x 32 KBytes
                       L2 unified cache size           6144 KBytes
                   Core 1
                       Core speed            1596.0 MHz
                       Multiplier            x 6.0
                       Bus speed             266.0 MHz
                       Rated Bus speed       1064.0 MHz
                       Temperature           37 °C
                       Thread 1
                           APIC ID     0
                   Core 2
                       Core speed            2660.0 MHz
                       Multiplier            x 6.0
                       Bus speed             266.0 MHz
                       Rated Bus speed       1064.0 MHz
                       Temperature           36 °C
                       Thread 1
                           APIC ID     1
          Memory
                   Type                                DDR2
                   Size                                4096 MBytes
                   Channels #                          Dual
                   DRAM frequency                      399.0 MHz
                   CAS# Latency (CL)                   6.0 clocks
                  RAS# to CAS# delay (tRCD)           6 clocks
                   RAS# precharge (tRP)                6 clocks
                   Cycle time (tRAS)                   18 clocks
               SPD
                   Number of SPD modules          2
                   Slot #1
                       Type                DDR2
                       Size                2048 MBytes
                       Manufacturer        Hyundai Electronics
                       Max bandwidth       PC2-6400 (400 MHz)
                       Part number         HYMP125S64CP8-S6 
                       Serial number       00007112
                       Week/year           52 / 08
                       SPD Ext.            EPP
                       JEDEC #3
                           Frequency             400.000000 MHz
                           CAS# latency          6.0
                           RAS# to CAS#          6
                           RAS# Precharge        6
                           tRAS                  18
                           tRC                   24
                           Voltage               1.8 V
                       JEDEC #2
                           Frequency             333.333344 MHz
                           CAS# latency          5.0
                           RAS# to CAS#          6
                           RAS# Precharge        6
                           tRAS                  16
                           tRC                   21
                           Voltage               1.8 V
                       JEDEC #1
                           Frequency             266.666656 MHz
                           CAS# latency          4.0
                           RAS# to CAS#          4
                           RAS# Precharge        4
                           tRAS                  12
                           tRC                   16
                           Voltage               1.8 V
                   Slot #2
                       Type                DDR2
                       Size                2048 MBytes
                       Manufacturer        Hyundai Electronics
                       Max bandwidth       PC2-6400 (400 MHz)
                       Part number         HYMP125S64CP8-S6 
                       Serial number       02008065
                       Week/year           52 / 08
                       SPD Ext.            EPP
                       JEDEC #3
                           Frequency             400.000000 MHz
                           CAS# latency          6.0
                           RAS# to CAS#          6
                           RAS# Precharge        6
                           tRAS                  18
                          tRC                   24
                           Voltage               1.8 V
                       JEDEC #2
                           Frequency             333.333344 MHz
                           CAS# latency          5.0
                           RAS# to CAS#          6
                           RAS# Precharge        6
                           tRAS                  16
                           tRC                   21
                           Voltage               1.8 V
                       JEDEC #1
                           Frequency             266.666656 MHz
                           CAS# latency          4.0
                           RAS# to CAS#          4
                           RAS# Precharge        4
                           tRAS                  12
                           tRC                   16
                           Voltage               1.8 V
    Mother Board
    Manufacturer   Dell, Inc.
               Model                      0P786H
               Version                    A04
               Chipset vendor             Intel
               Chipset model              PM45
               Chipset revision           07
               Southbridge vendor         Intel
               Southbridge model          82801IM (ICH9-M)
               Southbridge revision       03
               BIOS
                   Brand       Dell Inc.
                   Version     A04
                   Date        11/26/2008
               Monitor
                   Name                    Generic PnP Monitor on ATI Mobility Radeon HD 3650
                   State                   enable
                   State                   primary
                   Monitor Width           1920
                   Monitor Height          1200
                   Monitor Bit             32
                   Monitor Frequency       60
                   Device:                 \\.\DISPLAY1\Monitor0
                   Name                    Default Monitor on ATI Mobility Radeon HD 3650
                   State                   disabled
                   State                   removable
                   Monitor Width           800
                   Monitor Height          600
                   Monitor Bit             32
                   Monitor Frequency      60
                   Device:                 \\.\DISPLAY2
               ATI Mobility Radeon HD 3650
                   GPU                         M86
                   Device ID                   1002-9591
                   Subvendor                   Dell (1028)
              

  • Help with writing code for button

    Hi!
    Can someone help me with the code for a button that sends my menu back to 0?
    This is the code current code, and I've created a button called sistapilen that I want to insert where the regular button "arrow" is not visible. I want sistapilen to navigate me back to 0. (Or if I can get "arrow" to do it and delete "sistapilen"). 
    /Jen
    // File downloaded from www.riacodes.com
    import com.greensock.*;
    var arrayX :Array = [0,-800,-1600,-2400,-3200,-4000,-4800];
    var currentIndex:Number=6;
    left_mc.addEventListener(MouseEvent.CLICK,navigate);
    right_mc.addEventListener(MouseEvent.CLICK,navigate);
    left_mc.buttonMode = true;
    right_mc.buttonMode = true;
    checkArrows();
    function navigate(e:MouseEvent):void{
    if(e.currentTarget == left_mc) currentIndex --;
    else currentIndex ++;
    checkArrows();
    TweenLite.to(content_mc,.5 ,{x:arrayX[currentIndex]});
    function checkArrows():void{
    if(currentIndex == 0) left_mc.visible=false;
    else if (currentIndex == arrayX.length - 1) right_mc.visible = false;
    else{
    left_mc.visible = true;
    right_mc.visible= true;

    Add a listemer for whichever other button you plan to use...
    sistapilen.addEventListener(MouseEvent.CLICK,navigate);
    And try changing your navigate function as follows...
    function navigate(e:MouseEvent):void{
         if(e.currentTarget == left_mc) {
              currentIndex--;
         } else if(e.currentTarget == right_mc){
              currentIndex ++;
         } else {
              currentIndex = 0;
         checkArrows();
         TweenLite.to(content_mc,.5 ,{x:arrayX[currentIndex]});

  • Help with If statement please

    Hi,
    First Special thanks to Kglad for the help with the AS1 to AS3 conversion.
    I've been able to link up my buttons to play a different frames of the movie. this was my novice way of finally getting the programming to work.
    In frame 95 I have
    var myLoader:Loader = new Loader();
    addChild(myLoader); var url:URLRequest = new URLRequest("page1.swf");
    myLoader.load(url);
    in frame 165:
    var myLoader1:Loader = new Loader();
    addChild(myLoader1); var url1:URLRequest = new URLRequest("page1.swf");
    myLoader1.load(url1);
    My buttons link to 116 which plays a frame and loads ^
    in frame 226: removeChild(myLoader).
    But if the user has looped back into home from another part in the movie clip then it would need to remove myLoader1 instead of myLoader.
    I'm guessing there is some really dynamic way to solve the programatic nightmare i'm developing, but I'm really novice.
    So what i need is an if statement for frame 226
    That would do something:
    if(myLoader <> null
         removeChild(myLoader)
    else(
    removechild(myLoader1)
    Anyone have a method for this?

    yes, you can use the same urlrequest but just change its url property:
    // initialize, for example in frame 1.  this is done once and never again:
    var loader:Loader=new Loader();
    var urlR:URLRequest=new URLRequest();
    //  then in frame 2, for example:
    urlR.url="page1.swf";
    loader.load(urlR);
    //  in frame 20, for example:
    urlR.url="page2.swf";
    loader.load(urlR);
    // in frame 30, for example:
    urlR.url="page3.swf";
    loader.load(urlR);
    //etc.  if you're loading any swfs that play streams (sound or video), you'll want to add some code to this.

Maybe you are looking for

  • My Blackberry torch 9800 won't boot completely

    i have tried several times and have ejecting the battery several times but still not booting completely. it boots to about 99percent and then restarts again and again...

  • Nokia x3 help! menu button works for lock but not ...

    i have a new nokia x3, around 2 months old, after restarting the phone one time, the main button (the menu button) works for locking/unlocking and even makes the keytone sound when you press it, but i cant open up the menu, its really annoying becaus

  • Configuring error message in BEx link in SPM 2.1

    Hi, Currently working on Spend Performance Management(SPM) 2.1 application. I am trying to configure error message which pops up along with BEx link whenever we run reports with large amount of data. I would like to configure error message so that it

  • My puzzle in ABAP Development's future

    As we know, after the issue of Netweaver platform,Java became a good development solution. Compared with Java,what position is ABAP placed on? Will ABAP be  eliminatd some day? Java & ABAP ,which may have a better future? Expect your views.

  • Where is the latest STABLE version of Firefox?

    I want the latest STABLE version of Firefox. I'm not interested in BETA versions. But, Mozilla is doing a good job of hiding the latest stable version and forcing customers into its ever-changing unstable Beta system. Can anyone tell me which version