Skip to main content

Partial implementation of ActionScript3 in Python

Project description

python-as3lib

A partial implementation of ActionScript3 and adobe flash in python. This project aims to have as accurate of an implementation as possible of the stuff that I choose to implement, however, due to my limited knowledge of advanced programming and Adobe's subpar documentation, this might not be completely accurate. Some stuff will be impossible to implement in python because python is a fish.

Warning: Some early versions of this library that contain the config module are very broken on Windows and can cause major issues. This was fixed in version 0.0.6.

If you are using wayland, this library will have a first time init message because wayland does not currently support easily fetching some values automatically (without systemd, I do not want to depend on that). You must either launch this library, or the program that uses it, from the terminal to input these values, or fill out the blank config file that I provide on github (it will lock up otherwise). These values are stored in <library-directory>/wayland.cfg. They only need to be accurate if you are using the graphical elements of this library. I will not be able to fix the window grouping jank on wayland until tcl/tk natively supports wayland.

Requirements

System:
 Linux:
  bash (or a bash compatible shell)
  echo
  grep
  xwininfo (xorg)
  xrandr (xorg)
  awk
  loginctl (This requirement will probably be removed later, this was just the easiest way to do things)
  whoami
 Windows:
  PyLaucher (should be included in the python installer)
Python:
 Built-in:
  tkinter, re, math, io, platform, subprocess, random, time, datetime, os, pwd (linux), pathlib, configparser, webbrowser, textwrap, typing
 External:
  numpy, Pillow, tkhtmlview

Modules

There are currently 16 modules plus a parser (doesn't work yet. If you actually need something like that, you should probably be using ruffle instead) in this library, toplevel, interface_tk, keyConversions, configmodule, initconfig, com.adobe, flash.ui, flash.display, flash.filesystem, flash.utils, flash.events, flash.display3D, flash.net, flash.crypto, flash.system, and flash.errors.
Using "from as3lib import *" currently imports everything from the toplevel module with int renamed to Int so it doesn't conflict with python's int.

directory: cfail

This directory contains all of the backup modules for when the c modules fail to compile. These are used instead of them.

toplevel

Most of this is implemented, however there are probably a lot of inconsistencies with how things work due to terrible documentation. Please open an issue on the github if you find something that you know is wrong. For functions which have multiple interpretations from the documentation, I added an arguement called "interpretation" which is an integer that specifies which one you want.

interface_tk

Interface library for testing purposes written in tkinter. I will likely keep this around once the real interface stuff is implemented but no promises.
Warning: This is a testing library, do not expect consistancy between versions.

keyConversions

This module includes cross-platform key conversion functions for tkinter events, javascript (actionscript) keycodes, and mouse buttons (currently only supports united states standard keyboard on linux and windows). This will be moved later since flash has a place for it.

configmodule

The module that holds all of the things that this library needs globally or that need to be used many times so I only have to fetch them once while it is running. This module includes information like;
the current platform
the library directory
library debug status
the config for the trace function loaded from mm.cfg
details about the screen (width, hight, refresh rate, and color depth) for the display module.
information about the filesystem (path separator, user directory, desktop directory, and documents directory) for the flash.filesystem module
library initialization status and errors

initconfig

The module that is called when this library initializes with the sole purpose of setting the variables in configmodule.
Note: use of multiple displays has not been tested yet.

flash.cryto

This module only has one function in it, generateRandomBytes. It uses a c module on unix but python code on windows because windows cryptography is extremely complicated and painful. On anything but windows, this requires /dev/urandom and C99's dynamic array length assignment (creating as array with the length specified by a variable), however, if they aren't present, python code will be used instead.

com.adobe, flash.ui, flash.display, flash.filesystem, flash.utils, flash.events, flash.display3D, flash.net, flash.cryto, flash.system, and flash.errors

These modules contain things from their respective actionscript modules. None of them are complete yet since many actionscript modules rely on each other to function. I have to go back and forth between modules coding things here and there so these are taking much longer than the other modules.

Config Files

<library-directory>/mm.cfg - this file is the same as it was in actionscript with the same options as defined here with the exception of "ClearLogsOnStartup" which I added to configure what it says. Its defualt value is 1 to match the behavior in actionscript.

<library-directory>/wayland.cfg - generated on the first use of this library if you are using wayland. Stores all of the values that can't be fetched automatically (without systemd) so you only have to input them once. They must be changed manually if you want to change them.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

as3lib-0.0.10.tar.gz (71.4 kB view details)

Uploaded Source

File details

Details for the file as3lib-0.0.10.tar.gz.

File metadata

  • Download URL: as3lib-0.0.10.tar.gz
  • Upload date:
  • Size: 71.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.7

File hashes

Hashes for as3lib-0.0.10.tar.gz
Algorithm Hash digest
SHA256 ba738c6bc974e8f53ca8ca725cb5e11279efec09910775d65de1e94bfce74230
MD5 8ccfd150478100f73796d37bad2b8cd5
BLAKE2b-256 4f3f426d9e9e6acbc2b3835195a339aefa020024f48e2f37aef0bad29e37a59d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page