Return to Homepage

Session 22 Lesson Plan

Badge Check
Register

What is covered in this session

Using Listeners - Making buttons out of non-button objects

Simple If controls

Suppose you want an object ( but not a button) to react to something that uis happening in your flash movie. The try this code:

myTextField_txt.onMouseDown = function()
{
myTextField_txt.text="Hello Folks";
}

myTextField_txt will react when the mouse button is pressed

The onMouseDown event is not a standard thing for a text field to react to. To activate it we also add the following code

Mouse.addListener(myTextField);

The operation can then be carried out. If you no longer require the action to happen then the following code has to be added:

Mouse.removeListener(myTextField);

Simple if controls

onClipEvent(mouseMove)
{
if (_root.trackMouse == true)
{
_root.power=_root._xmouse + 1;
}
else
{
_root.power = _root._xmouse - 1;
}
}

More Complex if Control Source Code

Simple mouse control Philips Pointer

Mouse Control

 

 

Homework