DefineButton

Type

Type
DefineButton {
   id: Uint16
   trackAsMenu: Boolean
   records: ButtonRecord[]
   actions: ButtonCondAction[]
}

Implementations

Syntax

DefineButton and DefineButton2 do not end with padding.

Syntax
DefineButton :
   buttonId recordList avm1Buffer

DefineButton2 :
      buttonId button2Flags nextAction[value: 0] recordList PADDING
   | {
         buttonId
         button2Flags
         nextAction[value: size(this.nextAction) + size(this.recordList)]
         recordList
         condActionList
      }

buttonId :
   LE_UINT16

avm1Buffer :
   UINT8*

buttonFlags :
   UINT8

recordList :
      recordFlags[value: 0]
   | record recordList

record(Version=Button1) :
   recordFlags[value != 0] charcterId depth Matrix
record(Version=Button2) :
   {
      recordFlags[value != 0]
      charcterId
      depth
      Matrix
      ColorTransformWithAlpha
      FilterList[if: recordFlags.hasFilters]
      BlendMode[if: recordFlags.hasBlendMode]
   }

recordFlags :
   UINT8

nextAction :
   LE_UINT16

condActionList :
      nextAction[value: 0] condAction
   | {
         nextAction[value: size(this.nextAction) + size(this.condAction)]
         condAction
         condActionList
      }

condAction :
   condActionflags avm1Buffer

Interpretation of buttonFlags:

MaskComment
1 << 0trackAsMenu
0xfeReserved

Interpretation of recordFlags:

MaskComment
1 << 0stateUp
1 << 1stateOver
1 << 2stateDown
1 << 3stateHitTest
1 << 4hasFilters
1 << 5hasBlendMode
0xc0Reserved

Interpretation of condActionFlags:

MaskComment
1 << 0idleToOverUp
1 << 1overUpToIdle
1 << 2overUpToOverDown
1 << 3overDownToOverUp
1 << 4overDownToOutDown
1 << 5outDownToOverDown
1 << 6outDownToIdle
1 << 7idleToOverDown
1 << 8overDownToIdle
0xfe00keyCode = (condActionFlags >> 9) & 0x7f (TODO)