static function build(&$writer, $clipactionrecord, $opts = array()) { IO_SWF_Type_CLIPEVENTFLAGS::build($writer, $clipactionrecord['EventFlags'], $opts); $actionRecordSize = $clipactionrecord['ActionRecordSize']; // XXX $writer->putUI32LE($actionRecordSize); if ($clipactionrecord['EventFlags']['ClipEventKeyPress'] == 1) { $writer->putUI8($clipactionrecord['KeyCode']); } $actions = array(); foreach ($clipactionrecord['Actions'] as $action) { IO_SWF_Type_Action::build($writer, $action); } $writer->putUI8(0); // ActionEndFlag }
static function build(&$writer, $condAction, $opts = array()) { list($offset_condAction, $dummy) = $writer->getOffset(); $writer->putUI16LE(0); foreach (self::$buttoncond_list as $key) { $writer->putUIBit($condAction['Cond' . $key]); } $writer->putUIBits($condAction['CondKeyPress'], 7); $writer->putUIBit($condAction['CondOverDownToIdle']); foreach ($condAction['Actions'] as $action) { IO_SWF_Type_Action::build($writer, $action); } $writer->putUI8(0); // terminate if ($opts['lastAction'] === false) { list($offset_next, $dummy) = $writer->getOffset(); $writer->setUI16LE($offset_next - $offset_condAction, $offset_condAction); } return true; }
function buildContent($tagCode, $opts = array()) { $writer = new IO_Bit(); if ($tagCode == 59) { // DoInitAction $writer->putUI16LE($this->_spriteId); } $action = null; for ($i = 0; $i < count($this->_actions); $i++) { $action = $this->_actions[$i]; if ($action['Code'] == 0x99 || $action['Code'] == 0x9d) { // Jump // Find label to jump for ($j = 0; $j <= count($this->_actions); $j++) { if (isset($this->_labels[$j]) && $this->_labels[$j] == $this->_branches[$i]) { break; } } // Calculate new offset $branch_offset = 0; if ($i < $j) { for ($k = $i + 1; $k < $j; $k++) { $branch_offset += IO_SWF_Tag_Action::actionLength($this->_actions[$k]); } } else { for ($k = $i; $k >= $j; $k--) { $branch_offset -= IO_SWF_Tag_Action::actionLength($this->_actions[$k]); } } if ($action['Code'] == 0x99) { // Jump $action['BranchOffset'] = $branch_offset; } if ($action['Code'] == 0x9d) { // If $action['Offset'] = $branch_offset; } } IO_SWF_Type_Action::build($writer, $action); } if (is_null($action) === false && $action['Code'] !== 0) { $writer->putUI8(0); // ActionEndFlag } return $writer->output(); }
function buildContent($tagCode, $opts = array()) { $writer = new IO_Bit(); $writer->putUI16LE($this->_buttonId); $opts['tagCode'] = $tagCode; if ($tagCode == 34) { // DefineButton2 $writer->putUIBits($this->_reservedFlags, 7); $writer->putUIBit($this->_trackAsMenu); list($offset_actionOffset, $dummy) = $writer->getOffset(); $writer->putUI16LE(0); // dummy; } foreach ($this->_characters as $character) { IO_SWF_Type_BUTTONRECORD::build($writer, $character, $opts); } $writer->putUI8(0); // terminater of button record if ($tagCode == 34) { // DefineButton2 $actions = array(); if (is_null($this->_actions) === false) { list($offset_buttonCondition, $dummy) = $writer->getOffset(); $writer->setUI16LE($offset_buttonCondition - $offset_actionOffset, $offset_actionOffset); foreach ($this->_actions as $idx => $action) { if (isset($this->_actions[$idx + 1]) === false) { $opts['lastAction'] = true; } else { $opts['lastAction'] = false; } IO_SWF_Type_BUTTONCONDACTION::build($writer, $action, $opts); } } } else { foreach ($this->_actions as $action) { IO_SWF_Type_Action::build($writer, $action); } $writer->putUI8(0); // terminator of actions } return $writer->output(); }