{"id":15342192,"url":"https://github.com/joshtynjala/openfl-swc-sample","last_synced_at":"2026-01-18T22:02:19.166Z","repository":{"id":136811185,"uuid":"451251046","full_name":"joshtynjala/openfl-swc-sample","owner":"joshtynjala","description":"A sample OpenFL and Haxe project that compiles a .swc library for ActionScript 3.0 developers","archived":false,"fork":false,"pushed_at":"2025-12-10T18:13:31.000Z","size":23,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-11T04:49:11.767Z","etag":null,"topics":["actionscript","adobe-air","adobe-flash","as3","haxe","openfl","openfl-samples","openfl-target-air","openfl-target-flash"],"latest_commit_sha":null,"homepage":"","language":"Haxe","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/joshtynjala.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"joshtynjala","patreon":null,"open_collective":null,"ko_fi":"joshtynjala","tidelift":null,"community_bridge":null,"liberapay":"joshtynjala","issuehunt":null,"otechie":null,"custom":null}},"created_at":"2022-01-23T22:50:53.000Z","updated_at":"2025-12-10T18:13:36.000Z","dependencies_parsed_at":"2023-11-16T23:13:35.294Z","dependency_job_id":null,"html_url":"https://github.com/joshtynjala/openfl-swc-sample","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"2033a7ce41c6312581366fde643cd80c8ddbb977"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/joshtynjala/openfl-swc-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshtynjala%2Fopenfl-swc-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshtynjala%2Fopenfl-swc-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshtynjala%2Fopenfl-swc-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshtynjala%2Fopenfl-swc-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshtynjala","download_url":"https://codeload.github.com/joshtynjala/openfl-swc-sample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshtynjala%2Fopenfl-swc-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28552132,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T20:59:07.572Z","status":"ssl_error","status_checked_at":"2026-01-18T20:59:02.799Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["actionscript","adobe-air","adobe-flash","as3","haxe","openfl","openfl-samples","openfl-target-air","openfl-target-flash"],"created_at":"2024-10-01T10:42:32.558Z","updated_at":"2026-01-18T22:02:19.161Z","avatar_url":"https://github.com/joshtynjala.png","language":"Haxe","funding_links":["https://github.com/sponsors/joshtynjala","https://ko-fi.com/joshtynjala","https://liberapay.com/joshtynjala"],"categories":[],"sub_categories":[],"readme":"# Create SWC Library with OpenFL Sample\n\nDemonstrates how to create a _.swc_ library for ActionScript 3.0 using [OpenFL](https://openfl.org/) and [Haxe](https://haxe.org/). This allows AS3 developers using Adobe AIR to access Haxe libraries too.\n\nTo build the _.swc_ library, use the following command:\n\n```sh\nopenfl build flash -debug\n```\n\nThe file will be created at _bin/flash/bin/mylibrary.swc_.\n\nTo use the _.swc_ library in an ActionScript project, add it with the `--library-path` compiler option.\n\n```sh\nmxmlc --library-path+=mylibrary.swc\n```\n\nDuring startup, such as in the constructor of the main AS3 class, you should add the following AS3 code because it initializes a few things that are expected by Haxe-compiled _.swc_ libraries:\n\n```as3\nhaxe.initSwc(null);\n```\n\n## Build SWC instead of SWF\n\nThe [OpenFL](https://openfl.org) library contains a number of template files that are used when building a project. You can find them in the [_openfl/assets/templates_](https://github.com/openfl/openfl/tree/develop/assets/templates) and the [_lime/templates_](https://github.com/openfl/lime/tree/develop/templates) directories. Using the `\u003ctemplate\u003e` element in _project.xml_, it's possible to replace one or more of these template files with custom versions, on a per-project basis, and without forking OpenFL.\n\nThis sample project contains a directory named [_custom-templates_](https://github.com/joshtynjala/openfl-swc-sample/tree/main/custom-templates). It is configured in [_project.xml_](https://github.com/joshtynjala/openfl-swc-sample/tree/main/project.xml) like this:\n\n```xml\n\u003ctemplate path=\"custom-templates\"/\u003e\n```\n\nInside [_custom-templates_](https://github.com/joshtynjala/openfl-swc-sample/tree/main/custom-templates), there's a directory [_flash/hxml_](https://github.com/joshtynjala/openfl-swc-sample/tree/main/custom-templates/flash/hxml/) that contains custom _.hxml_ files for compiling with Haxe, including [_debug.hxml_](https://github.com/joshtynjala/openfl-swc-sample/tree/main/custom-templates/flash/hxml/debug.hxml), [_release.hxml_](https://github.com/joshtynjala/openfl-swc-sample/tree/main/custom-templates/flash/hxml/release.hxml), and [_final.hxml_](https://github.com/joshtynjala/openfl-swc-sample/tree/main/custom-templates/flash/hxml/final.hxml). The relative path to this directory inside [_custom-templates_](https://github.com/joshtynjala/openfl-swc-sample/tree/main/custom-templates) matches the directory named [_flash/hxml_](https://github.com/openfl/lime/tree/develop/templates/flash/hxml) inside Lime's [_templates_](https://github.com/openfl/lime/tree/develop/templates) directory.\n\nThese custom _.hxml_ template files modify the `-swf` compiler option to use the file extension _.swc_ instead of _.swf_ for the name of the output file. This is how you configure the Haxe compiler to generate a _.swc_ library for Adobe AIR.\n\n## Include all classes in a package\n\nThis sample uses the [`Compiler.include()`](https://api.haxe.org/haxe/macro/Compiler.html#include) macro to include all classes (recrusively) in the _com.example_ package. This macro is configured in [_project.xml_](https://github.com/joshtynjala/openfl-swc-sample/tree/main/project.xml) like this:\n\n```xml\n\u003chaxeflag name=\"--macro\" value=\"include('com.example')\"/\u003e\n```\n\n## `@:flash.property` meta\n\nFinally, a custom [`AddFlashPropertyMeta.find()`](https://github.com/joshtynjala/openfl-swc-sample/tree/main/build_macros/flash/AddFlashPropertyMeta.hx) macro is used to automatically add `@:flash.property` meta to all properties with getters and setters. Normally, you'd need to do this manually. Haxe's `@:flash.property` meta ensures that a property is compiled with native AS3 getters and setters, instead of `get_propertyName()` and `set_propertyName()` methods. This macro is configured in [_project.xml_](https://github.com/joshtynjala/openfl-swc-sample/tree/main/project.xml) like this:\n\n```xml\n\u003csource path=\"build_macros/flash\"/\u003e\n\u003chaxeflag name=\"--macro\" value=\"AddFlashPropertyMeta.find('com.example')\"/\u003e\n```\n\n---\n\nSample created by [Josh Tynjala](https://github.com/sponsors/joshtynjala), the author of [Feathers UI](https://feathersui.com/) and a member of the [OpenFL](https://openfl.org/) leadership team.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshtynjala%2Fopenfl-swc-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshtynjala%2Fopenfl-swc-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshtynjala%2Fopenfl-swc-sample/lists"}