<?xml version="1.0" encoding="utf-8"?>

<tutorial>
   <description>Learns the different action scripts you can do to modify a movie clip such as move, stretch, fade, rotate and more.</description>
   <keywords>tutorials, lesson, flash, text, movie, clip, rotate, x scale, y scale, functions, movies, tell target, alpha, skin, animated, free, button, effect, macromedia</keywords>
   <title>Movie Functions</title>
   <slug>
<b>Skill Level:</b> Intermediate<br></br>
<b>Knowledge Needed:</b> Movie Clips, Actionscripting<br></br>
<b>Number of Steps:</b> 5 <br></br>
<b>The Movie</b><br></br>
-----------------------------------------------<br></br>
<flash><width>650</width><height>400</height><name>movie_functions.swf</name></flash><br></br>
------------------------------------------------<br></br>
<link><url>movie_functions.fla</url>Download Flash File</link><br></br>
</slug>
 

   <step>
      <left><link><url>pict1.gif</url><image><name>pict1a.gif</name><width>218</width><height>69</height><alt>Picture 1</alt></image></link></left>
	  <stepnumber>1</stepnumber>
	  <text>First what you need to do is make or import your graphic which you want to mutilate. Select the image, then make a new movie clip by going to <b>Insert>Convert To Symbol</b>. Select "movie clip" and name it anything you would like, I called mine "logo". (You can click the image on the left to get a larger view.)</text>
   </step>
   
   <step>
      <left><image><name>pict2.gif</name><width>217</width><height>155</height><alt>Picture 2</alt></image></left>
	  <stepnumber>2</stepnumber>
	  <text>Select the movie clip which you made, and go to the Instance tab, similar to what it looks like on the left. Name it "box". Then, go to the top of the screen on top to the timeline, right click on the first frame, and choose "Actions". In there, write the following code, you can copy paste it if you would like:<![CDATA[ <pre>
tellTarget ("box") {
    ..:x = _x;
    ..:rotation = _rotation;
    ..:y = _y;
    ..:alpha = _alpha;
    ..:xscale = _xscale;
    ..:yscale = _yscale;
} </pre> ]]> 
</text>
   </step>
   
   <step>
      <left><image><name>pict3.gif</name><width>218</width><height>156</height><alt>Picture 3</alt></image></left>
	  <stepnumber>4</stepnumber>
	  <text>The next thing you want to do is make the funky buttons for the up and down arrows. Mine are really basic ones, but you can get intricate and make them neat looking =p. After you're done making them, select the up arrow, and go to <b>Insert>Convert to Symbol</b>. Name it "up" and make behavior as a button. Go back and select the down arrow and again go to <b>Insert>Convert to Symbol</b>, name it "down" with behavior as a button.</text>
   </step>
   
   <step>
      <left><image><name>pict4.gif</name><width>175</width><height>124</height><alt>Picture 4</alt></image></left>
	  <stepnumber>3</stepnumber>
	  <text>Now, right click the "up" button and select "Actions". Write in or copy-paste the following code:
	  <![CDATA[ <pre>
on (release) {
    tellTarget ("box") {
        _x+=10;
        ..:x = _x;
    }
}
 </pre> ]]> 
Go back, and right click on the "down"button and select "Actions". Write in or copy-paste the following code:
<![CDATA[ <pre>
on (release) {
    tellTarget ("box") 
        _x-=10;
        ..:x = _x;
    }
} </pre> ]]> </text>
   </step>
   
      <step>
      <left><image><name>pict5.gif</name><width>218</width><height>156</height><alt>Picture 5</alt></image></left>
	  <stepnumber>5</stepnumber>
	  <text>The last step sets up moving the box to the left and to the right. If you want to do other effects like move it up and down, rotate, etc, repeat step 3 to make the button, and then plug in the following codes for each respective effect:<br /><br />
Moving Code: Up Arrow Code:
<![CDATA[ <pre>
	on (release) {
    tellTarget ("box") {
        _y-=10;
        ..:y = _y;
    }
}
	</pre> ]]>
	Down Arrow Code:
	<![CDATA[ <pre>
	on (release) {
    tellTarget ("box") {
        _y+=10;
        ..:y = _y;
    }
}
	</pre> ]]> 
	Rotating clockwise and counterclockwise:	
	Up Arrow Code:
<![CDATA[ <pre>
	on (release) {
    tellTarget ("box") {
        _rotation+=10;
        ..:rotation = _rotation;
    }
}
	</pre> ]]> 
	
	Down Arrow Code:
	<![CDATA[ <pre>
	on (release) {
    tellTarget ("box") {
        _rotation-=10;
        ..:rotation = _rotation;
    }
}
</pre> ]]> 


	Increase and Decrease the Width:	
	Up Arrow Code:
	<![CDATA[ <pre>
	on (release) {
    tellTarget ("box") {
        _xscale+=10;
        ..:xscale = _xscale;
    }
}
	
	</pre> ]]>
	Down Arrow Code:
	<![CDATA[ <pre>
	on (release) {
    tellTarget ("box") {
        _xscale-=10;
        ..:xscale = _xscale;
    }
}
</pre> ]]>

	Increase and Decrease the Height:	
	Up Arrow Code:
	<![CDATA[ <pre>
	on (release) {
    tellTarget ("box") {
        _yscale+=10;
        ..:yscale = _yscale;
    }
}
	</pre> ]]>
	
	Down Arrow Code:
	<![CDATA[ <pre>
	on (release) {
    tellTarget ("box") {
        _yscale-=10;
        ..:yscale = _yscale;
    }
}
</pre> ]]> 


	Increase and Decrease the Alpha/Opacity:	
	Up Arrow Code:
	<![CDATA[ <pre>
	on (release) {
    tellTarget ("box") {
        if (_alpha+10&lt;100) {
            _alpha+=10;
            ..:alpha = _alpha;
        }
    }
}
	</pre> ]]>
	
	Down Arrow Code:
	<![CDATA[ <pre>
on (release) {
    tellTarget ("box") {
        if (_alpha-10>0) {
            _alpha-=10;
            ..:alpha = _alpha;
        }
    }
}
</pre> ]]> 
Whew, that was tiresome but your "box" should be fully functional and ready to go now. If you want to display the values like I did on the bottom right, just make a dynamic text box, and define the variables as: x, y, rotation, xscale, yscale, and alpha respectively. Hope this tutorial helps in explaining the vast functions of movies and if you need any help, just drop us an e-mail in the contact section.</text>
   </step>
   
</tutorial>






