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 />

If you need to make several changes to the same overlay, you need to refer to camera.overlay[layerIndex] (Lingo)<br />

or camera.getPropRef("overlay", layerIndex) (JavaScript) each time.<br />

The following example below adds a new overlay, determines which layer the overlay was added to, and sets the scale,<br />

regPoint and blend properties of the new overlay:<br />

-- Lingo<br />

v3DSprite = sprite(1)<br />

v3DMember = v3DSprite.member<br />

vCamera = v3DSprite.camera<br />

vTexture = v3DMember.texture(2)<br />

vLoc = point(50, 50)<br />

vRotation = 90<br />

vCamera.addOverlay(vTexture, vLoc, vRotation)<br />

vIndex = vCamera.overlay.count<br />

vCamera.overlay[vIndex].scale = 0.5<br />

vCamera.overlay[vIndex].regPoint = (vTexture.member).regPoint<br />

vCamera.overlay[vIndex].blend = 25 -- %<br />

// JavaScript<br />

v3DSprite = sprite(1);<br />

v3DMember = v3DSprite.member;<br />

vCamera = v3DSprite.camera;<br />

vTexture = v3DMember.getPropRef("texture", 2);<br />

vLoc = point(50, 50);<br />

vRotation = 90;<br />

vCamera.addOverlay(vTexture, vLoc, vRotation);<br />

vIndex = vCamera.count("overlay");<br />

vCamera.getPropRef("overlay", vIndex).scale = 0.5<br />

vCamera.getPropRef("overlay", vIndex).regPoint = (vTexture.member).regPoint<br />

vCamera.getPropRef("overlay", vIndex).blend = 25;<br />

Note: The expression (vTexture.member).regPoint gives an error if parentheses are not used.<br />

Finding a particular layer<br />

There is no built-in method for keeping track of which layer contains a given overlay. If you use overlays and<br />

backdrops intensively, you can create your own “layer manager” scripts. For less intensive use, where the only one layer<br />

uses a particular texture, you can use a handler such as this:<br />

-- Lingo<br />

on GetOverlayIndex(aCamera, aTexture) --------------------------<br />

-- INPUT: must be a 3D camera object<br />

-- must be a texture object<br />

-- OUTPUT: Returns the index number of the topmost overlay<br />

-- that contains the given texture<br />

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

ii = aCamera.overlay.count<br />

repeat while ii<br />

if aCamera.overlay[ii].source = aTexture then<br />

exit repeat<br />

end if<br />

ii = ii - 1<br />

end repeat<br />

return ii<br />

end GetOverlayIndex<br />

Last updated 8/26/2011<br />

115

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

Saved successfully!

Ooh no, something went wrong!