RSS
 

Archive for the ‘Director’ Category

Play Head Wait

24 Aug

When I had just begun using Director I thought the only way to get a vid to play full length was to stretch its frames ’til the end in the Score layer. This was very tedious and I wondered to myself how much do I have to stretch the movie frames ’til I reach the end. Surely, I knew there was another way. Thankfully, there is and I’ve brought this simple tutorial to you to avoid silly notions, like my initial one. ;) This tutorials presents you code which allows the play head to wait until the entire digital video has played. After which, the play head will jump to the next frame of marker specified.

Open your Director movie add the following code/script to your quicktime movie.


property thisSprite
property thisMember
property  thisDuration
on beginsprite me
--define what you're dealing with (channel)
thisSprite = me.spriteNum
thisMember = sprite(thisSprite).member.name
thisDuration = member(thisMember).duration
end
on exitFrame me
if sprite(thisSprite).movieTime >=thisDuration then
--video is done playing; now go to place specified  in brackets
_movie.go("gohere")
end if
end

You can see that the code above has three properties.

thisSprite is a representation of the channel in which the sprite (vid) was placed. thisSprite can be seen as a variable which holds the channel number of the sprite in its memory
cell. It’s not ‘needed’, you could have had these lines instead:

thisMember = sprite(me.spriteNum).member.name
if sprite(me.spriteNum).movieTime>= thisDuration then

As you can see, me.spriteNum replaces where thisSprite once was. thisSprite is a property or variable that holds the value of me.spriteNum.

thisMember represents a cast member within the cast member library

This line : sprite(me.spriteNum).member.name represents the member name as well as its properties (file type). It could have been replaced with the following:

member(“quicktimevid”)

thisMember = member("quicktimevid")

The difference between lines 1 in snippet 2 and 3, is that snippet 2 makes use of the dot operator and one needs not know the name/label of the file or member.

thisDuration represents the duration or play time of the digital video.

In snippet 2, code line labeled 2 is where the main decision is made based on certain conditions. All line 2 states is: if quicktime video play time is equal to its total duration then
In this case, once the statement is true, the next statement is executed.

Alrighty, the code has been briefly explained. I now request that you download this document. Check out the structure and observe what the code does.

Please note the defined behavior movie controller in the Behavior Channel. It is very important. Without it, the play head would skip to the next frame without playing the full movie and the code we spoke of above would never ‘work’. Try removing it to see what happens. Goes right through, huh? The markers label where the play head should jump to after the digital movie has been played in its entirety. Notice, that I defined two markers. You can actually see the ‘jump’ by my doing so as after the movie is played the play head skips all the frames between movie controller behavior and t marker. The obedient play head didn’t even stop to show off what’s happening with marker d. If you wanted the play head to move to another marker, say d marker, simply change this line:

_movie.go(“t”)

Replace t with d. That’s all it takes. Simple huh?

Happy camping!!

 
No Comments

Posted in Director

 

Custom Controls for WMV Videos

24 Aug

Adobe Director doesn’t offer a video controller for *.wmv videos like it does for *.mov videos. So we have to create our own controls.

All you need to do is add the needed codes to your sprites, that is your text, image or buttons that may control (pause, stop, play, rewind) the video.

The following stops the video from play and sets the playtime of the video to 0. Thus the video will begin from the start when the play ‘button’ is again.

on mouseUp me
sprite("video").stop()
end

This begins playtime for the video.

on mouseUp me
sprite("video").play()
end

The following pauses the video and the playtime is not reset. Thus, once the play ‘button’ is used again the video will continue to play where it was paused.

on mouseUp me
sprite("video").pause()
end

This resets the playtime of the video and thus the video once again re-starts.

on mouseUp me
sprite("video").rewind()
end

For all codes above, one needed not use the mouseUp handlers. If you wanted a video to begin playing/to stop/to rewind or to pause once the cursor is in a particular region, then you could have used the
handler:

on mouseWithin me

Also, do note that you didn’t have to use the sprite name video as in the line sprite(“video”)... You could simply use the channel number in which the movie sprite
is located.

 
No Comments

Posted in Director

 

Text Style Rollover!!!

24 Aug

In Macromedia Director, I mean Adobe, there are two main forms of text which you can add to your movies and even add various interactivity to these text types. These are regular and field text. Briefly, regular
text allows for paragraph formatting, kerning, line spacing and other functions found within the Text Inspector menu. On the other hand field text

“is standard text controlled by your system software, the same as the text you see in dialog boxes

and menu bars. Director does not anti-alias field text or support paragraph formatting and tabs for fields”

Basically, regular text has the advantage of the features offered by the Text inspeactor allowing for various formatting. However, it is best suited for large types. On the contrary, field text
is best suited to create the smallest possible text cast members that don’t need to be anti-aliased.

To add regular text, simply:

1. Left click on your text tool within Director, it resembles an ‘A’. Then left click again onto your stage. You may now edit the text to your liking.

or

2. Go to Insert>Media Element>Text

To create rollover on the regular text add the following script piece(s) to the cast member.

on mouseEnter
member("text").fontStyle = [#bold,#italic,#underline] --style change
member("text").forecolor = 3 --changes the colour of text
member("text").fontSize = 20
end
on mouseLeave
member("text").fontStyle = [#plain]
member("text").forecolor = 50 --changes text to some other colour
member("text").fontSize = 14 --changes size of font
end

or..

on mouseWithin me
member("text").fontStyle = [#bold,#italic,#underline]--style change
member("text").forecolor = 3 --changes the colour of text
member("text").fontSize = 20
end
on mouseLeave
member("text").fontStyle = [#plain]
member("text").forecolor = 50 --changes text to some other colour
member("text").fontSize = 14
--changes size of font
end

That’s it!

 
No Comments

Posted in Director

 

Adding Sounds to Objects

20 Aug

Being an awesome multimedia program as it is, Adobe Director allows us to add sounds to various objects. For instance, we can add our own little sounds to buttons and the like. Adding a sound to an element is as easy as counting your fingers. All you need is basic code which you can re-use day in and day out. [The wonderful nature of programming] :-) . So let’s add some sounds, in this tut, we’ll just add the sound to a simple button.

Load Adobe D and then add the following code to your object (text, button, image).

on mouseEnter
sound(2).play(member("button"))
end

This code added to your object named ‘button’, plays the sound in channel 2 whenever the cursor or mouse enters the area of the object. Naturally, you could have had these handlers instead:

on mouseUp --plays sound whenever object is clicked
sound(2).play(member("button"))
end

or

on mouseWithin me  --plays sound as long as cursor remains
sound(2).play(member("button"))
end
 
No Comments

Posted in Director