A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Should be simple.. Posted on wrong group earlier

  1. #1
    Junior Member
    Join Date
    Mar 2000
    Posts
    4

    Unhappy

    Hey all,

    This really should be simple. It is a rollover that tests for the play head position on the target movie. Here is the code:

    On (Roll Over)
    If (/web:_currentframe >= 15)
    Stop
    Else
    End If
    Begin Tell Target ("/web")
    Loop While (/web:_currentframe <= 15)
    Go to Next Frame
    End Loop
    End Tell Target
    End On
    On (Roll Out)
    If (/web:_currentframe >= 1)
    Loop While (/web:_currentframe >= 1)
    Begin Tell Target ("/web")
    Go to Previous Frame
    End Tell Target
    End Loop
    End If
    End On

    I am getting and infinate loop error. And, the play head goes immeadiately to the end of the movie /web.

    Any clues?

    vince


  2. #2
    Senior Member
    Join Date
    Feb 2000
    Posts
    195

    Lightbulb

    The problem is here:

    Loop While (/web:_currentframe <= 15)
    Go to Next Frame
    End Loop

    You see.. There is no delay there.. the loop tell /web to advance to the next frame, but /web will not actually advance until this entire action script has finnished. So the script then loops and sends /web to the next frame before /web has had a chance to advance at all.. hence the infinate loop.

    In order to solve this.. I would suggest a slightly different approach..

    Place a small looping MC in the Over state of your button (instead of using On Roll Over code). This looping MC should have two keyframes, like this:

    Keyframe 1 Action:
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>If (/web:_currentframe >= 15)
    Begin Tell Target ("/web")
    Go to Next Frame
    End Tell Target
    Else
    Stop
    End If[/code]

    Keyframe 2 Action:
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>Go to and Play (1)[/code]


    You can then put a similar looping MC in the Up state of the button that will send /web frame by frame back to frame 1.


    Does that make any sence?


    ------------------
    Scott Richards
    http://www.rjscs.com/scotty
    scotty@rjscs.com

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center