diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e514bf3..0c8b9565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Unreleased +* **ActionScript on the roadmap** (ADR 0013, low priority, M6): first keep the scripts in + imported Animate files, with an Actions panel, then play the common timeline controls (stop, + play, go to a frame or label, button clicks) in Test Movie and HTML canvas export. Until + then, opening an Animate document now says how many frame scripts it left out instead of + dropping them silently. * **Filters** (Properties › Filters, on movie clip and button instances as in Animate): **Drop Shadow**, **Blur**, **Glow** and **Adjust Color**, in any order and combination, with blur X/Y, quality (Low, Medium, High), strength, colour, angle and distance, and inner, knockout diff --git a/crates/xfl/src/import.rs b/crates/xfl/src/import.rs index 950f00ed..7d3145ec 100644 --- a/crates/xfl/src/import.rs +++ b/crates/xfl/src/import.rs @@ -335,6 +335,10 @@ impl<'a> Builder<'a> { Some("motion object") => self.report.skip("motion tweens (kept as keyframes)"), _ => {} } + // Frame scripts aren't kept yet (ADR 0013); say so instead of dropping them quietly. + if f.child("Actionscript").is_some() { + self.report.skip("frame scripts (ActionScript isn't supported yet)"); + } let mut els = Vec::new(); self.elements(f.list("elements"), &Affine::IDENTITY, &mut els, 0); k.elements = els; diff --git a/crates/xfl/src/tests.rs b/crates/xfl/src/tests.rs index 97ba51d7..6c6fef36 100644 --- a/crates/xfl/src/tests.rs +++ b/crates/xfl/src/tests.rs @@ -21,6 +21,7 @@ const DOC: &str = r##" + @@ -56,7 +57,7 @@ const DOC: &str = r##" - + "##; @@ -92,6 +93,8 @@ fn stage_layers_frames_and_tweens() { assert_eq!(report.skipped.get("text fields"), Some(&1)); assert_eq!(report.skipped.get("instances of missing bitmaps"), Some(&1)); assert_eq!(report.skipped.get("missing library files"), Some(&1)); + // Frame scripts, on the scene's frames and inside symbols, are counted (ADR 0013). + assert_eq!(report.skipped.get("frame scripts (ActionScript isn't supported yet)"), Some(&2)); // Every scene comes across, in order. assert_eq!(doc.scenes.iter().map(|s| s.name.as_str()).collect::>(), ["Scene 1", "Scene 2"]); assert_eq!(doc.timeline(1).layers.len(), 1, "an empty scene gets a layer to draw on"); diff --git a/docs/adr/0013-actionscript.md b/docs/adr/0013-actionscript.md new file mode 100644 index 00000000..adefd4f4 --- /dev/null +++ b/docs/adr/0013-actionscript.md @@ -0,0 +1,108 @@ +# ADR 0013: ActionScript compatibility + +* Status: accepted (2026-11-08) as scope and placement; the parts are built later (roadmap M6) +* Relates to: requirements U2 (scripting surface), roadmap M6, ADR 0009 (XFL import), + `docs/legal/compliance.md` + +## Context + +The project lead asked for ActionScript on the roadmap if it fits our constraints, at low +priority, since it serves a smaller group of users. U2 already settled AniCraft's own scripting: +the Craft-family WebAssembly plug-ins, with frame scripts on the same sandbox. The ActionScript +question is about compatibility for people who bring Animate projects with code in them. + +What those users have, in order of how common it is: + +1. **Timeline control in frame scripts**: `stop()`, `play()`, `gotoAndPlay`/`gotoAndStop` by + frame number or label, `nextFrame`/`prevFrame`, the same calls on a named instance + (`hero_mc.gotoAndStop("run")`), and button clicks wired to those calls with + `addEventListener(MouseEvent.CLICK, …)`. Most animation and e-learning work only uses this. +2. **Small logic**: variables, `if`, loops, `trace`, setting instance properties + (`x`, `alpha`, `visible`), simple functions. +3. **Applications and games**: classes in packages, the document class, linked symbol classes, + the full `flash.*` platform API (display list, events, networking, sound, text), compiled + to bytecode for a player. + +Current Animate documents run ActionScript 3.0 only; ActionScript 1 and 2 live only in old +files. Today the XFL importer drops frame scripts without a word. + +Our constraints: Rust only, no unsafe, never crash on hostile input, everything is a command, +time is a function (`evaluate` is pure), clean room (public documents and observation only), +permissive dependencies from crates.io, and Adobe names used only nominatively. + +## Decision + +ActionScript fits as a **compatibility front end in three tiers**, built in order, each one +useful alone. Only the first two are planned. It stays low priority: in M6 after the +WebAssembly plug-ins, frame scripts and HTML canvas export, and it may slip past M8 without +blocking anything else. + +1. **Keep (tier 1).** Scripts are content and are never lost. + * The document model gets `Keyframe.script: Option>`, where `Script` holds the + source text verbatim and its language (`ActionScript3`, `ActionScript1or2`, `Other`), plus + symbol linkage and document class names as plain strings. Saved in `.anicraft` (a minor + format version with `#[serde(default)]`, so older files open unchanged). + * The XFL importer reads `