Why this works only once?

Here is a snippet of code that I'm working on.  I have two symbols of buttons, instanced as "up" or "down".  There is a movie clip object instantiated as 'circle '.  Up and down are expected to respectively raise and lower alpha of the circle gradually using a timer.  Here is my code:

upTimer var: Timer = new Timer (100,10);
var downTimer: timer = new Timer (100, 10);
up.mouseEnabled = false;

upTimer.addEventListener (TimerEvent.TIMER, appear);
function appear(e:TimerEvent):void {}
Circle.Alpha = circle.alpha +. 1;
trace (Circle.alpha);
}

downTimer.addEventListener (TimerEvent.TIMER, disappear);
function disappear(e:TimerEvent): void {}
Circle.Alpha = circle.alpha-. 1;
trace (Circle.alpha);
}

up.addEventListener (MouseEvent.CLICK, upButton);
function upButton(event: MouseEvent): void {}
upTimer.start ();
up.mouseEnabled = false;
down.mouseEnabled = true;
}

down.addEventListener (MouseEvent.CLICK, downButton);
function downButton(event: MouseEvent): void {}
downTimer.start ();
up.mouseEnabled = true;
down.mouseEnabled = false
}

The problem is I can do only alpha disappear and reappear at the same time and then the program stops working like I want.  I press down and then up and it works but then bit the alpha on the circle didn't do that go up and down a little after.  Why?

Try to add a reset() before each start() for two timers.

upTimer.reset ();

upTimer.start ();

etc...

Tags: Adobe Animate

