{"id":13742854,"url":"https://github.com/BenoitFreslon/benoitfreslon-layoutmanager","last_synced_at":"2025-05-09T00:31:59.995Z","repository":{"id":10076198,"uuid":"12131782","full_name":"BenoitFreslon/benoitfreslon-layoutmanager","owner":"BenoitFreslon","description":"A visual layout manager. Build layouts with the Flash IDE for the Starling Framework and compatible with the CitrusEngine Framework.","archived":false,"fork":false,"pushed_at":"2015-06-26T15:03:03.000Z","size":8708,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-15T13:39:45.886Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"ActionScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BenoitFreslon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-15T10:08:46.000Z","updated_at":"2019-12-11T10:15:53.000Z","dependencies_parsed_at":"2022-09-05T07:30:41.340Z","dependency_job_id":null,"html_url":"https://github.com/BenoitFreslon/benoitfreslon-layoutmanager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenoitFreslon%2Fbenoitfreslon-layoutmanager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenoitFreslon%2Fbenoitfreslon-layoutmanager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenoitFreslon%2Fbenoitfreslon-layoutmanager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BenoitFreslon%2Fbenoitfreslon-layoutmanager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BenoitFreslon","download_url":"https://codeload.github.com/BenoitFreslon/benoitfreslon-layoutmanager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171044,"owners_count":21865275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T05:00:37.016Z","updated_at":"2025-05-09T00:31:57.152Z","avatar_url":"https://github.com/BenoitFreslon.png","language":"ActionScript","funding_links":[],"categories":["User Interface"],"sub_categories":["Starling"],"readme":"benoitfreslon-layoutmanager\n===========================\n\nA visual layout manager. Build with Flash IDE for the [Starling](https://github.com/PrimaryFeather/Starling-Framework) framework and compatible with the [CitrusEngine](https://github.com/alamboley/Citrus-Engine) framework.\nUsefull to build simple game interfaces, huds, menus, popups, etc.\n\n__Flash Pro IDE to Starling in one click__\n\n![LayoutManager](https://raw.githubusercontent.com/BenoitFreslon/benoitfreslon-layoutmanager/master/demo/demo.jpg)\n\n__Multiresolution support__\n\n![LayoutManager](https://raw.githubusercontent.com/BenoitFreslon/benoitfreslon-layoutmanager/master/demo/demo2.jpg)\n\n## Description\n\n* Use Flash IDE to build visual layouts.\n* Build your layouts with native Starling objects (Sprite, Image, TextField, Button).\n* Use the custom Flash components and use the LayoutManager class to display the layout in real time in your game.\n* Use the basic class of Starling or use your own classes.\n* Use native properties of Starling classes (texture, text, color, font, etc.).\n* Use instance name in Flash IDE and get objects in your class.\n* Add custom parameters in your own visual objects.\n* Use the Sprite container to embed several objects in one visual object.\n* Just build one lightweight .SWC file with Flash IDE with all your layouts.\n* __[NEW] Multiresolution support: All layouts are scaled according the screen size and the screen format. Useful for mobile applications.__\n\n### TODO\n* Build AIR Application.\n* Display assets in the layout editor.\n\n### Default values\n\nFor all objects, including the layouts, the origin is in the **center** of the MovieClip.\nAll objects has a default className (eg: BFImage \u003e starling.display.Image).\n\n### Custom parameters\n\nSet a **className** parameter that extends the current class or use the basic class \n(Eg: If **MyTextField** extends **starling.text.TextField** your can set the className parameter : **MyTextField**).\n\nYou also can create a new MovieClip in the layout editor in Flash IDE that extends a **BFObject** to set default parameters.\n```\nvar params:Object = {className:\"MyCustomClass\", upState: \"btn_start_upState\", downState: \"btn_start_downState\"};\n```\n\nAdd parameters variables if you want to set default parameters and additional parameters in the MovieClip in Flash IDE:\n```\nvar params:Object = {myCustomParam: 42};\n```\n\nThen add customs parameters in your custom class MyCustomClass like this:\n```\npublic var myCustomParam:int;\n```\n\nSet the instance name of all objects in Flash IDE.\nThen the name of the variables should match with the instance name.\n\nFinally declare public variables in your class and use the variable type you set.\n```\npublic var btn_start:Button;\n```\n\n**All parameter values are defined when the Layout is loaded.**\n\n### **BFSprite** - starling.display.Sprite\n\nA sprite container. Add objects inside this Sprite with Flash IDE.\n\n### **BFImage** - starling.display.Image\n\nSet the texture name in the component parameter to load the Image with a texture.\n\nParameters:\n* texture\n* smooting\n\n#### **BFButton** - startling.display.ButtonExtented\n\nThe simple Button from Starling extended.\nSet the onTouch method in the layout editor to automatically add a touch event.\n\nParameters:\n\n* upState\n* downState\n* onTouch\n* text\n* fontName\n* fontSize\n* color\n* ...\n\n### **BFTextField** - startling.text.TextField\n\nParameters:\n* text\n* fontName\n* fontSize\n* color\n* ...\n\n## INSTALLATION\n\n* Create an ActionScript 3.0 project\n* Add the [Starling](https://github.com/PrimaryFeather/Starling-Framework) framework or the [CitrusEngine](https://github.com/alamboley/Citrus-Engine) framework with the **Starling** library in your project\n* Add the **benoitfreslon-layoutmanager/src** and the **benoitfreslon-layoutmanager/srceditor** in the source path of your ActionScript 3.0 project\n* Copy the **sample.fla** file from the **benoitfreslon-layoutmanager/sample** folder in your own folder\n* Open the **sample.fla** file with Flash IDE and set the source path to the src folder: **benoitfreslon-layoutmanager/srceditor**\n* Build the **sample.swc** with Flash IDE\n* Add the **sample.swc** in the library project\n\n\n## USAGE\n\n### In Flash IDE\n\n* In the **sample.fla** create a new MovieClip symbol\n* Check **Add to AciontScript**\n* Set a class name like **MainMenuLayout** that extends **MovieClip**\n* Click OK\n* Add instances of BFImage, BFButton, BFTextField, etc.\n* Set an **instance name** if you want and set the ***onTouch*** method if you want in the BFButton instance\n* Move or rotate objects\n* Customize the components in the **Component parameters** panel\n* When it's done compile the swc\n\n### Source example\n\nIn your code source ;\n\n* Create a **starling.display.Sprite** class or a **citrus.core.starling.StarlingState**\n* Import the **LayoutManager** class in your class:\n\n```\nimport com.benoitfreslon.layoutmanager.LayoutManager;\n```\n\n* Add all your assets in your **AssetManager** instance like this :\n\n```\nimport starling.utils.AssetManager;\n```\n\nand\n\n```\nvar assets:AssetManager = new AssetManager();\n```\n\n* Create an instance of the **LayoutManager** class to load a layout.\n* (Optional) Define the callBack method `onLoad` in your class.\n\n```\nvar ll:LayoutManager = new LayoutManager();\nll.loadLayout(this, MainMenuLayout, assets, onLoad);\n```\n\n#### Source code example\n\n\n```\npackage  \n{\n\timport starling.display.Sprite;\n\timport com.benoitfreslon.layoutmanager.LayoutManager;\n\timport starling.events.Event;\n\t\n\t/**\n\t * ...\n\t * @author Benoît Freslon\n\t */\n\t \n    public class Game extends Sprite\n    {\n\t\t// Embed the Atlas XML\n\t\t[Embed( source=\"../../demo/assets/atlas.xml\",mimeType=\"application/octet-stream\" )]\n\t\tstatic public const AtlasXml : Class;\n\t\t\n\t\t// Embed the Atlas Texture:\n\t\t[Embed( source=\"../../demo/assets/atlas.png\" )]\n\t\tstatic public const AtlasTexture : Class;\n\t\t\n\t\tprivate var assets:AssetManager;\n\t\t\n        public function Game()\n        {\n\t\t\tsuper();\n\t\t\t// Define baseWidth and baseHeight in order to scale all layouts according the screen size. Useful for mobile applications.\n\t\t\tLayoutManager.baseWidth = 800;\n\t\t\tLayoutManager.baseHeight = 600;\n\t\t\t\n\t\t\tvar texture : Texture = Texture.fromBitmap( new AtlasTexture() );\n\t\t\tvar xml : XML = XML( new AtlasXml() );\n\t\t\tvar atlas : TextureAtlas = new TextureAtlas( texture, xml );\n\t\t\tassets = new AssetManager();\n\t\t\tassets.addTextureAtlas( \"assets\", atlas );\n\t\t\t\n\t\t\tvar ll:LayoutManager = new LayoutManager()\n\t\t\tll.loadLayout(this, DemoLayout, assets, onLoad);\n        }\n\t\t\n\t\tprivate function onLoad():void \n\t\t{\n\t\t\t// Layout loaded a displayed\n\t\t}\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBenoitFreslon%2Fbenoitfreslon-layoutmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBenoitFreslon%2Fbenoitfreslon-layoutmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBenoitFreslon%2Fbenoitfreslon-layoutmanager/lists"}