how can an object receive startmovie/stopmovie events while travelling through a series of scriptless movies?
oop startmovie event scriptless_movie

>Geoff Hoffman wrote:
>> the question is, how can a pre-birthed script object get a startMovie,
>> idle, or stopMovie event instead of a stage or movie object? this is
>> proving to be much more difficult than i originally thought...

Hi Jeff,

to let your pre-birthed scriptobject get idle, stopMovie etc events you will 
need a movieScript in all the individual movies which works like the one Owen 
recommended. However, there is no need to manually paste this into every single 
movie, you can create (and erase, if want to) the script on the fly.
Below is a parent script which on birth loads a scripttext from a field into 
a property. If a reference to this object is appended to the actorlist the 
object will check regularly whether a movie script exists or not, and create 
the movie script if needed. 

append the actorlist,new(script "vsObj")

The movie script will receive and redirect events like "stopmovie", "idle" etc.
This won't work for "prepareMovie", "startMovie" since the movie script for 
a new movie won't exist when those events happen.


--vsObj parent script

property myTicks,myWait
property myScriptName,myScriptTxt

on new me
  init me
  makeGlobal me
  return me

on makeGlobal me
  global gObj
  set gObj = me

on init me
  set myTicks = the ticks
  set myWait = 60
  set myScriptName = "Main"
  if the number of member "ScriptText" < 1 then
    alert "could not load ScriptText"
    set myScriptTxt = the text of member "ScriptText"
  end if

on stepFrame me
  if the ticks > myTicks then
    checkForTheScript me
    set myTicks = the ticks + myWait
  end if

on checkForTheScript me
  if the number of member myScriptName < 1 then 
    set dScript = new (#script)
    set the name of dScript = "main"
    set the scripttext of dScript = myScriptTxt
  end if

on eraseScriptMember me
  if the number of member myScriptName > 1 then
    erase member myScriptName
  end if

on stopMovie me
  -- eraseScriptMember me
  put "StopMovie"

on mouseDown me
  put "mouseDown"

--field "ScriptText", 
-- the object above will load the scripttext from this field
-- expand this according to your needs

on stopmovie
  global gObj
  stopmovie gObj

on mouseDown
  global gObj
  mouseDown gObj

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