{"id":11315,"date":"2011-10-14T03:38:14","date_gmt":"2011-10-14T07:38:14","guid":{"rendered":"http:\/\/info.template-help.com\/?p=11315"},"modified":"2020-02-06T09:11:33","modified_gmt":"2020-02-06T14:11:33","slug":"flashxml-flash-how-to-create-a-scroll-using-as3","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/flashxml-flash-how-to-create-a-scroll-using-as3.html","title":{"rendered":"Flash\/XML Flash. How to create a scroll using AS3"},"content":{"rendered":"<p>This  tutorial will teach you how to add a Scroll in Flash and\/or XML Flash template  in Action Script 3.<\/p>\r\n\r\n<!--more-->\r\n\r\n<p>1. Open the .FLA file, located in the &lsquo;sources\/flash&rsquo; folder of your  downloaded archive.<\/p>\r\n\r\n<p>2. Locate the &lsquo;pages&rsquo; movie clip and navigate to the Page in to which you  need to add a scroll function.<\/p>\r\n\r\n<a href=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_1.jpg\"><img loading=\"lazy\" src=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_1-300x187.jpg\" alt=\"\" title=\"scroll_1\" width=\"300\" height=\"187\" class=\"aligncenter size-medium wp-image-11316\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_1-300x187.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_1-1024x640.jpg 1024w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_1.jpg 1165w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n\r\n<p class=\"attention\">NOTE: if  you are editing the XML Flash template, you need to remove the dynamic text  script, as we will not need it. Then Navigate to the action script layer (layer  3, frame 3 in this example), press F9 key to open the action script panel and remove  the dynamic text script.<\/p>\r\n\r\n<a href=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_2.jpg\"><img loading=\"lazy\" src=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_2-300x78.jpg\" alt=\"\" title=\"scroll_2\" width=\"300\" height=\"78\" class=\"aligncenter size-medium wp-image-11317\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_2-300x78.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_2.jpg 845w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n\r\n<p>3. Click on the text box on the Scene to select and change the Dynamic Text  to Input Text in the properties panel.<\/p>\r\n\r\n<p>4. Name this text field &#8216;scrollText&#8217;<\/p>\r\n\r\n<a href=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_3.jpg\"><img loading=\"lazy\" src=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_3-300x260.jpg\" alt=\"\" title=\"scroll_3\" width=\"300\" height=\"260\" class=\"aligncenter size-medium wp-image-11318\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_3-300x260.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_3.jpg 840w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n  \r\n<p>5. Navigate to the timeline and insert a new layer. We will name it &lsquo;line&rsquo;<\/p>\r\n\r\n<p>6. On the Scene, draw a line and convert it into a movie clip.<\/p>\r\n\r\n<a href=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_4.jpg\"><img loading=\"lazy\" src=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_4-300x239.jpg\" alt=\"\" title=\"scroll_4\" width=\"300\" height=\"239\" class=\"aligncenter size-medium wp-image-11319\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_4-300x239.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_4.jpg 909w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n  \r\n<p>7. Insert another layer in the timeline. We will name it &lsquo;scrollMC&rsquo;<\/p>\r\n\r\n<a href=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_5.jpg\"><img loading=\"lazy\" src=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_5-239x300.jpg\" alt=\"\" title=\"scroll_5\" width=\"239\" height=\"300\" class=\"aligncenter size-medium wp-image-11320\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_5-239x300.jpg 239w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_5.jpg 413w\" sizes=\"(max-width: 239px) 100vw, 239px\" \/><\/a>\r\n  \r\n<p>8. Draw a rectangle and convert the rectangle into a movie clip. Give it an  instance name of &lsquo;scrollMC&rsquo; .<\/p>\r\n\r\n<a href=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_6.jpg\"><img loading=\"lazy\" src=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_6-300x236.jpg\" alt=\"\" title=\"scroll_6\" width=\"300\" height=\"236\" class=\"aligncenter size-medium wp-image-11321\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_6-300x236.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_6.jpg 924w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n  \r\n<p>9. Insert another layer in the time line for the Action Script. Press F9  key to open the AS panel, so we can add script.<\/p>\r\n\r\n<a href=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_7.jpg\"><img loading=\"lazy\" src=\"http:\/\/info.template-help.com\/wp-content\/uploads\/2011\/10\/scroll_7-300x86.jpg\" alt=\"\" title=\"scroll_7\" width=\"300\" height=\"86\" class=\"aligncenter size-medium wp-image-11322\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_7-300x86.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/10\/scroll_7.jpg 665w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n  \r\n<p>10. We will assign some text to the scrollText text field. We want it to be multiline and wrap text:<\/p>\r\n\r\n<pre class=\"brush:as3\">\r\n\tvar someText:String = \"New Text Here,\" + \"Another New Text here\";\r\n  \r\n\tscrollText.text = someText;\r\n\tscrollText.multiline = true;\r\n\tscrollText.wordWrap = true;\r\n<\/pre>\r\n\r\n  \r\n<p class=\"attention\">NOTE:  insert your text in this manner: &ldquo; Your text here&rdquo; + &ldquo; Another new text here &rdquo;  ;<\/p>\r\n\r\n<p>11. Now, we will add the scrolling functionality to the scrollbar:<\/p>\r\n\r\n<pre class=\"brush:as3\">\r\nvar bounds:Rectangle = new Rectangle(scrollMC.x, scrollMC.y, 0, 200);\r\nvar scrolling:Boolean = false;\r\n \r\nfunction startScroll (e:Event):void {\r\n\tscrolling = true;\r\n\tscrollMC.startDrag (false,bounds);\r\n}\r\n \r\nfunction stopScroll (e:Event):void {\r\n\tscrolling = false;\r\n\tscrollMC.stopDrag ();\r\n}\r\n \r\nscrollMC.addEventListener (MouseEvent.MOUSE_DOWN, startScroll);\r\nstage.addEventListener (MouseEvent.MOUSE_UP, stopScroll);\r\n<\/pre>\r\n\r\n\r\n<p>12. Now, we will make the scrollMC to scroll the text: <\/p>\r\n\r\n<pre class=\"brush:as3\">\r\n\r\n addEventListener (Event.ENTER_FRAME, enterHandler);\r\n \r\n       function enterHandler (e:Event):void {\r\n\tif (scrolling == true) {\r\n\tscrollText.scrollV = Math.round(((scrollMC.y - bounds.y)\/200)*scrollText.maxScrollV);\r\n\t}\r\n}\r\n\r\n<\/pre>\r\n\r\n  <p>13. Press CTRL+ENTER or File-&gt;Publish Preview-&gt;Flash<\/p>\r\n\r\n<p>&nbsp;<\/p>\r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\nFlash\/XML Flash. How to create a scroll using AS3","protected":false},"excerpt":{"rendered":"<p>This tutorial will teach you how to add a Scroll in Flash and\/or XML Flash template in Action Script 3.<\/p>\n","protected":false},"author":12,"featured_media":11327,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[742,279,287,760],"tags":[1070,486,528,570],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/11315"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=11315"}],"version-history":[{"count":2,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/11315\/revisions"}],"predecessor-version":[{"id":86392,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/11315\/revisions\/86392"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/11327"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=11315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=11315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=11315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}