from flashticle.util import Value SIMPLEACTIONS = {} SIMPLEACTIONS_CODE = {} _SIMPLEACTIONS = """ 04 NextFrame 05 PreviousFrame 06 Play 07 Stop 08 ToggleQuality 09 StopSounds 0A Add 0B Subtract 0C Multiply 0D Divide 0E Equals 0F Less 10 And 11 Or 12 Not 13 StringEquals 14 StringLength 15 StringExtract 17 Pop 18 ToInteger 1C GetVariable 1D SetVariable 20 SetTarget2 21 StringAdd 22 GetProperty 23 SetProperty 24 CloneSprite 25 RemoveSprite 26 Trace 27 StartDrag 28 EndDrag 29 StringLess 2A Throw 2B CastOp 2C ImplementsOp 30 RandomNumber 31 MBStringLength 32 CharToAscii 33 AsciiToChar 34 GetTime 35 MBStringExtract 36 MBCharToAscii 37 MBAsciiToChar 3A Delete 3B Delete2 3C DefineLocal 3D CallFunction 3E Return 3F Modulo 40 NewObject 41 DefineLocal2 42 InitArray 43 InitObject 44 TypeOf 45 TargetPath 46 Enumerate 47 Add2 48 Less2 49 Equals2 4A ToNumber 4B ToString 4C PushDuplicate 4D StackSwap 4E GetMember 4F SetMember 50 Increment 51 Decrement 52 CallMethod 53 NewMethod 54 InstanceOf 55 Enumerate2 60 BitAnd 61 BitOr 62 BitXor 63 BitLShift 64 BitRShift 65 BitURShift 66 StrictEquals 67 Greater 68 StringGreater 69 Extends """ def _init(): for line in _SIMPLEACTIONS.splitlines(): line = line.strip() if not line: continue code, name = line.split() code = int(code, 16) name = 'Action' + name cls = type(name, (Value,), {'code': code, '__module__': __name__}) SIMPLEACTIONS[name] = cls SIMPLEACTIONS_CODE[code] = cls globals().update(SIMPLEACTIONS) _init()