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

<tutorial>
   <description>Learn how to import a text file and bring it into Flash and be able to scroll it.</description>
   <keywords>tutorials, lesson, flash, text, scroll, scrolling, import, effect, macromedia</keywords>
   <title>Scroller</title>
   <slug>
<b>Skill Level:</b> Intermediate<br></br>
<b>Knowledge Needed:</b> Movie Clips, Buttons, Labeling<br></br>
<b>Number of Steps:</b> 9 <br></br>
<b>The Movie</b><br></br>
-----------------------------------------------<br></br>
<flash><width>475</width><height>300</height><name>scroll.swf</name></flash><br></br>
------------------------------------------------<br></br>
<link><url>scroll.fla</url>Download Flash File</link><br></br>
Learn how to make a simple scroller which can call a text or HTML file. Very useful for news updates, etc.
</slug>
 

   <step>
      <left><image><name>pict1.gif</name><width>70</width><height>125</height><alt>Picture 1</alt></image></left>
	  <stepnumber>1</stepnumber>
	  <text>Start off by starting a new movie: <b>File>New</b>. Then go to <b>Modify>Movie</b> and change the width and height to whatever your prefference might be. The one I'm making is Width: 550 Height: 400. Then create the up and down arrows as it is on the left. Then select the Up Arrow and choose <b>Insert>Convert to Symbol</b>.Name the up arrow, "Arrow 1" and the bottom arrow, "Arrow 2", both as behavior button.</text>
   </step>
   
   <step>
      <left><image><name>pict2.gif</name><width>218</width><height>119</height><alt>Picture 2</alt></image></left>
	  <stepnumber>2</stepnumber>
	  <text>Alright, next you want to Start a new layer and call it "Text". Then create a new blank keyframe in the first four frames by clicking on each frame and selecting <b>Insert>Blank Keyframe</b>. You also want to extend the frames of the arrow layer by right clicking on the fourth frame in the tipline and selecting <b>Insert Frame</b> so it looks like the figure to the left.</text>
   </step>
   
   <step>
      <left><image><name>pict3.gif</name><width>164</width><height>317</height><alt>Picture 3</alt></image></left>
	  <stepnumber>3</stepnumber>
	  <text>Right Click on the first frame on the "Text" layer in the timeline and select <b>Actions</b>. Copy and paste the following line:<![CDATA[ <pre>loadVariablesNum ("./text.txt", 0);</pre>]]> where text.txt is the text or HTML file you want to call. (You must keep the ./ however). Remember your text file needs to begin with "text=".<br></br><br></br> Go back to the timeline and rightclick the second frame on the "Text" layer and select <b>Actions</b>. On this frame Copy-Paste the following lines:<![CDATA[ <pre>if (text ne "") {
    gotoAndStop ("end");
}</pre>]]>Do the same for the third frame with the following line: <![CDATA[ <pre>gotoAndPlay ("load");</pre>]]>And finally have the fourth and last frame say: <![CDATA[ <pre>stop ();</pre>]]></text>
   </step>
   
   <step>
      <left><image><name>pict4.gif</name><width>218</width><height>156</height><alt>Picture 4</alt></image></left>
	  <stepnumber>4</stepnumber>
	  <text>Alright, on the second frame in the timeline on the "Text" layer, go to the Frame box and name it "load" as it is displayed on the figure on the left. Do the same thing for the fourth frame, except name is "end".</text>
   </step>
   
   <step>
      <left><link><url>pict5.gif</url><image><name>pict5a.gif</name><width>207</width><height>66</height><alt>Picture 5</alt></image></link></left>
	  <stepnumber>5</stepnumber>
	  <text>Click on the fourth frame on the text layer, and choose <b>Insert>New Symbol</b> and name it "uptrigger" with behavior as a <b>Movie Clip</b>. Once inside the movie clip, make three blank keyframes on the first three frames of the layer. Go to the first frame <b>Actions</b> like we did earlier in Step 3, and put in the following code:<![CDATA[ <pre> stop ();</pre>]]>Go to the second frame <b>Actions</b> and place this:<![CDATA[ <pre>/text:scroll = Number(/text:scroll)-1;</pre>]]>Finally on the last third frame, place this code: <![CDATA[ <pre>gotoAndPlay (2);</pre>]]> (You can click on the left image to see a larger version:)</text>
   </step>
   
   <step>
      <left><link><url>pict6.gif</url><image><name>pict6a.gif</name><width>207</width><height>66</height><alt>Picture 6</alt></image></link></left>
	  <stepnumber>6</stepnumber>
	  <text>Go Back to the main movie by clicking on the "Scene 1" text on the top left corner. Now, Click on the fourth frame on the text layer, and choose <b>Insert>New Symbol</b> and name it "downtrigger" with behavior as a <b>Movie Clip</b>.Once inside the movie clip, make three blank keyframes on the first three frames of the layer. Go to the first frame <b>Actions</b> like we did earlier in Step 5, and put in the following code: <![CDATA[ <pre> stop ();</pre>]]>Go to the second frame <b>Actions</b> and place this:<![CDATA[ <pre>/text:scroll = Number(/text:scroll)+1;</pre>]]>Finally on the last third frame, place this code: <![CDATA[ <pre>gotoAndPlay (2);</pre>]]> (You can click on the left image to see a larger version:)</text>
   </step>
   
   <step>
      <left><image><name>pict7.gif</name><width>218</width><height>156</height><alt>Picture 7</alt></image></left>
	  <stepnumber>7</stepnumber>
	  <text>Alright, now go back to the main movie by clicking on the "Scene 1" on the top left and, while on the fourth frame, click on <b>Window>Library</b> to show the Library. You should see "Uptrigger" and "Downtrigger" in there. Click and Drag both of them onto the movie somewhere, it does not matter where. For all purposes, put the uptrigger by the up arrow, and down trigger by the down arrow. You should see a white dot whereever you placed them. Click on the "Uptrigger" white dot and go into the Instance Property and name it "uptrigger". Then click on the "Downtrigger" dot and in the Instance propert, name it "downtrigger".</text>
   </step>
   
   <step>
      <left><image><name>pict8.gif</name><width>218</width><height>156</height><alt>Picture 8</alt></image></left>
	  <stepnumber>8</stepnumber>
	  <text>Finally, click on the text tool <image><name>../general/text.gif</name><width>25</width><height>24</height></image>, and click on where you want the top left text area to be. Then on the Text Property, set it up as it is on the left figure. After you have it set up like that, use the circle on the bottom right corner of the text area to drag it as big as you want it to be.</text>
   </step>
   
   <step>
      <left> </left>
	  <stepnumber>9</stepnumber>
	  <text>Right click on your up arrow button and copy-paste this code: <![CDATA[ <pre>on (press) {
    tellTarget ("uptrigger") {
        gotoAndPlay (2);
    }
}
on (release, releaseOutside) {
    tellTarget ("uptrigger") {
        gotoAndStop (1);
    }
}
</pre>]]>And then go to the down Arrow and place this code: <![CDATA[ <pre>on (press) {
    tellTarget ("downtrigger") {
        gotoAndPlay (2);
    }
}
on (release, releaseOutside) {
    tellTarget ("downtrigger") {
        gotoAndStop (1);
    }
}
</pre>]]>One last thing, on the Text file, remember to start it off by saying "text=" and that it is in the same folder as the flash. Voila, you're done :)</text>
   </step>
   
</tutorial>


