Indigo Rose Software

Professional Software Development Tools

 
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 29

Thread: Stopping a loop

  1. #1
    Join Date
    Apr 2004
    Posts
    32

    Stopping a loop

    I have a fade effect, ie an image fades into view and then out of view using this code in the "on Timer"

    if Opacity<=10 then
    step=2;
    elseif Opacity >=250 then
    step=-2;

    end

    Opacity=Opacity+step;
    long = DLL.CallFunction("AutoPlay\\Docs\\wTrans.dll", "SetWindowTransparency", handle..","..Opacity, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);

    The trouble is I want it to fade into view and then out of view once only, and then to fade into my main application...how do I stop this looping I am getting and then launch my main application?

    TIA

    Wookie

  2. #2
    Join Date
    Apr 2004
    Posts
    32
    Anyone?

    Wookie...

  3. #3
    Join Date
    Apr 2004
    Posts
    32
    I have spent all day going through the scripting guide to find something that will solve my problem above. I cannot see anything there, can someone please offer some help or advice?

    Wookie

  4. #4
    SUF6NEWBIE Guest
    Hey, try using the 'break' control word which is in the scripting guide.

    pretty sure it's used for exactly that... breaking out of loops etc.

    thats my 2 cents..hope gets you somewhere

    MTN

  5. #5
    Join Date
    Apr 2004
    Posts
    32
    Yeah I have tried that in various forms, but then the build fails as it says there is no loop to break...

    But thanks for trying, I appreciate that!

    Wookie

  6. #6
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Very busy weekend. Try something like this.

    [On Show]
    direction = up
    Opacity = 0
    Page.StartTimer(50);

    [On Timer]
    Code:
    if direction == up then
      if (Opacity < 255) then 
        Opacity = Opacity + 2
        long = DLL.CallFunction("AutoPlay\\Docs\\wTrans.dll", "SetWindowTransparency", handle..","..Opacity, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL); 
      elseif Opacity >=255 then
        direction = down
      end
    elseif direction == down then
      if (Opacity > 0) then 
        Opacity = Opacity + 2
        long = DLL.CallFunction("AutoPlay\\Docs\\wTrans.dll", "SetWindowTransparency", handle..","..Opacity, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL); 
      elseif (Opacity <= 0) then 
        Page.StopTimer()
      end
    end
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  7. #7
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Hey wow, neat code pasting thingy.

    Corey Milner
    Creative Director, Indigo Rose Software

  8. #8
    Join Date
    Apr 2004
    Posts
    32
    Thanks TJ..I have tried that one now and I'm afraid it does not work.

    I get half of what I want ie, the image will fade from nothing to full view, then it just dissapears completely.

    Thanks once again TJ...I appreciate the time and effort you spent trying this one out for me.

    Wookie

  9. #9
    Join Date
    Nov 2003
    Location
    Salzburg / Austria
    Posts
    312
    change + to - in second part of the code

    elseif direction == down then
    if (Opacity > 0) then
    --Change
    Opacity = Opacity + 2 -> Opacity = Opacity - 2
    ---------
    long = DLL.CallFunction("AutoPlay\\Docs\\wTrans.dll", "SetWindowTransparency", handle..","..Opacity, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    elseif (Opacity <= 0) then
    Page.StopTimer()
    end
    end

    Stefan

  10. #10
    Join Date
    Apr 2004
    Posts
    32
    Thanks Stefan...I have already tried that one....and I get the same result as above...in other words just half of the effect that I want.

    I'll have to try again later, I'm off to bed now...

    Thanks ALL of you who have tried this out for me...the saga continues!

    Wookie

  11. #11
    Join Date
    Nov 2003
    Location
    Salzburg / Austria
    Posts
    312
    Try to enclose the direction parameters in ""

    [On Show]
    direction = "up"
    Opacity = 0
    Page.StartTimer(50);

    [On Timer]
    Code:
    if direction == "up" then
    if (Opacity < 255) then
    Opacity = Opacity + 2
    long = DLL.CallFunction("AutoPlay\\Docs\\wTrans.dll", "SetWindowTransparency", handle..","..Opacity, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    elseif Opacity >=255 then
    direction = "down"
    end
    elseif direction == "down" then
    if (Opacity > 0) then
    Opacity = Opacity + 2
    long = DLL.CallFunction("AutoPlay\\Docs\\wTrans.dll", "SetWindowTransparency", handle..","..Opacity, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    elseif (Opacity <= 0) then
    Page.StopTimer()
    end
    end

    Stefan

  12. #12
    Join Date
    Apr 2004
    Posts
    32
    Nice one Stefan, its now mostly working.

    My image fades from nothing to full opacity, then dissapears for a second then reappears at full opacity and fades away to nothing. I'm not sure why it dissapears...any ideas?

    Thanks again Stefan!

    Wookie

  13. #13
    Join Date
    Nov 2003
    Location
    Salzburg / Austria
    Posts
    312
    copy paste error
    change + to - at second part of code
    change elseif to else

    [On Timer]
    Code:
    if direction == "up" then
    if (Opacity < 255) then
    Opacity = Opacity + 2
    long = DLL.CallFunction("AutoPlay\\Docs\\wTrans.dll", "SetWindowTransparency", handle..","..Opacity, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    elseif Opacity >=255 then
    direction = "down"
    end
    elseif direction == "down" then
    if (Opacity > 0) then
    Opacity = Opacity - 2
    long = DLL.CallFunction("AutoPlay\\Docs\\wTrans.dll", "SetWindowTransparency", handle..","..Opacity, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    else
    Page.StopTimer()
    end
    end

  14. #14
    Join Date
    Apr 2004
    Posts
    32
    I had already changed the + to a -, and making the elseif to else change did not change the way the app worked.

    How do I save or publish this little app so I can attach it here for you all to view and tinker with?

    Wookie

  15. #15
    Join Date
    Apr 2004
    Posts
    32
    Here is a copy of the logo...Please bear in mind that I plan to make a better looking logo later on...

    Hope this helps you to help me..

    Wookie
    Attached Files

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Hanging on while loop
    By pjhiggins in forum AutoPlay Media Studio 5.0
    Replies: 6
    Last Post: 03-08-2004, 03:00 PM
  2. Replies: 14
    Last Post: 06-24-2003, 04:21 AM
  3. Loop gives error
    By TJ_Tigger in forum AutoPlay Media Studio 4.0
    Replies: 0
    Last Post: 06-04-2003, 07:38 AM
  4. WHILE loop inside a IF/ENDIF statement???? Bug??
    By TJ_Tigger in forum AutoPlay Media Studio 4.0
    Replies: 2
    Last Post: 04-27-2003, 07:49 PM
  5. List box item value to set up loop
    By bruciori in forum AutoPlay Media Studio 4.0
    Replies: 3
    Last Post: 04-17-2003, 03:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts