
{"id":428,"date":"2008-08-13T09:00:45","date_gmt":"2008-08-13T08:00:45","guid":{"rendered":"http:\/\/www.matthijskamstra.nl\/blog\/?p=428"},"modified":"2008-06-13T12:31:38","modified_gmt":"2008-06-13T11:31:38","slug":"object-to-layer-jsfl","status":"publish","type":"post","link":"https:\/\/www.matthijskamstra.nl\/blog\/2008\/08\/13\/object-to-layer-jsfl\/","title":{"rendered":"Object 2 Layer jsfl"},"content":{"rendered":"<p>For a project of mine: <a href=\"http:\/\/www.matthijskamstra.nl\/blog\/index.php\/category\/design\/custmm-grumm-design\/\">Custmm Grumm<\/a> I needed to change a shape into an array (explained in this post <a href=\"http:\/\/www.matthijskamstra.nl\/blog\/index.php\/2008\/06\/16\/shape-2-array-jsfl\/\">shape 2 array jsfl<\/a> ).<\/p>\n<p>To make this happen I imported the .AI file (Illustrator) to the stage. But it will place everything on one layer, every shape it&#8217;s own &#8216;group&#8217; and the script I wrote (<a href=\"http:\/\/www.matthijskamstra.nl\/blog\/index.php\/2008\/06\/16\/shape-2-array-jsfl\/\">shape 2 array jsfl<\/a>), needs every shape on one layer.<br \/>\n<a href='http:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/importaiintoflash.jpg'><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/importaiintoflash-300x227.jpg\" alt=\"Flash import screen\" title=\"Import .AI into Flash\" width=\"300\" height=\"227\" class=\"alignnone size-medium wp-image-427\" srcset=\"https:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/importaiintoflash-300x227.jpg 300w, https:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/importaiintoflash.jpg 766w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>So here a script that, as long the different shape are still group individually, will give every shape it&#8217;s own layer.<\/p>\n<div class='highlight'><strong>Update #1:<\/strong> This script is not only useful in this project, in every project where you have a lot of objects that need there own layer, this is the JSFL for you!<br \/>\nRemember if you need to animate an movieclip, it needs to have it&#8217;s own layer (timeline)<\/div>\n<blockquote><p>\nNeed a lot of item on there own layer (own timeline) in Flash, don&#8217;t copy past it one by one, but just use this JSFL\n<\/p><\/blockquote>\n<p>Not sure how to call this script when you save it: &#8220;<strong>[mck] object2layer.jsfl<\/strong>&#8221;<br \/>\n[as]<br \/>\n\/**<br \/>\n* Object2Layer, version 1.1<br \/>\n*<br \/>\n* select an item on the timeline and convert it to a layer<br \/>\n*<br \/>\n* <\/p>\n<pre>\r\n*  ____                   _      ____\r\n* |  __| _ __ ___    ___ | | __ |__  |\r\n* | |   | '_ ` _ \\  \/ __|| |\/ \/    | |\r\n* | |   | | | | | || (__ |   <     | |\r\n* | |__ |_| |_| |_| \\___||_|\\_\\  __| |\r\n* |____|                        |____|\r\n*\r\n* <\/pre>\n<p>*<br \/>\n* @author\t\t\tMatthijs C. Kamstra [mck]<br \/>\n* @version\t\t\t1.1<br \/>\n* @since\t\t\tFri Jun 01 19:43:37 2007<br \/>\n* @langversion: \tActionScript 2.0 \/ 3.0<br \/>\n*<br \/>\n* Changelog:<br \/>\n* \t\tv 1.0 [2007-06-01] - Initial release<br \/>\n* \t\tv 1.1 [2008-03-20] - Change jsfl name; multiple item at once<br \/>\n*\/<\/p>\n<p>var versionString = '1.1'; <\/p>\n<p>var currentDoc = fl.getDocumentDOM ();<br \/>\nvar timeline = fl.getDocumentDOM ().getTimeline ();<br \/>\nvar curLayer = fl.getDocumentDOM ().getTimeline ().currentLayer;<br \/>\nvar curFrame = fl.getDocumentDOM ().getTimeline ().currentFrame;<br \/>\nvar selectionArray = currentDoc.selection;<\/p>\n<p>\/\/ check if something is selected<br \/>\nif (selectionArray.length == 0){<br \/>\n\talert ('nothing selected')<br \/>\n} else {<br \/>\n\tfl.getDocumentDOM().distributeToLayers();<br \/>\n}<br \/>\n\/\/ end<br \/>\n[\/as]<\/p>\n<p>have fun :)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For a project of mine: Custmm Grumm I needed to change a shape into an array (explained in this post shape 2 array jsfl ). To make this happen I imported the .AI file (Illustrator) to the stage. But it will place everything on one layer, every shape it&#8217;s own &#8216;group&#8217; and the script I [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,3],"tags":[68,162,165,95,29,166,167,163],"class_list":["post-428","post","type-post","status-publish","format-standard","hentry","category-extending-flash","category-flash","tag-actionscript","tag-array","tag-different-shape","tag-illustrator","tag-jsfl","tag-movieclip","tag-object","tag-shape"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/comments?post=428"}],"version-history":[{"count":0,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/428\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/media?parent=428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/categories?post=428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/tags?post=428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}