Troubleshooting / FAQ

I've dragged the Popup or Menu behaviour onto a sprite - but how do I get it to display stuff?

Popups and menus display lists. You need to write some code to set the list. For example, if you have a behaviour on sprite 1 that acts as the main interface to your application, you could have that behaviour listen for widget's 'ReadyMessage' and use this to set the list:

on PopUpReady (me, sender, id)
 sender.SetList(["Item 1", "Item 2"])
end

Alternatively, you could add a second behaviour to the sprite that looked like this:

on beginSprite(me)
  sendSprite(me.spriteNum, #SetList, ["Item 1", "Item 2"])
end

I've changed the graphics used by the factory - but the old graphics are still being used?

The first time a factory is activated, stores its list of images. This list is a property of the script and it will remain active until you quit director. Restart Director (or void the ClassGraphicComponentList of the factory using the message window).

I want to change the fonts that are used.

The text is generated using the PixelFont scripts. Refer to this information on how to change the fonts.

I'm an old-skool, prodecural kinda person - how do I get the sprites to interact with my movie scripts?

Movie scripts are objects, so you can add a movie script as a listener like this

WidgetObject.AddListener(script("MovieScriptName")

Note that when sending messages to movie scripts this way, the first parameter will be a reference to the movie script object. Therefore, you should still write your event handlers like this

on ButtonClick (this, sender, args)

Hey, that only half answers the question... How does my movie script find the widget so it can add itself as a listener?

If the widget already exists, then your movie script can do this

on MovieScriptFunctionToGetWidgets ()

  thisMovieScript = script("MovieScriptName")

  sendAllSprites(#DiscoverWidgets, thisMovieScript)

end

This will cause all existing widgets to send the movieScript the #WidgetReadyMessage. However, if you want the widgets to notify a movie script when they come into existence, then you can either (1) modify the behaviour's beginSprite method so that instead of using SendAllSprites to announce themselves, they call your specific movieScript function; or (2) Create a second 'relay' behaviour which calls the function. For example, you could put an invisible sprite stetched right across the length of your movie and add a behaviour like this to it:

on WidgetReady (me, WhatWIdget, id)

   MovieFunction(WhatWIdget, id)

end
First published 09/06/2005