Talk:Linked Director Movies

From Director Online Wiki
Jump to: navigation, search

Instead of using script(1).scriptInstanceList[1] = [:], I have worked out that it's possible to use script channel 0 - the frame script channel. Here's the modification to the code:

on ldmDataContainer

 if sprite(0).scriptInstanceList.count = 0 then
   sprite(0).scriptInstanceList[2] = [:]
 end if
 
 ldmDataContainer = sprite(0).scriptInstanceList[2]
 return ldmDataContainer
 

end

on prepareFrame

 if _movie.frameScript <> 0 then
   sprite(0).scriptInstanceList[1] = script(_movie.frameScript)
 else
   sprite(0).scriptInstanceList[1] = VOID
 end if

end

It is necessary to handle the setting of the script on the frame each frame. This overhead shouldn't be noticeable, but I haven't thoroughly tested the overhead.


As well, in the sub-section titled, "The mouseEnter/Leave/Within scope problem", it's possible to set a flag instead of creating a whole new handler, ie:

on mouseEnter me, activated

 if activated then
   -- set your mouseEnter code here, as you normally would
 else
   pLdmMovieRef.sendSprite(me.spriteNum, #mouseEnter, true)
 end if

end