Using setInterval/clearInterval to cycle through visible-invisible

I've got so confused with setInterval/clearInterval that fail
to code a very
basic effect.
I need an object to become visible for, say 3 sec, then to
become invisible
for 2 sec and so far.
I did three functions:
function objOnAndOff(){
int1=setInterval(objOff,3000);
int2=setInterval(objOn,4998)
function objOff(){obj._visible=false;clearInt(int1)}
function objOn(){obj._visible=true;clearInt(int2)}
obj._visible=true;
var int1,int2,int3
int3=setInterval(objOnAndOff,5000)
I expected objOnAndOff be called every 3+2=5 sec, of which
the object would
stay visible for the first 3 sec, then on 3.001 objOff() sets
it invisible,
then on 4.999 objOn() sets it visible. Immediately after that
objOnAndOff()
is called again and the cycle repeats. Instead it behave
erraticaly.
Where does my logic fail?

Thanks. Amaizingly, I used clearInterval() many times and yet
wrote
clearInt() looked at is many times and failed to notice.
I works in general.
However I have a timer counting down every second and I
planted trace()
into your two functions - the interval shown by the times is
not stable. It
is suppose to be 2 and 3 but timer sometimes shows 1 nd 2
respectively -
Iis is cvorrect to suggest that this is the result of an
inacuracy
accumulated over several cycles and we have this leap year
regularly?
Also is it important that you clearInterval for Off/On BEFORE
setting the
interval for On/Off
In my first attempt I coded similar functions but
clearInterval for Off/On
AFTER setting the interval for On/Off and it did not work,
though I do not
see why this matters.
"kglad" <[email protected]> wrote in message
news:e3bqes$g1p$[email protected]..
> you have a syntax error and an error in flash-logic. to
correct the
syntax
> error use clearInterval() to clear your intervals
(clearInt() is not a
flash
> function).
>
> your error in flash-logic is thinking setInterval()
function calls are
precise
> to within 2 ms. they are not and you're likely to
accumulate
uncontrollable
> calls to objOn().
>
> i don't think pwyon's code will do what you want. try:
>
>
> function objOff(){
> obj._visible=false;
> clearInterval(offI);
> onI=setInterval(objOn,2000);
> }
> function objOn(){
> obj._visible=true;
> clearInterval(onI);
> offI=setInterval(objOff,3000);
> }
> objOn();
>

Similar Messages

  • Cant Use Page Controls to Cycle Through Records in Report with Table

    Hi
    I have built a tabular report in answers that returns a 1000 rows. I have set the number of rows to be displayed to 100. However, when I run the report i cant use the page controls to cycle to the next 100 records.
    When I edit the table with the compound layout view I can cycle through the records fine, but when I save it and run normally I cant use the page controls.
    Page controls works on other reports in the subject area but these are pivot tables not normal tables.
    Can someone help diagnose the issue?
    I'm using OBIEE 10g btw
    Thanks
    James

    Hi,
    If you have set DefaultRowsDisplayed as 100 in instaceconfig.xml file, then this would effect only the table view, not Pivot table. By default, Pivot would display all the records without pagination.
    Thanks

  • Windows 7 cycles through updates on shut down (all the time)

    i have been having a devil of a time with my mac pro and am hoping this forum might have some leads on a problem.
    i have a first generation mac pro and an installation of windows 7 using parallels and every time i use windows 7 it cycles through a windows update procedure. this is a minor pain now which takes about five minutes but in the past it was a very long procedure.
    i recently had to re-install this setup due to a WD HD with "bad sectors" and i would like to solve this problem.
    can anyone advise?
    TIA
    P.S. I had to use "Jowie's" method to install windows 7 on this computer. i am running Lion 10.7.5.
    P.P.S. apologies for the apparently off-topic post but i have not gotten any leads on this on the windows forums or from the boot camp forums and i am almost at a total loss at this point in terms of getting this OS on this computer to work.

    you like me face the problems post Vista SP1 with 64-bit versions.
    Modifying and using Imgburn via Jowie is best I know of to get it to boot and install.
    There are always issues with native Boot Camp Windows updates and a VM like Parallels as to whether you can or should apply any update whatsoever in a VM or stick to doing so natively.
    Always have a backup image to restore from for ANY OS.
    Paragon Software Camp Tune and the great Hard Disk Mgr 12 Suite which will perform an "Clone OS" migration to another disk drive.
    For convenience never share a hard drive with Mac and Windows. Esp. for you and I. Dedicated drive only.
    WD Lifeguard in Windows is great at mapping out bad sectors.
    Use Carbon Copy Cloner to image your Mac and the Recovery partition to another drive also.
    You would then never ever have to reinstall any or either.
    There are people on the Boot Camp forum where I burned out that you and I well... we've been over this before to the point I stopped and left.
    Apple's BootCamp 4.0 64-bit from my attepms (I run Windows 8) will not install and I guess needs CMD.exe and direct it at Apple installer MSI program or Setup. I would not normally and not needed except for data and time and the Boot Camp Startup  Manager in Windows.

  • How to create a small field that cycles through a series of images. (using Acrobat Pro)

    Using Acrobat Pro, we need to use a small field to track student progress.  With successive mouse clicks, the field would cycle through: 
    -- a number (that identifies an element of study),
    -- same number surrounded by a circle (indicates element is assigned to the student),
    -- same number with a check mark (indicates element was completed by the student),
    -- back to the original number.
    This could probably be handled by cycling through a series of small images when the user clicks on the field.   
    The "Check Box" field allows only a check to be added to the field.  It does not allow the circle and does not cycle through multiple states. 
    The "Text Box" field might allow this capability, but if so we are not able to configure it properly.  
    Any solutions?   Thanks!

    Thanks Michael,
    The information at the link you provided enabled us to create a button that cycles through a series of ASCII characters. 
    This us useful, but we need to cycle through a series of images.  A more difficult problem. 
    FYI, an example of the javascript that cycles through a series of ASCII characters is shown below.  (The "else" statement pertaining to a null "" buttonGetCaption state is used to initiate an initial state of "1" for the button when the form is first opened.). 
    if
    (event.target.buttonGetCaption()=="1"+"\u2714") {
        event.target.buttonSetCaption("1");
        event.target.textColor = color.black; }
    else if (event.target.buttonGetCaption()=="") {
        event.target.buttonSetCaption("1");
        event.target.textColor = color.black; }
    else if (event.target.buttonGetCaption()=="1P") {
        event.target.buttonSetCaption("1"+"\u2714");
        event.target.textColor = color.green; }
    else if (event.target.buttonGetCaption()=="1") {
        event.target.buttonSetCaption("1P");
        event.target.textColor = color.red; }
    loop
    Again, we are still looking for a way to cycle through a series of images so any help with that problem would be appreciated. 

  • How to cycle through scenes using the up and down buttons??? (Please help, novice!)

    Hi,
    I'm currently trying to teach myself how to use flash CS5 and actionscript 3 and apart from doing small amounts of programing here and there I'm a complete novice.
    I have 36 photographs taken at 10-degree angles, making an object and i have each image in a different scene, with hidden buttons asigned to different parts of the object so that whenever you hover your mouse over them it provides some more information.
    What I want to do is to be able to cycle through these images in the different scenes using the up and down buttons on the keyboard.
    I'm hoping that I'm at least half way there having assigned the 'hot-spots' but I'm just stuck on the final part... please help!!!!
    Many thanks in advance!
    Harry

    If you are talking about the arrow keys on the keyboard you will have to use a Keyboard Event listener and take note of the constant value for resulting KeyCode
    This website seems to have a handle on it:
    http://www.republicofcode.com/tutorials/flash/as3keyboard/
    There is another method that allows you to listen just to the keys you want (up and down):
    http://www.flex888.com/598/using-keycodes-in-actionscript-3.html

  • Can I cycle through and change the color overlay of certain layers by name using script?

    Can I cycle through and change the color overlay of certain layers by name using script?

    Sure. Ask in the scripting forum and refer to the scripting docs.
    Mylenium

  • Using command tab for application switcher no long cycles through all apps

    Using command tab for application switcher use to work as it always has before Lion, and did in Lion for a few days. Now it stops at the last app. It always use to keep cycling through through all the apps. I figure I did something, but cannot figure out what. I have tried old tricks like force quitting dock using Activity Monitor, but that didnt work. Tried restarting, repairing permissions, and a new user account. I will great appreciate anyones help with this.
    Thanks,
    Mark C.

    I was going to post my experience about application switcher as well, but i have the opposite problem: in SL it never worked, but now in Lion it does. Since I upgraded by installing over Lion, I'm assuming there must be a setting somewhere for this behavior. There is a place for setting keyboard keystrokes, looking there may help.

  • Cycle through windows using mouse wheel.

    Hi,
    I want to get a set up that allows me to cycle through open windows by holding down the right mouse button and rolling the scroll wheel in xfce. Does anyone have any advice on how I might do this?
    Thanks.

    Here's something I hacked up based on some other code I have, however I haven't tested it so I have no idea if it will work, also the right click will currently be passed on to the active window which could be annoying.
    If you want to try it, change the system() lines to match the xdotool command line you need, save as main.c, compile with "gcc -o scrollswitch main.c -lX11", run the resulting scrollswitch executable and cross your fingers
    #include <X11/Xlib.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    int main()
    Display *dpy;
    XEvent ev;
    int right_down = 0;
    if (!(dpy = XOpenDisplay(NULL))) {
    fprintf(stderr, "Could not open display %s", getenv("DISPLAY"));
    // Guessing that 3
    XGrabButton(dpy, 3, 0, DefaultRootWindow(dpy), True, ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
    XGrabButton(dpy, 4, 0, DefaultRootWindow(dpy), True, ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
    XGrabButton(dpy, 5, 0, DefaultRootWindow(dpy), True, ButtonPressMask, GrabModeSync, GrabModeAsync, None, None);
    for (;;) {
    XNextEvent(dpy, &ev);
    if (ev.type == ButtonPress) {
    if (ev.xbutton.button == 3) { /* Right click */
    right_down = 1;
    /* Grab pointer so we receive ButtonRelease */
    XGrabPointer(dpy, DefaultRootWindow(dpy), True, PointerMotionMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
    XAllowEvents(dpy, ReplayPointer, CurrentTime); /* Allow other apps to process this message */
    if (right_down) {
    if (ev.xbutton.button == 4) { /* Scroll up? */
    system("xdotool alt shift tab"); // Fix this
    if (ev.xbutton.button == 5) { /* Scroll down? */
    system("xdotool alt tab"); // Fix this
    } else {
    XAllowEvents(dpy, ReplayPointer, CurrentTime); /* Allow other apps to process this message */
    } else if (ev.type == ButtonRelease) {
    if (right_down) {
    XUngrabPointer(dpy, CurrentTime);
    right_down = 0;
    XCloseDisplay(dpy);
    return 0;

  • Programmat​ically Cycle through Boolean Array

    I'm using an Agilent 34970 with a 34901A switch module. It has 16 switches going to two commons. The end function is to switch through all the sources to read resistance and voltage.
    The driver and sample vi from the NI idnet were used as a base for my vi.
    The sample vi uses a user-controlled 2-d boolean array (false = open). I want to be able to programmatically cycle through all the switches, but I don't know how to tell the dimensions of array I have.
    I would like to go through every element of the 2nd raw for each element in the 1st row. If I could programmatically ignore elements #9, 10, 19, and 20, that would be helpful too.
    Thanks for any help!
    Attachments:
    Agilent 34970 Advanced Scan-2U test-1.vi ‏31 KB
    Agilent 34970 Switch-2U test.vi ‏23 KB

    CelerityEDS wrote:
    Is there a way to determine what's in the vi front panel right now? I cannot determine if it's 2x10 or 10x2... There are no properties of the 2-d array that plainly tell me.
    There is "array size" which tells you the actual size of the 2D array.
    There are properties that tell you how many rows and columns are visible in the front panel array container.
    There are also properties that tell which element is currently scrolled to the top left corner.
    The size and index position of the front panel array control or indicator is not related to the actual array size. You can show only 2x2 elements of a 1000x1000 array or vice versa. if the container is too big, the extra elements are greyed. 
    LabVIEW Champion . Do more with less code and in less time .

  • GUI elements visible/ invisible

    I need various different comboboxes to appear as the user steps through making choices.
    I am new to Swing and unsure whether I can make comboboxes visible, or whether I should have them on different JPanels and make these visible/invisible.
    Am a little confused 'cos I read in a book that only one element can be contained in a specific container region, so can I have several JPanels in the one region of the container at the same time?
    I am using border layout.
    If someone could please explain I'd sure appreciate it!

    There are many layouts availabled in Swing, BorderLayout, BoxLayout, GridBagLayout, CardLayout etc etc. Each of them have their own pros and cons. For instant, BorderLayout can only contain one element in a specific container region, like you said. It has 5 regions, North, West, East, West, and Center. Following link can give you more details about this layout.
    http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html
    Yes, you can make comboboxes visible or invisible.
    JComboBox.setVisible(true) or JComboBox.setVisible(false)
    You can do this to any other components as well, like JTextField, JLabel, JButton etc etc.
    cheers.

  • Can't cycle through active Mail windows whilst dragging attachmen

    Since upgrading to Mavericks, I've notice Mail has taken on a number of issues. The completely erroneous mail count in Mail Activity, I can live with. But there's another issue that's more troublesome.
    In most, if not all, applications with multiple windows, I am able to use Command-` to scroll through the active windows of an app whilst I am dragging a file to that app. The normal scenarios for this are:
    1) Dragging a file from one window in the app to another in the same app,
    2) Dragging a file from a window in one app over a window in a different app.
    So, in the case of Mail, this is what plays out. Let's say I wish to drag an attachment from one email (#1) to another (#2). Message #1 could be open in a free-floating window, or it could be within the main Mail window. I should be able to grad the attachment and then use COMMAND-` to switch over to the message #2 and drop it there. That's how it use to function (like the rest of OS X). But that's no longer possible.
    Another scenario... I might be dragging a file from Finder and wanting to drop it into an Mail message window. Normally I would grad the file and then use COMMAND-tab to quick-switch to Mail AND let's say the message window is hiding behind Mail, I should be able to hit COMMAND-` to bring it to the forefront. I no long can.
    What I have to do each time is move the main Mail window off to one side so that it does not end up completely obscuring the message window I am about to drag something to. Then when I bring up Mail with COMMAND-tab, the message window will be visible (even through in the background) and I can use the mouse (which is dragging the file) to bring it to the forefront.
    I hope this makes sense.
    Does anyone else have this issue? Is this common to Mavericks now? (I am on 10.9.4)
    Is this a bug in Mail, or just something odd happening on my system?
    Regards,
    J

    On Windows it is not possible to only cycle through the open windows of one application like you can on Mac.
    On Windows you can only cycle through windows of all open applications via (Shift) Alt+Tab.

  • Issues with AUTO cycling through ....

    I'm trying to do this:
    Any help with one or the other is very much appriciated !!!
    1) When the Timer is finish auto cycling through the tabs (1 to 16) of the ViewStack, and switching over to tab (1) to STOP, I would like to address a function to do something ???
    The question is now how to write the code to ID that the Timer has come to a STOP on tab (1), and how can I incoperate this into the existing (onTimerOne) function.
    2) The second item I'm after is that if I'm amnualy select any tab (1 to 16) to address also a function to do something ???
    3) The third item I'm after is to automaticly zero (0) the ViewStack to tab number (1) if I click a Btn.
    <mx:Script>
    <![CDATA[
        import flash.events.TimerEvent;
        import flash.utils.Timer;
        private var timerOne:Timer;
        private function initOne():void {
            timerOne = new Timer(5000, myViewStack.numChildren);
            timerOne.addEventListener(TimerEvent.TIMER, onTimerOne);
        private function onTimerOne(evt:TimerEvent):void {
            if(myViewStack.selectedIndex == myViewStack.numChildren-1) {
            myViewStack.selectedIndex = 0;
            return;
            myViewStack.selectedIndex++;
        private function autoOne():void {
            if (!timerOne.running) {
            timerOne.start();
        private function manualOne():void {
            if (timerOne.running) {
            timerOne.stop();
    ]]>
    </mx:Script>
    4) Well, the fourth item I'm trying to work out is as I'm reading my data from an Xml file to have a TextArea which shows the different countries from the Xml file for each ViewStack tab while auto cycling through these tabs (1 to 16).
    The diffuculty here is that I use this Xml with a specific urlID="1" to urlId="16" as part shown below.
    <urlsOceania>
        <urlOceania urlID="1"/>
        <searchCountry>American Samoa</searchCountry>
        <etc></etc>
    </urlsOceania>
    I'm reading all the other items this way:
    source="{urlsOceania.urlOceania.(@urID==1).etc}"
    Thanks in advance aktell2007

    Thanks for the confirmation.  7 miles away is most likely using the same VZW tower but it does confirm the problem is not in your current location for us.
    You can look up local tower locations from many public websites such as the following:
    www.antennasearch.com
    www.cellreception.com
    http://www.evdoinfo.com/content/view/2990/63/
    The signal of -65 shows you have strong reception but it doesnt show the entire picture.  Your tower could be overloaded or unauthenticating you.  There are lots of little issues that exist outside of the raw signal strength between the towers and the connecting devices that we users have no control over.  As you may guess only a tower tech has access to identify and correct these things.
    Based on the picture of the back of the MBR1515/Netgear N300 router from Netgear I would assume that only a normal sized SIM card will fit.  I would not assume a micro SIM card will fit.  Since I do not have access to either of the VZW or non-VZW 4G LTE router I cannot confirm if it will work or not.  You might have to give Netgear a call and ask.  Based on what I can see from the User Guides of both devices the SIMs used for each should be compatible with eachother.
    If you decide to purchase the non vzw version please post back your findings for us.

  • How to change keyboard shortcut for cycle through open tabs in PS and AI CC 2014

    I would love to set my own keyboard shortcuts for cycling through open tabs in PS and AI 2014 on OS X. I found out that this can be achieved with ctrl+tab in PS, but I couldn't manage to make any of the suggestions in the forum work for AI. As said, I would like to set a more "standard" shortcut like alt+cmd+arrow-keys for both of the apps. If that shouldn't be possible, does anyone know a shortcut in AI CC 2014?
    Many thanks!
    Amadeus

    Thanks! The shortcut can be set like this in AI, although all key combinations I would want to use are not allowed. Too bad. But anyways, thank you very much for the tip!
    cmd+~ is not an option for me, I guess, since the swiss/german keyboard layout has no dedicated tilde key.
    So, I have a working shortcut in PS (ctrl+tab / of which I still don't know how to change, if possible at all) and thanks to you, I can now set one in AI as well. Unfortunately, I can not set it to be identical as in PS, since the "cmd" key needs to be included in AI's shortcut assignment dialogue, but I guess, this is as good as it gets.

  • How do I change the keyboard shortcut for Cycle through open documents in PS CC for Mac?

    Sorry to bug the community with such a seemingly inconsequential task, but I am seriously tired of using the awkward default keyboard shortcut for cycling through open docs in PS.  I'd like to change it to what I am used in in Chrome, which is Cmd+Option+[left] or {right} arrow keys.  I noticed this is not a command listed in the in keyboard shortcuts, for whatever reason.  Where on Earth can I change this? 
    If it is not possible to do it by default, is there a plug-in or a change to the code that will allow this basic functionality? 
    Thanks again guys and gals!

    As far as I know, you can't. It's "hard wired" in.  Not even Edit > Keyboard Shortcuts is allowed  to change it.
    However I did find this tip:
    Anyway i never found tabs in Adobe application useful, instead i prefer the old school method: simply switch off tabs feature via illustrator/ preferences/ user interface/ open documents as tabs. Then in Mac preferences panel, under keyboard, just search for the “focus on next application window” field (under menu, keyboard and text) and assign a shortcut if the default option doesn't fit you. And there is now you can easily switch between open documents!.
    The best part of this is that it can be used in all mac applications, not only Adobe ones. And remember, if you want this working on Indesign, Photoshop, etc be aware of first switch off the tab features so that the system could “see” multiple documents opened not only one single tabbed document.
    Gene

  • Cycle Through Windows broken

    The Cycle Through Windows (CMD + ~) is broken in the Leopard Finder. It works until you cycle to the Desktop, and then it stops working. You need to click on another Finder window to get it going again. Not a show-stopper but it's definitely a very annoying bug.
    OAW

    *Cycle Through Windows* in the Finder works again if you +disable Spaces+ (...) I hope it's just a silly bug, cause it is really annoying (and I want to use Spaces).
    10.5.1 didn't fix it - let's wait and see what 10.5.2 will bring us.
    To disable Spaces: System Preferences > Exposé & Spaces > Spaces > uncheck 'Enable Spaces'

Maybe you are looking for

  • Shared printing on 10.3.9 iMac from MBP with 10.5.5 (worked then not!)

    Panther 10.3.9 on iMac (Host with HP PS C3180 for shared printer attached via USB) - Leopard 10.5.5 cannot find the shared printer after it was already working for 3 weeks. Shared printer in Leopard disappeared. When attempting to reinstall the share

  • Exception on creation of service metadata for WSDL

    trying to access webservice (generated on Oracle applic. Server)  as Adaptive WebServiceModel i get the following error: Exception on creation of service metadata for WSDL Caused by: com.sap.engine.services.webservices.jaxrpc.exceptions.WebserviceCli

  • Custom query conditions in db adapter

    Hello, How to execute custom query in bpel db adapter? For example : 1. select * from employee where status = 'N' and address is not null 2. select * from empoyee where substatus = 'Y' and phone is null after where keyword - query part is dynamic, pa

  • Uninstalling programs like Photoshop

    Hi Everyone, and Happy Holidays I am upgrading from Adobe CS1 to CS4, and want to know if I simply just drag the old application icons to the trash and empty it out to completely uninstall the old programs. Thank you or your time and assistance!

  • White specs on black screen

    Hi, I discovered today that when I display a black object on my screen these white specs appear on the screen and fall quite fast in a snow falling motion... I tried a video, same effect. Changed the wallpaper to black, and can see multiple white doc