コード例 #1
0
ファイル: Viewer.class.php プロジェクト: nzw/FlashForward
 public function getHumanizedDefines()
 {
     $defines = array();
     foreach ($this->_tags as $tag) {
         if (isset($tag['CharacterId'])) {
             $defines[] = array('TagName' => Media_SWF_Tag::name($tag['Code']), 'Code' => $tag['Code'], 'CharacterId' => $tag['CharacterId'], 'Length' => $tag['Length']);
         }
     }
     return $defines;
 }
コード例 #2
0
 public function parse($reader)
 {
     while (true) {
         $cl = $reader->getCodeAndLength();
         $class = "Media_SWF_Tag_" . Media_SWF_Tag::name($cl['Code']);
         if (!class_exists($class)) {
             $class = 'Media_SWF_Tag';
         }
         $tag = new $class($cl['Code'], $cl['Length'], $cl['LongFormat'], $reader, $this->root);
         $this->_tags[] = $tag;
         if ($cl['Code'] == 0) {
             // END Tag
             break;
         }
         if (!$tag->isDisplayListTag()) {
             continue;
         }
         if (!$tag->hasField('CharacterId')) {
             continue;
         }
         $characterId = $tag->getField('CharacterId');
         $object = $this->root->getTagByCharacterId($characterId);
         if (!in_array($characterId, $this->childIds)) {
             $this->childIds[] = $characterId;
         }
         if ($object && $object->firstParentId === false && $this->characterId) {
             $object->firstParentId = $this->characterId;
         }
         if ($tag->hasField('Name')) {
             $name = $tag->getField('Name');
             if (isset($this->childNames[$name]) && $this->childNames[$name] != $characterId) {
                 throw new Exception('Duplicate name "' . $name . '"');
             }
             if ($object->name === "") {
                 $object->name = $name;
             }
             $this->childNames[$name] = $characterId;
         }
     }
 }