EasyManua.ls Logo

MACROMEDIA DIRECTOR MX 2004-USING DIRECTOR - Including a Description for the Behavior Inspector; Example of a Complete Behavior

MACROMEDIA DIRECTOR MX 2004-USING DIRECTOR
500 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Example of a complete behavior 285
// JavaScript syntax
function getPropertyDescriptionList() {
var description = new Array();
description[#movement] = [:]
description[#movement][#default] = 5
description[#movement][#format] = #integer
description[#movement][#comment] = "Set motion to the right:"
description[#movement][#range] = [#min:1, #max:10]
description[#noise] = [:]
description[#noise][#default] = ""
description[#noise][#format] = #sound
description[#noise][#comment] = "Sound cast member name"
return description
}
Including a description for the Behavior inspector
An on getBehaviorDescription handler in a behaviors script provides a description that
appears in the bottom pane of the Behavior inspector when the behavior is selected. For
example, this handler displays the phrase “This changes sprite color and position” in the
Behavior inspector:
on getBehaviorDescription
return "This changes sprite position"
end
Example of a complete behavior
If the handlers described here were in one behavior, the script would look like this (the
puppetSound method was added to the on mouseUp handler in this example):
--Lingo syntax
property movement
property noise
on enterFrame me
if ( sprite(me.spriteNum).locH > window("stage").rect.right ) then
sprite(me.spriteNum).locH = window("stage").rect.left
else
sprite(me.spriteNum).locH = sprite(me.spriteNum).locH + 5
end if
end
on mouseUp me
sprite(me.spriteNum).foreColor = random(255)
puppetSound noise
end
on getBehaviorDescription(me)
return "This changes sprite position"
end
on getPropertyDescriptionList(me)

Table of Contents

Related product manuals