Using Director > Behaviors > Setting up a Parameters dialog box

 

Setting up a Parameters dialog box

It's impossible to predict exactly what a user will want behaviors to do. You can make behaviors more flexible by letting the user customize the behavior's parameters.

For example, this handler moves the sprite 5 pixels to the right each time the playback head enters a new frame:

on enterFrame me
	if the locH of sprite the spriteNum of me > the stageRight then 
		set the locH of sprite the spriteNum of me = the stageLeft
	else
		set the locH of sprite the spriteNum of me to ¬
		(the locH of sprite the spriteNum of me + 5)
	end if
end

However, users could adjust the speed of each sprite if they could specify how far individual sprites move to the right in each frame.

To allow users to set different values for a property in different instances of the behavior, the behavior's script needs two types of Lingo:

A property statement that allows each instance to maintain a separate value for the property

An on getPropertyDescriptionList handler that sets up the property