07.12.2012 Views

Adobe Director Basics

Adobe Director Basics

Adobe Director Basics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ADOBE DIRECTOR BASICS<br />

3D: Controlling appearance<br />

-- Lingo<br />

vMember = member("Text")<br />

vMember.boxType = #fixed<br />

vMember.width = 128<br />

vMember.height = 256<br />

put vMember.rect<br />

-- rect(0, 0, 128, 256)<br />

// JavaScript<br />

vMember = member("Text");<br />

vMember.boxType = symbol("fixed");<br />

vMember.width = 128;<br />

vMember.height = 256;<br />

trace(vMember.rect);<br />

// <br />

Note: If you try to set the rect of a text member directly, the width of the cast member gets set, but its height remains<br />

unchanged. If you change the width and the height explicitly, then the rect of the text member is set correctly.<br />

You can even simulate editable text in an overlay. To do this, place a text sprite over the 3D sprite at the position where<br />

you want to see the text. Create an overlay containing the image of the text member inside the 3D camera view. Each<br />

time the user presses a key, update the texture that is displayed in the overlay. To see this technique in action, download<br />

the movie EditableOverlay.dir and launch it. Click in the text area and start typing.<br />

An overlay in the 3D sprite displays a texture that uses the image of an editable text member<br />

When the mouse pointer moves over the editable text sprite, the cursor changes to the text insert cursor.<br />

Note: When you click in the text sprite or make a selection, the insertion point or current selection is not displayed. You<br />

can create a more elaborate version of the Editable Overlay behavior if the insertion point information is necessary. See<br />

Manipulating text with Lingo or JavaScript syntax for more information.<br />

In the behavior extract below, pTexture is a pointer to the texture in the 3D member which is displayed in the overlay,<br />

and pTextMember is the Text member which is placed on top of the 3D sprite. This extract is found in a behavior<br />

attached to the Text sprite.<br />

on keyUp(me) ----------------------------------------------------<br />

-- ACTION: Refreshes the texture of the overlay to show the<br />

-- latest text in the editable text member. The<br />

-- overlay will update automatically.<br />

---------------------------------------------------------------<br />

pTexture.member = pTextMember<br />

end keyUp<br />

The paler rectangle around the text is created by a separate overlay.<br />

Last updated 8/26/2011<br />

117

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!