filmloopFrames

  how to control the playback of filmLoops
filmloop




  filmloopFrames
Basically, you have to input the number of frames a filmloop has and then some 
frame counting script in the frame with that filmloop can decide if the last 
frame has been reached.
The alternative may be to include an unhearable sound in that filmloop that 
you can test with soundbusy(chnl) and that indicates the last frame, but I 
never did this my self.
Below is a repost of a way to handle this that worked fine in a project with 
hundreds of filmloops with animations like "talking", "walkingLeft", ... 

Daniel Plaenitz



I wanted a FrameScript that could treat them all with minimum adaption 
necessary.
So each FilmLoop keeps the info about its length in its name. 
i.e.: "talking-3", "walkingLeft-9".

If i.e. "talking-3" needs to be repeated 10 times with the filmloop living in 
sprite 30 
the handler below serves me well. I keep a collection of versions of it with 
the typical values, drag &drop them where needed and need not care if someone 
else decides to add a frame to that loop. If it happens to be "talking-5" in 
the end, I won't have to change a bazillion of frame scripts.


-- FrameScript plays a FilmLoop wieOft times 

on exitFrame
  global gAnimCount,gAnimTimes

  -- adapt this to the number of times you want the FilmLoop displayed
  set wieOft=10
  -- adapt this to the sprite your filmloop sits in	
  set animSprite=30

  if voidP(gAnimTimes) then set gAnimTimes=1
  if voidP(gAnimCount) then set gAnimCount=1
  
  set dName=the name of member the member of sprite animSprite
  set da= offset("-", dName)
  set darst=chars(dName,1,da-1)
  set maxLoop=value(chars(dName,da+1,the number of chars in dName))
  
  if maxLoop<=gAnimCount then
    -- done once
    set gAnimCount=value(VOID)
    set gAnimTimes=gAnimTimes + 1

    -- may be once more?
    if wieOft<gAnimTimes then
      -- no, we're through
      set gAnimTimes=value(VOID)
      go the frame +1      
    else
      set gAnimCount=1
      go the frame
    end if    
  else
    set gAnimCount=gAnimCount + 1
    go the frame
  end if 
end

Home shock + cgi Bits 'n pieces Director Lingo Shocklets Contact










pageID=l_filmloopFrames