Similar Questions

  • Follow-up of the steps to install the hp wireless printer and it worked only once. Now he says it is "offline."

    Original title: the computer geek

    Follow-up of the steps to install the hp wireless printer and it worked only once. Now he says it is "offline." Convenience store said that it cannot solve the problem. That's happened?

    Hello

    1. What is the brand and model of the printer?
    2. don't you make changes on the computer recently before this problem?
    3. What is the full and exact error message?

    Step 1: The procedure below can help you to fix this problem.

    a. Click Start > Control Panel > printer and faxes
    b. now right-click on computer and select the printer to use online

    Step 2: Update printer drivers.

    To install new or updated printer drivers to update
    http://www.Microsoft.com/resources/documentation/Windows/XP/all/proddocs/en-us/print_drivers_install_updatew.mspx?mfr=true

  • vcbMounter works only once

    I use the following commands to mount the files from a virtual computer to back up these directories:

    vcbMounter h esx-mgmt - u secretuser - an ipaddr:file1 - r S:\secretdirectory\file1-files t file secretpassword Pei - san m

    Then the backup application creates the backup. Once the backup is complete, the following command is executed:

    vcbMounter h esx-mgmt - u secretuser secretpassword Pei - U S:\secretdirectory\file1-files

    This procedure works only once. When I run a second time, I get the following error message:

    ~ Error: did not find VM specified by ipaddr:file1 ~.

    Also vcbVmName no longer works.

    vcbVmName h esx-mgmt - u Administrator PEI s password ipaddr:file1

    No match found VMs.

    "Tip: If you are looking for a machine virtual address DNS IP/name cannot succeed if the virtual machine is turned on and running VMware Tools or is listed in the file cache VM name specified using the"

    -c"option.

    Workaround for the time being, I have found is to connect to this server from file1 and then close again. After this process, I can still make a backup.

    Any suggestions?

    Its a bug between VMware Tools and VCB. Check out this KB->http://kb.vmware.com/kb/1008709

    Dave Convery

    VMware vExpert 2009

    http://www.dailyhypervisor.com

    Prudent. We do not want to make of this.

    Bill Watterson, "Calvin and Hobbes".

  • My button function seems to work only once

    When I say Flash back executives that the buttons stop working, in other words, the button works only once. I tried to trace to find the problem and when I say to return images it won't function.  I use the Flash CS4 actionscript 3.

    hap.addEventListener (MouseEvent.CLICK, clickFunction2);
    trace ("addEventListener worked!");
    function clickFunction2(evt:MouseEvent):void {}
    trace ("clickFunction2 worked!");
    this.gotoAndPlay (191);
    trace ("gotoAndPlay worked!");
    }

    sad.addEventListener (MouseEvent.CLICK, clickFunction3);
    trace ("addEventListener worked!");
    function clickFunction3(evt:MouseEvent):void {}
    trace ("clickFunction3 worked!");
    this.gotoAndPlay(1,"sadness");
    trace ("gotoAndPlay worked!");
    }

    ang.addEventListener (MouseEvent.CLICK, clickFunction4);
    trace ("addEventListener worked!");
    function clickFunction4(evt:MouseEvent):void {}
    trace ("clickFunction4 worked!");
    this.gotoAndPlay(1,"anger");
    trace ("gotoAndPlay worked!");
    }

    rewind.addEventListener (MouseEvent.CLICK, clickFunction5);
    trace ("addEventListener worked!");
    function clickFunction5(evt:MouseEvent):void {}
    trace ("clickFunction5 worked!");
    this.gotoAndPlay(120,"happiness");
    trace ("gotoAndPlay worked!");
    }

    your buttons probably don't exist when you edit images.

    to remedy this, do not use the timeline to eliminate your pimples.  removeChild() to remove them when you change pictures and when you return to the frame where you want your buttons to appear, use addChild().

  • Modules of working only once

    It has been some time now that I noticed my addons not working not not on Mozilla TO in Ubuntu. Addons are installed properly and, indeed, they appear when I use mozilla sync in other computers.

    Today I tried the suggested troubleshooting here https://support.mozilla.org/en-US/questions/982460
    It works only once. I can install my addons again, but as soon as I close firefox and reopen the addons disappear from the top bar and the customization window. Even when I try to change preferences for Ghostery I get only blank a screen so addons are absolutely not working in Ubuntu

    Note that the OP is using the developer edition (39 Firefox) and not the regular version.

    Have you checked for problems caused by one or more of the extensions that may not be fully compatible with OF?

    Create a new profile as a test to see if your profile is the source of the problem.

    See "create a profile":

    If the new profile works then you can transfer files from a profile already used in the new profile, but be careful not to copy files corrupted to avoid transporting more problems.

  • My account is active, but Adobe PDF Export ask me to sign up again. The system worked only once on my PC, using the Vista operating system.

    My account is active, but Adobe PDF Export ask me to sign up again. The system worked only once on my PC, using the Vista operating system.

    You must connect prove you are currently subscribed.

  • Why this loop only executes once?

    Hi, please see the attached picture. Could someone please tell me what I did wrong here, this while loop executes only once, and I can't understand why. Help, please!

    Thank you, Alec

    last suggestion before you go fo RL of e week.

    Looks like you are trying an architecture producer consumer who SHOULD be in both loops, not one. Search for this term to look at a few examples.

    Ben

  • Buttons work only once or twice

    Hi guys, I'm still new to Flash and I really need help. Here is the story:

    so I do a simple digital comics right now, that shows one or two signs/pictures/drawings at a time with only 3 buttons to navigate (a next button, an exit button and a page selection button). Here is some info:

    -J' use CS6

    -J' I use simple tweenings for each photo (fade in/out, queries, etc.)

    -J' have it will publish in 2 formats, .exe and .apk for android

    -J' have 7 scenes, 1-6 for the main comic and scene 7 for the selection menu of page (within a clip)

    -I only use video clips of 2, one for the intro animation and another for page selection menu I mentioned above

    -because I'm still a noob, I always use excerpts of code (sorry)

    -J' I mostly only use these code snippets: stop at this image, click here to go to frame and to play, click here to go on stage and play.

    -for the exit button, I use this code:

    button_e.addEventListener (MouseEvent.CLICK, fl_MouseClickHandler);

    function fl_MouseClickHandler(event:MouseEvent):void

    {

    fscommand ("QUIT");

    --utiliser use for the next button, copy the following code:

    button_1.addEventListener (MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_3);

    function fl_ClickToGoToAndPlayFromFrame_3(event:MouseEvent):void

    {

    gotoAndPlay (frame number);

    }

    for the page selection button, I use this code:

    b_page.addEventListener (MouseEvent.CLICK, fl_ClickToGoToScene_40);

    function fl_ClickToGoToScene_40(event:MouseEvent):void

    {

    MovieClip (this.root) .gotoAndPlay (1, "scene 7");

    }

    Now, here's the problem:

    The page selection button worked fine initially. Then I click on the next button several times (lets say, from page 1, stage 1, I clicked the next button several times until I got to page 6, scene 2). Then I click the page selection button that opened the clip. Inside of this video clip is several buttons another, each of them takes me on different pages. For example, I clicked on a button linked to page 7 (inside the scene 2). Furthermore, the code goes like this:

    b_7.addEventListener (MouseEvent.CLICK, fl_ClickToGoToScene_3);

    function fl_ClickToGoToScene_3(event:MouseEvent):void

    {

    MovieClip (this.root) .gotoAndPlay (500, "Scène 2");

    }

    Still no problem detected. Then I continue to click the next button to read the rest of the comic strip. At this point, the page selection button (and the exit button) has stopped working. Clicked on it so many times and nothing happened. So, just like what I wrote in the title, it does only once or twice.

    Any suggestions?  (I wanted to download the .fla so you guys can take a look, but the size is too much )

    Screenshot:

    http://S25.postimg.org/azarwqvzj/screenie.jpg

    Thank you!

    put the button of your first scene on its own layer at the beginning of the stage and set its name.  extend his chronology up to the end of the scene.  test.  all the problems?

    If not, add additional keyframes in the layer of the button according to the needs of your project, making sure NOT to remove the button no keyframes.  test.  all the problems?

    If this is not the case, do the same for the other buttons in the other scenes.

    If you want your button to NOT appear in some frameworks do NOT for this key frame.  set its visible property to false or using removeChild.

  • PREVIOUS FLV Playback button works only once...

    Hi all..

    I have a FLVPlayer who plays a video and once the video is finished playing, is the BACK button. When you click the REPLAY button the movie again... Everything works fine, except the REPLAY button does work once... sense, once the film played only once and BACK button is cilcked to play again, after that the film is done playing for the 2nd time - the button does not appear... Fact, anyone has an idea on why it's perhaps? any help would be great appreciated. Thanks advance! Here is the code:

    Fl.video import. *;
    import flash.display.MovieClip;

    var myVideo:FLVPlayback = new FLVPlayback();
    var mybtn:myBtn = new myBtn();
    var staticpic:staticPic = new staticPic();
    logo: Logo of var = new Logo();

    myVideo.source = "BatterypoweredFCM.f4v";
    myVideo.skin = "SkinOverPlaySeekStop.swf";
    myVideo.skinAutoHide = true;
    myVideo.skinBackgroundColor = 000.
    myVideo.skinBackgroundAlpha =. 5;
    myVideo.width = 960;
    myVideo.height = 540;

    DropShadow
    function init() {}
    var dropShadow:DropShadowFilter = new DropShadowFilter();
    dropShadow.distance = 4;
    dropShadow.angle = 90;
    dropShadow.color = 000.
    dropShadow.alpha =.5
    dropShadow.blurX = 10;
    dropShadow.blurY = 8;

    logo.filters = new Array (dropShadow);
    }

    mybtn.x = 515;
    mybtn.y = 259;
    mybtn.Alpha =. 8;

    staticpic.x = 480;
    staticpic.y = 270;
    staticpic.Alpha =. 4;

    logo.x = 37;
    logo.y = 11;

    myVideo.addEventListener (VideoEvent.COMPLETE, completePlay);
    mybtn.addEventListener (MouseEvent.MOUSE_UP, proofreading);

    function completePlay(e:VideoEvent):void {}
    addChild (mybtn);
    addChildAt(staticpic,0);
    removeChild (myVideo);
    }

    function replay(e:MouseEvent):void {}
    addChildAt(myVideo,0);
    myVideo.play ();
    mybtn. Visible = false;
    staticpic. Visible = false;
    }

    addChildAt(myVideo,0);
    addChildAt (logo, 1);

    init();

    because you do not visible mybtn and you're never change that.  use:

    Fl.video import. *;

    import flash.display.MovieClip;

    var myVideo:FLVPlayback = new FLVPlayback();

    var mybtn:myBtn = new myBtn();

    var staticpic:staticPic = new staticPic();

    logo: Logo of var = new Logo();

    myVideo.source = "BatterypoweredFCM.f4v";

    myVideo.skin = "SkinOverPlaySeekStop.swf";

    myVideo.skinAutoHide = true;

    myVideo.skinBackgroundColor = 000.

    myVideo.skinBackgroundAlpha =. 5;

    myVideo.width = 960;

    myVideo.height = 540;

    DropShadow

    function init() {}

    var dropShadow:DropShadowFilter = new DropShadowFilter();

    dropShadow.distance = 4;

    dropShadow.angle = 90;

    dropShadow.color = 000.

    dropShadow.alpha =.5

    dropShadow.blurX = 10;

    dropShadow.blurY = 8;

    logo.filters = new Array (dropShadow);

    }

    mybtn.x = 515;

    mybtn.y = 259;

    mybtn.Alpha =. 8;

    staticpic.x = 480;

    staticpic.y = 270;

    staticpic.Alpha =. 4;

    logo.x = 37;

    logo.y = 11;

    myVideo.addEventListener (VideoEvent.COMPLETE, completePlay);

    mybtn.addEventListener (MouseEvent.MOUSE_UP, proofreading);

    function completePlay(e:VideoEvent):void {}

    addChild (mybtn);

    addChildAt(staticpic,0);

    removeChild (myVideo);

    }

    function replay(e:MouseEvent):void {}

    addChildAt(myVideo,0);

    myVideo.play ();

    removeChild (mybtn);

    removeChild (staticpic)

    }

    addChildAt(myVideo,0);

    addChildAt (logo, 1);

    init();

  • My firewire cable connection works only once

    I am using windows vista with Service Pack 2.
    My scanner connect using firewire-firewire.
    He is picked up first, then does not work afterwards.
    The scanner will not end his departure upward, unless the cable is removed.
    If I turn the cable autour, it will work, but only once.
    It will work with a new cable, but again, only once.
    Works fine on laptop with XP and mac.
    Help to really enjoyed, I'm short of cables.

    Hello

    I suggest to go through these steps and check
    Method 1:
    I suggest you to update fire wire device driver and check.
    The FireWire driver software update may solve problems with a FireWire connection. Use the following steps to update the driver software:
    (a) to connect to the Internet if the computer is not already connected.
    (b) click Start, right-click computer, and then click Properties
    (c) click on Device Manager
    (d) click on the plus sign (+) next to other devices.
    (e) if there is no reference to IEEE 1394, as Bus, right-click on the name host controller, and then select update.
    Method 2:
    Uninstalls and reinstalls the fire wire device driver.
    (a) to connect to the Internet if the computer is not already connected.
    (b) click Start, right-click computer, and then click Properties
    (c) click on Device Manager
    (d) click on the plus sign (+) next to other devices.
    (e) if there is no reference to IEEE 1394 controller Host Bus, right click on the name and select uninstall
    (f) close Device Manager, and then restart the computer...
    You can also try updating the chipset drivers
  • Show / Hide button to Drop down works only once

    Hello

    I use RH10. I have about 10 drop-down text on a page.

    I created only one show / hide all the button for my menu drop-down texts according to the procedure mentioned here.

    http://www.Grainge.org/pages/various_rh_projects/rh_twisty2/index.htm

    I get it almost immediately when I followed the instructions and the project. Except that my Show / button hide become inactive after a single use of these two functions, i.e., I can only once to display all click and click again to hide all. After that, either I have to refresh the browser or go to something else and come back to make it work. What could be the cause?

    I use 17.0.7 FireFox and IE8.

    Anthony

    I see only one image to your project. Although the user sees as a method of a button, there are two buttons, one for the show and one to hide.

    See the default value and must appear in the Images when you create the link. Hide is the one who must be in the luggage.

    Have you downloaded the demo rather than just the PDF?

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • BlackBerry Smartphones how works only once to pull the battery? (This is a serious question)

    Hi guys,.

    I can't help but feel incompetent when I can't remove the battery from my camera. I maybe just strong fingers, but not for the life of me, I couldn't remove the back panel of my 9700 when I have to reset my camera (I develop a GPS app and had to see the consistency of the time it takes to get the first stand-alone fix). Fortunately, I don't need to remove the battery very often, but I wish I could. Is there a good way to remove the said sign without damaging the unit?

    Watch the video to remove the batttery

    http://www.YouTube.com/watch?v=uQcO9I5P9dU

  • Interactive InDesign Fade in/out buttons work only once in the SWF file

    I have an animation sequence with a release button with fade effect to scroll on a chart image overlays. I used a trick of forum of ceating a rectangle empty, the box and the picture, stating the Group fade, and then I assign to the out button. This all works fine except when you click on the sequence of keys and the content that the Fade In button work even more, you can call the fade out as many times as you want. Definition of the animation loop or play more than once does not work. I thought it was a question of order or a layer group or maybe I need some kind of Reset button? Ideas for a software fix or work around?

    The only problem is that we are talking about CS6. There is no 'Animation' and ' Options: Reverse ' buttons in CS6.

  • The button works only once?

    The problem:

    Play the animation, and after clicking the button once it no longer works. The button takes you to the frame labeled "shake". I want to continue to make you "shake" whenever he's in a hurry, but it's not.

    The installation program

    I have a button inside a clip - actually its 2 inside. The first MC crosses and stops on the stop(); framework and that you click on the button that sends the playback head to the section titled "shake" which plays the next MC with the same button inside. I put the button action on its own layer on the first image. The length of this sequence of buttons from the first keyframe of the action is the length of time to the other MC 2.

    The Code

    mcButton.shakeButton.addEventListener (MouseEvent.CLICK, onClick);

    function onClick(event:MouseEvent):void {}

    gotoAndPlay ("shake");

    }

    What I found

    I searched the forum/web and in all cases that I met the problem above the toggle button is not the length of the visible button or other event listeners are in conflict with it. I don't know if one of them is my question. For 1 length of the frame of my button is so much time to the MC, which is the total length of the main timeline. If TI where a conflicting event listener to turn off that button should not play at all, because the event even listeners play before it than those who play after him. If I'm scratching my head for a direction.

    Are the 2 above known issues I found the problem that I have or do you know if it's something else?

    Thanks in advance!

    The second mc is nowhere in sight when this code runs within the Framework 1.  If the code for frame 1 is supposed to aim at the second mc to assign an event listener, it cannot.  Either the mc must be moved when the code is or the code should run when the mc is.  If you get no error messages, I have to wonder why.

    Functions and variables can be shared spread along a timeline in how you allocate this layer, but the code that runs, like play(), stop() etc, addEventListener() when you enter a frame, it happens that within this framework and does not extend to other images.

    What you can do, is have the second mc start frame 1 and make it invisible in this framework and then more later to frame 33 visible Tower.  Otherwise, you must have the event listener for the second mc code down into the fabric of 33.

  • the click event listener smile ActionScript 3.0 works only once

    I am a newbie. I use actionscript 3.0 and I have a file .as separated with all my action script code. I have 2 buttons called myBtn1 and myBtn2 in my .fla including the base class file is two flash.display.SimpleButton.
    The event listener for myBtn1 (buttonClickHandler) always fire correctly. But the eventHandler for myBtn2 (textClickHandler) fires once and only if myBtn2 is the first button click. (I know that these event handlers and instructions switch sounds pretty ridiculous with a single element of each, but I removed the code).
    Why textClickHandler only seems to work once?
    Any help would be greatly appreciated!

    According to one of the Adobe Technical Notes sometimes the event mouse move is missed by the DisplayObject, thus, rather than attach the listener to the stage. Which works very well. So now instead of

    myBtn1.addEventListener(MouseEvent.CLICK,buttonClickHandler);
    myBtn2.addEventListener(MouseEvent.CLICK,buttonClickHandler);

    I have

    stage.addEventListener(MouseEvent.CLICK,buttonClickHandler);

    Read all about it:
    http://www.Adobe.com/cfusion/knowledgebase/index.cfm?id=69a2ae4b

Maybe you are looking for

  • SCREEN SCRAPING WITH LABVIEW

    I would access a Web of LV page and enter a string in a bar of 'finding '. Once the chain has been formed, I am interested to press a button on the Web page, which then displays the results of the research. I can take the results and pull them in LV,

  • Mini 110-3100 cto

    I just tried to run a test of the battery because it seems to be in charge, but my computer died in 59% of the battery. The test failed and he gave me a primary battery Replace (00000030) FID: GU35TD-0006R4-XD7Q2K-C0C703 11/24/2010 SN: 01430 PID:WY58

  • MS Updates won't install

    Can someone help me with this, please? I keep getting messages that I have updates installed, but after going through the motions, I get this message: "Updates were not correctly configured. Returning from the changes. » As a result, I have a lot of

  • Task bar icon, what is it, how do I remove this

    This icon appeared on my taskbar. It appears while playing games in full-screen (without window), but does not appear in the screen grabs. It seems to not be selectable) what is and how to remove? circular arrow.

  • RSA Securid

    Anyone who has used RSA Securid token to connect to the Cisco routers, switches and firewalls to manage. He even supported on Cisco devices? I speak NOT of the VPN access. Any help will be greatly appreciated. Thank you Lake