{"id":953,"date":"2012-06-10T13:46:26","date_gmt":"2012-06-10T11:46:26","guid":{"rendered":"https:\/\/porzelt.net\/?p=953"},"modified":"2019-10-04T16:11:35","modified_gmt":"2019-10-04T16:11:35","slug":"making-the-game-teil-12-die-grafikbibliothek","status":"publish","type":"post","link":"https:\/\/porzelt.net\/en\/making-the-game-teil-12-die-grafikbibliothek","title":{"rendered":"Making The Game \u2013 Teil 12: Die Grafikbibliothek"},"content":{"rendered":"<p>Since graphical objects, such as the buttons on the menus and background images, are used multiple times and in different areas in the program a central location that provides the graphics is essential. The so-called library can be created in Flash decoupled from the actual project and edited independently of the program.<br \/>\nLibraries in Flash are marked ba the extension *.swc. These also include, in addition to graphics, functions which are already compiled. By providing compiled objects the calculation.<\/p>\n<figure id=\"attachment_958\" style=\"width: 131px\"  class=\"wp-caption alignright\"><a href=\"http:\/\/cryptedchat.de\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-13-um-23.12.00.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/cryptedchat.de\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-13-um-23.12.00-131x300.png\" alt=\"Elements of the outsourced graphics library\" title=\"Elements of the outsourced graphics library\" width=\"131\" height=\"300\" class=\"size-medium wp-image-958\" srcset=\"https:\/\/porzelt.net\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-13-um-23.12.00-131x300.png 131w, https:\/\/porzelt.net\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-13-um-23.12.00-230x526.png 230w, https:\/\/porzelt.net\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-13-um-23.12.00.png 304w\" sizes=\"(max-width: 131px) 100vw, 131px\" \/><\/a><figcaption class=\"wp-caption-text\">Elements of the outsourced graphics library<\/figcaption><\/figure>\n<p>In practice the separation of code and graphical elements are used to that graphic designers and programmers can work simultaneously on a project. Once the graphics are changed they can be replaced by providing a new version of the library, without changing the program code. But even in small projects libraries are meaningful.<br \/>\n&nbsp;<br \/>\n<strong>How to create a library in flash?<\/strong><br \/>\nLibraries are created like normal projects in Flash. After all the necessary graphics were created as usual, it should be checked that the option &#8220;Export for ActionScript&#8221; is enabled. Through the &#8220;Export for ActionScript&#8221;-option  objects can be dynamically created.<br \/>\n&nbsp;<br \/>\nAfter all the components has been created it has to be published as a library. This setting is made in the &#8220;Publish Settings&#8221; (File \u2192 Publish Settings). Check the setting &#8220;SWC&#8221; (see illustration). The generated *.swc-file includes all graphics and functions.<br \/>\n&nbsp;<\/p>\n<figure id=\"attachment_961\" style=\"width: 300px\"  class=\"wp-caption aligncenter\"><a href=\"http:\/\/cryptedchat.de\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-14-um-13.58.58.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/cryptedchat.de\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-14-um-13.58.58-300x122.png\" alt=\"Publish settings in Flash\" title=\"Publish settings in Flash\" width=\"300\" height=\"122\" class=\"size-medium wp-image-961\" srcset=\"https:\/\/porzelt.net\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-14-um-13.58.58-300x122.png 300w, https:\/\/porzelt.net\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-14-um-13.58.58-230x94.png 230w, https:\/\/porzelt.net\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-14-um-13.58.58-350x143.png 350w, https:\/\/porzelt.net\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-14-um-13.58.58-480x196.png 480w, https:\/\/porzelt.net\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-14-um-13.58.58.png 557w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption class=\"wp-caption-text\">Publish settings in Flash<\/figcaption><\/figure>\n<p>&nbsp;<br \/>\n<strong>How to use a library in flash?<\/strong><\/p>\n<figure id=\"attachment_962\" style=\"width: 150px\"  class=\"wp-caption alignright\"><a href=\"http:\/\/cryptedchat.de\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-13-um-23.13.07.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/cryptedchat.de\/wp-content\/uploads\/2012\/06\/Bildschirmfoto-2012-03-13-um-23.13.07-150x150.png\" alt=\"Menu 'Advanced ActionScript 3.0 Settings'\" title=\"Menu 'Advanced ActionScript 3.0 Settings'\" width=\"150\" height=\"150\" class=\"size-thumbnail wp-image-962\"><\/a><figcaption class=\"wp-caption-text\">Menu 'Advanced ActionScript 3.0 Settings'<\/figcaption><\/figure>\n<p>To use the created objects from a library in your code, the library has to be included in the current project. First you have to open the &#8220;Advanced ActionScript 3.0 Settings&#8221; (\u2192 File ActionScript settings). Click the &#8220;+&#8221; icon to add the library. The number of libraries used is not limited.<br \/>\n&nbsp;<br \/>\nThe objects in the library are from this point on accessible like local elements (see code), but can, without the actual library project, not be edited anymore.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<div class=\"actionscript3\">\n<ol>\n<li class=\"li1\">\n<div class=\"de1\">&nbsp;<span class=\"kw2\">var<\/span> langDE<span class=\"sy0\">:<\/span><span class=\"kw5\">MovieClip<\/span> = <span class=\"kw1\">new<\/span> germanFlag350<span class=\"br0\">(<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><\/div>\n<\/li>\n<li class=\"li1\">\n<div class=\"de1\">&nbsp;langDE<span class=\"sy0\">.<\/span><span class=\"kw7\">name<\/span> = <span class=\"st0\">&#8220;langDE&#8221;<\/span><span class=\"sy0\">;<\/span><\/div>\n<\/li>\n<li class=\"li1\">\n<div class=\"de1\">&nbsp;langDE<span class=\"sy0\">.<\/span><span class=\"kw7\">x<\/span> = <span class=\"br0\">(<\/span><span class=\"kw7\">stage<\/span><span class=\"sy0\">.<\/span><span class=\"kw7\">stageWidth<\/span><span class=\"sy0\">\/<\/span><span class=\"nu0\">2<\/span><span class=\"br0\">)<\/span> <span class=\"sy0\">&#8211;<\/span> <span class=\"nu0\">360<\/span> <span class=\"sy0\">&#8211;<\/span> <span class=\"nu0\">100<\/span><span class=\"sy0\">;<\/span><\/div>\n<\/li>\n<li class=\"li1\">\n<div class=\"de1\">&nbsp;langDE<span class=\"sy0\">.<\/span><span class=\"kw7\">y<\/span> = <span class=\"br0\">(<\/span><span class=\"kw7\">stage<\/span><span class=\"sy0\">.<\/span>stageHeight<span class=\"sy0\">&#8211;<\/span><span class=\"nu0\">290<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">\/<\/span><span class=\"nu0\">2<\/span><span class=\"sy0\">;<\/span><\/div>\n<\/li>\n<li class=\"li1\">\n<div class=\"de1\">&nbsp;<span class=\"kw7\">addChild<\/span><span class=\"br0\">(<\/span>langDE<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><\/div>\n<\/li>\n<li class=\"li1\">\n<div class=\"de1\">&nbsp;<span class=\"kw1\">if<\/span><span class=\"br0\">(<\/span>basicUseTouch<span class=\"br0\">)<\/span><span class=\"br0\">{<\/span> &nbsp;<\/div>\n<\/li>\n<li class=\"li1\">\n<div class=\"de1\">&nbsp; &nbsp; &nbsp; langDE<span class=\"sy0\">.<\/span><span class=\"kw7\">addEventListener<\/span><span class=\"br0\">(<\/span>TouchEvent<span class=\"sy0\">.<\/span>TOUCH_TAP<span class=\"sy0\">,<\/span> selectLang_Touch<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><\/div>\n<\/li>\n<li class=\"li1\">\n<div class=\"de1\">&nbsp;<span class=\"br0\">}<\/span> <span class=\"kw1\">else<\/span> <span class=\"br0\">{<\/span> &nbsp; &nbsp;<\/div>\n<\/li>\n<li class=\"li1\">\n<div class=\"de1\">&nbsp; &nbsp; &nbsp; langDE<span class=\"sy0\">.<\/span><span class=\"kw7\">addEventListener<\/span><span class=\"br0\">(<\/span><span class=\"kw5\">MouseEvent<\/span><span class=\"sy0\">.<\/span><span class=\"kw8\">CLICK<\/span><span class=\"sy0\">,<\/span> selectLang_Mouse<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><\/div>\n<\/li>\n<li class=\"li1\">\n<div class=\"de1\">&nbsp;<span class=\"br0\">}<\/span><\/div>\n<\/li>\n<li class=\"li1\">\n<div class=\"de1\">&nbsp;<\/div>\n<\/li>\n<\/ol>\n<\/div>\n<p>&nbsp;<br \/>\nIn this code sample the deposited, animated German flag from the library is called and added on the stage. The variable &#8216;basicUseTouch&#8217; differentiates beween mouse and touch listeners.<br \/>\n&nbsp;<br \/>\nThe library used in this project was only used to collect the graphics of the game in a central square. In addition, it contains the font &#8220;Helvetica&#8221; which is manly used in the game.<\/p>\n<p>&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<p>Upcoming blog entries<br \/>\nMaking The Game \u2013 Teil 13: The Sound Management<br \/>\nMaking The Game \u2013 Teil 14: Knowledge base and question selection \/ Working with XML<br \/>\nMaking The Game \u2013 Part 15: Game stages<br \/>\nMaking The Game \u2013 Part 16: Mini-Games<br \/>\nMaking The Game \u2013 Part 17: Evaluation and deployment of the application<br \/>\nMaking The Game \u2013 Part 18: Concept for school use and outlook<\/p>\n<p>&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since graphical objects, such as the buttons on the menus and background images, are used multiple times and in different areas in the program a central location that provides the graphics is essential. The so-called library can be created in Flash decoupled from the actual project and edited independently of the program. Libraries in Flash are marked ba the extension *.swc. These also include, in addition to graphics, functions which are already compiled. By providing compiled objects the calculation. In practice the separation of code and graphical elements are used to that graphic designers and programmers can work simultaneously on a project. Once the graphics are changed they can be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":967,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,7],"tags":[15,16,30,64,67,77,104,105,117,145,182,186,190,193,239],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/porzelt.net\/en\/wp-json\/wp\/v2\/posts\/953"}],"collection":[{"href":"https:\/\/porzelt.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/porzelt.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/porzelt.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/porzelt.net\/en\/wp-json\/wp\/v2\/comments?post=953"}],"version-history":[{"count":1,"href":"https:\/\/porzelt.net\/en\/wp-json\/wp\/v2\/posts\/953\/revisions"}],"predecessor-version":[{"id":1237,"href":"https:\/\/porzelt.net\/en\/wp-json\/wp\/v2\/posts\/953\/revisions\/1237"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/porzelt.net\/en\/wp-json\/wp\/v2\/media\/967"}],"wp:attachment":[{"href":"https:\/\/porzelt.net\/en\/wp-json\/wp\/v2\/media?parent=953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/porzelt.net\/en\/wp-json\/wp\/v2\/categories?post=953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/porzelt.net\/en\/wp-json\/wp\/v2\/tags?post=953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}