Index of every page on this site: llms.txt
All skills
oahc09 avatar

/cocosair-assets

@ed38648
by oahc09oahc09/cocosairjs3 stars
2
Run it yourself

Load asset URL textures, atlases and BMFont with AssetBank. Use for refcounted disposal, extension selection, cache reuse or AIR_E_ATLAS_IN_USE/AIR_E_FNT_IN_USE cleanup.

  • 10 files
  • 88.8 KB
  • MIT
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/oahc09/cocosairjs/cocosair-assets

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencestriggers.md

≈487 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Cocos AIR asset triggers

Source annotations refer to the AIR checkout.

When to use what

  • "load a JSON/manifest file at runtime" -> loadAssetAsync(url) with no type argument (src/air/utils/load-asset.ts:38, :68-77).
  • "load something I built in code" -> assetManager.assets.add(key, asset) then loadAssetAsync(key, Type) (:60-62); see examples/ui-asset-loading/src/main.ts:339-342 for the round-trip shape.
  • "load a png/jpg/audio/text by URL" -> new AssetBank().load(url, { ext }) for refcounted ownership, or assetManager.loadRemote when you accept the engine's URL cache (asset-bank.md).
  • "load a model" -> not this skill; loadAssetAsync routes .gltf/.glb to GLTFLoader (src/air/utils/load-asset.ts:40-43), see cocosair-gltf.
  • "texture from pixels without a file" -> new ImageAsset(canvasElement) plus texture.image = (src/cocos/asset/assets/image-asset.ts:670, src/cocos/asset/assets/texture-2d.ts:161-163); to refill a level from a typed array, reset(info) then uploadData(source, level) (texture2d.md).
  • "sprite sheets" -> parseAtlasText/createAtlasHandle for libGDX text atlases; Creator .plist atlases are not this parser's input (atlas.md).
  • "custom font" -> loadBitmapFont(url, { bank }) then label.font = handle.font; the Creator TTF/font-asset workflow does not exist here (bmfont.md).
  • "the same URL hands back a destroyed asset, or a handle refuses to dispose" -> assetManager.releaseAsset(asset) before re-loading and never destroy() alone (asset-bank.md); AIR_E_ATLAS_IN_USE and AIR_E_FNT_IN_USE both mean someone still holds a reference, so detach the component first (atlas.md, bmfont.md).
  • "how do I know this actually works in a browser" -> the evidence column of each reference names the validator, not just the example id.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at ed38648. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
layer
subsystem
All 1 allowed tools
Read Edit Write Bash
Other metadata
compatibility
Cocos AIR source checkout or installed cocosair.js package. Browser rendering requires WebGL 2; source tooling requires Node.js >=18. Use the host-provided tools and user-authorized workspace.
when_to_use
[
  "load remote files without a Creator resources bundle",
  "the same URL returns a destroyed asset",
  "create a texture from canvas or pixel data",
  "load a sprite atlas or bitmap font",
  "an atlas or font handle refuses to dispose"
]
owns
[
  "asset-bank",
  "asset-cache",
  "reference-counting",
  "texture2d",
  "atlas",
  "bmfont"
]
not_for
[
  "glTF or GLB model loading -> cocosair-gltf",
  "bind an existing font to Label -> cocosair-ui-2d",
  "live HTML textures and DOM -> cocosair-graphics-and-dom"
]
metadata
{
  "author": "oahc09@gmail.com",
  "version": "1.0.0",
  "last-updated": "2026-10-13",
  "description_zh": "管理远程资产、AssetBank 引用计数、纹理、图集和位图字体。用于加载、缓存、取消、共享资源释放或字体导入问题。"
}

README badge

README badge for oahc09/cocosairjs/cocosair-assets