Generic parser for Actions.

def _generic_action_parser(self):
        """Generic parser for Actions."""
        actions = []
        while True:
            action_code = unpack_ui8(self._src)
            if action_code == 0:
                break

            action_name = ACTION_NAMES[action_code]
            if action_code > 128:
                # have a payload!
                action_len = unpack_ui16(self._src)
                try:
                    action_meth = getattr(
                        self, "_handle_" + action_name.lower())
                except AttributeError:
                    if self.unknown_alert:
                        raise ValueError(
                            "Unknown action: " + repr(action_name))

                    action_payload = self._src.read(action_len)
                    _dict = {'__str__': _repr, '__repr__': _repr,
                             'name': action_name}
                    action = type("UnknownAction", (SWFObject,), _dict)()
                    action.raw_payload = action_payload
                    actions.append(action)
                else:
                    prev_pos = self._src.tell()
                    for action in action_meth(action_len):
                        assert action is not None, action_name
                        actions.append(action)

                    quant_read = self._src.tell() - prev_pos
                    if quant_read != action_len:
                        raise RuntimeError(
                            "Bad bytes consumption by action {!r} handler "
                            "(did {}, should {})".format(
                                action_name, quant_read, action_len))
            else:
                action = _make_object(action_name)
                actions.append(action)
        return actions