Accessibility
 
Home > Products > Director > Support > Basics of Director 3D
Macromedia Director Support Center - Basics of Director 3D
3DText1

When you open the 3DText1 movie, you see a text cast member named textSample represented as a sprite on the Stage. The text of this cast member is "Director 3D". As the movie plays, you can toggle the text sprite between 2D and 3D modes. While the text is in 3D mode, you can use the buttons at the left of the Stage to apply different property settings and view how those settings affect the text.

Each text property button includes a behavior script that calls a handler in the movie script.

To view the complete movie script, open the Script window and go to Movie Script 5.

In the movie script, the following handler specifies the model (the text) position along with the camera position and rotation. The transform property includes rotation and position sub-properties.

on startMovie

    if member("textSample").displayMode = #mode3d then
        member("textSample").model[1].transform.position = vector(-190, -5,0)
member("textSample").camera("DefaultView").transform.position = vector(81, 21, 90)
        member("textSample").camera("DefaultView" ).transform.rotation = vector(-3, 0, 0)

    end if
end
The following handler displays the current 3D text properties in the text cast member called comment:
on setComment
    member("comment").text = "3d Text" & RETURN & \
    "bevelType = " && member("textSample").bevelType & RETURN & \
    "bevelDepth = " && member("textSample").bevelDepth & RETURN & \
    "tunnelDepth = " && member("textSample").tunnelDepth & RETURN&\
    "smoothness = " && member("textSample").smoothness & RETURN & \
    "displayFace = " && member("textSample").displayFace
end
Clicking buttons on the Stage calls various handlers. When you click the Toggle 3D button, this next handler toggles between 2D and 3D modes by setting the displayMode property:
on toggle3d
    if member("textSample").displayMode = #modeNormal then
        member("textSample").displayMode = #mode3d
        member("textSample").model[1].transform.position = vector(-190, -5,0)

        member("textSample").camera("DefaultView" ).transform.position = vector(81, 21, 100)
        member("textSample").camera("DefaultView" ).transform.rotation = vector(-3, 5, 0) 

        setComment
    else
        member("textSample").displaymode = #modeNormal
        member("comment").text = "2d Text"
    end if

end
The following handler sets the 3D text's bevel effect, such as miter, round, and no beveling (none).

on setBevelType
    if member("textSample").bevelType = #none then
        member("textSample").bevelType = #miter
        setComment

    else if member("textSample").bevelType = #miter then
        member("textSample").bevelType = #round
        setComment

    else if member("textSample").bevelType = #round then
        member("textSample").bevelType = #none
        setComment

    end if 
end

The following handler sets the amount of beveling on the front and back faces of the text. The amount of depth increases by 1 until it reaches 15, then cycles back to 1.

on setBevelDepth
    if member("textSample").bevelDepth < 15 then
        member("textSample").bevelDepth = member("textSample").bevelDepth + 1

        setComment
    else
        member("textSample").bevelDepth = 1
        setComment

    end if 
end
The following handler sets the extrusion depth. The depth increases in increments of 10 until reaching 100, then cycles back to 10.

on setTunnelDepth
    if member("textSample").tunnelDepth < 100 then
        member("textSample").tunnelDepth = 
        member("textSample").tunnelDepth + 10
        setComment

    else
        member("textSample").tunnelDepth = 10
        setComment
    end if 
end

The following handler sets the smoothness and curves of angled lines in the 3D text. The value increases by 1 when you click the Display Smoothness button.

on setSmoothness
    if member("textSample").smoothness < 10 then
        member("textSample").smoothness = member("textSample").smoothness + 1

        setComment

    else
        member("textSample").smoothness = 1
        setComment
    end if
end
The following handler controls the display faces that modify the 3D text. Display face combinations can include showing the front face of the extruded text, the back face, the tunnel depth, and any combination of the three faces. If, for example, you choose to display the front face and tunnel depth only, the back face will not appear on the 3D text.
on setDisplayFace
    if member("textSample").displayFace = [#front] then
        member("textSample").displayFace = [#tunnel]
        setComment

    else if member("textSample").displayFace = [#tunnel] then
        member("textSample").displayFace = [#back]
        setComment

    else if member("textSample").displayFace = [#back] then
        member("textSample").displayFace = [#back, #tunnel]
        setComment

    else if member("textSample").displayFace= [#back, #tunnel] then
        member("textSample").displayFace = [#front, #tunnel]
        setComment

    else if member("textSample").displayFace=[#front,#tunnel] then
        member("textSample").displayFace = [#front, #back, #tunnel]
        setComment

    else if member("textSample").displayFace = [#front, #back, #tunnel] then

        member("textSample").displayFace = [#front]
        setComment

    end if 
end
To Table of Contents Back to Previous document Forward to next document