Announcement

Collapse
No announcement yet.

Infinite but controlled routine loop

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Infinite but controlled routine loop

    Hi all,

    my name's Marco and I'm playing with MS.
    Can you write down which could be the methods to play an infinite routine loop but controlled by a button?
    Well, I'd like to have a number (a label text) that changes randomly (using the function math.random I suppose) in a page and it's forever until I push a button to stop it (or I change the page with a button).
    The random count have to start at the page open so I guess, I've to put the code in the Onshow section, right?

    Later I'll play with the code to make possible to start and stop the random counte with the same butto changing the text of the button in "Start" when it's stopped and "Stop" when it's running.

    I know that's not difficult for several programmer like you, but for me could be a good start... I'm a beginner in AMS, but I'm not just a code newbie.

    Thank you a lot.
    Best
    Marco

  • #2
    Look at the on timer functions and options read the manual there is loads to learn from it,will take a while but it's worth it.
    Plugins or Sources MokoX
    BunnyHop 2021 Here

    Comment


    • #3
      Ok.
      I'll try

      Thanks
      Marco

      Comment


      • #4
        Ok, now I'm able to use the timers... I can loop inifinitely, but I can't stop that application.
        When performing the loop, I can't press a button with the Page.stoptimer action... Could you send an advise, please?

        In the OnTimer of the page:

        ----------------------------------------
        timer=500;
        -- A for loop that counts from 1 to 10
        min = 1; -- The number to start at
        max = 10; -- The number to stop at
        for count = min, max do
        rand = Math.Random (33, 40);
        Progress.SetCurrentPos("ProgressBar1",rand);
        Label.SetText("LabelBar1",rand);
        Application.Sleep(timer);
        end
        --------------------------------------

        and in OnShow of the same page:

        ------------------------------------------
        Page.StartTimer(500, 1);
        ------------------------------------------

        I don't know how to stop the loop

        Thank you
        regards
        Marco

        Comment


        • #5
          Hi all,

          I'm doing progress.
          Of course, because I'm in a ontimer section, I can avoid the for do loop:

          In the OnTimer of the page I let:

          ---------------------------------------------
          rand = Math.Random (33, 40);
          Progress.SetCurrentPos("ProgressBar1",rand);
          Label.SetText("LabelBar1",rand);
          ---------------------------------------------

          and that does the job.
          Easy.

          Thanks a lot.
          Regards

          Comment


          • #6
            CanI say well done for taking the advice taken, it's not offen I see this, I wish you well on your idea/project.
            Plugins or Sources MokoX
            BunnyHop 2021 Here

            Comment


            • #7
              Thank you kingzooly.
              Now I'm searching for something similar to a tackymeter with the hands that move like a watch.
              AMS miss some graphics primitives, I think! Like lines, rectangle, semi-rectangles, circles and cake circles.

              Can you help me, please?

              Thank you
              Regards

              Comment


              • #8
                Originally posted by MarcoFontana View Post
                Thank you kingzooly.
                Now I'm searching for something similar to a tackymeter with the hands that move like a watch.
                AMS miss some graphics primitives, I think! Like lines, rectangle, semi-rectangles, circles and cake circles.

                Can you help me, please?

                Thank you
                Regards
                there are limits in AMS for all this, I think there is a clock demo on the forums some where but you will be limited, as does support flash but my advice is not to go down that root, you could also try html 5 one also, you do have to tweak AMS to use IE 11 as it uses it's the older IE I think 8

                On Startup
                Code:
                Registry.SetValue(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Internet Explorer\\MAIN\\FeatureControl\\FEATURE_BROWSER_EMULATION", "CHANGEME.exe", "11001", REG_DWORD);
                Registry.SetValue(HKEY_CURRENT_USER, "SOFTWARE\\Wow6432Node\\Microsoft\\Internet Explorer\\MAIN\\FeatureControl\\FEATURE_BROWSER_EMULATION", "CHANGEME.exe", "11001", REG_DWORD);
                On Shutdown
                Code:
                Registry.DeleteValue(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Internet Explorer\\MAIN\\FeatureControl\\FEATURE_BROWSER_EMULATION", "CHANGEME.exe");
                Registry.DeleteValue(HKEY_CURRENT_USER, "SOFTWARE\\Wow6432Node\\Microsoft\\Internet Explorer\\MAIN\\FeatureControl\\FEATURE_BROWSER_EMULATION", "CHANGEME.exe");
                You will need to change the CHANGEME.exe to your exe's name. This will let AMS use IE 11 what supports HTML 5 much better then 8 and IE 11 and many computers have mini of IE 11

                If your users are on windows 7 you can point them to download IE 11

                http://www.microsoft.com/en-us/downl...7-details.aspx
                Plugins or Sources MokoX
                BunnyHop 2021 Here

                Comment


                • #9
                  Thanks a lot.
                  I'll try it for sure!

                  Thanks
                  Regards

                  Comment


                  • #10
                    loop in timer ??
                    timer is a loop
                    that means loop inside loop
                    you cant plant a tree inside a tree

                    Comment

                    Working...
                    X