Пример #1
0
        internal Button(RootMovieClip root, ButtonInfo info, DisplayObject container)
            : base(root, container)
        {
            _button = info;

            CurrentState = State.Over;
            SetButtonState(State.Up);
            LoadActions();
        }
Пример #2
0
        protected override void UnhandledTag(ISwfTag tag, ISystemServices services)
        {
            if (tag is ISwfDefinitionTag)
            {
                var defTag = tag as ISwfDefinitionTag;

                ICharacter character = null;
                switch (defTag.Type)
                {
                    case CharacterType.BinaryData: character = new BinaryData(defTag.CharacterID, (tag as DefineBinaryDataTag).Data); break;
                    case CharacterType.Bitmap: character = new Bitmap(defTag, services); break;
                    case CharacterType.Button: character = new ButtonInfo(defTag, services, this); break;
                    case CharacterType.Shape: character = new Shape(defTag, services, this); break;
                    case CharacterType.Text: character = new Text(tag as DefineTextTag, services, this); break;
                    case CharacterType.Sprite:
                        {
                            var sprite = tag as DefineSpriteTag;
                            character = new Sprite(sprite.Tags, defTag.CharacterID, sprite.FrameCount, services);
                        }
                        break;
                    case CharacterType.Font:
                        {
                            var font = new Font(defTag.CharacterID);
                            font.AddInfo(tag, services);
                            character = font;
                        }
                        break;
                }

                if (character != null)
                    _characters.Add(defTag.CharacterID, character);
            }
            else if (tag is SetBackgroundColorTag)
            {
                BackgroundColor = (tag as SetBackgroundColorTag).Color;
            }
            else if (tag is DefineScenesAndFrameLabelsTag)
            {
                var def = tag as DefineScenesAndFrameLabelsTag;
                _frameLabels = new Dictionary<string, ushort>(def.FrameLabels);
                _scenes = new Dictionary<string, ushort>(def.Scenes);
            }
            else if (tag is DefineFontInfoTag)
            {
                var fi = tag as DefineFontInfoTag;
                (_characters[fi.FontID] as Font).AddInfo(tag, services);
            }
            else if (tag is DoInitActionTag)
            {
                var init = tag as DoInitActionTag;
                (_characters[init.SpriteID] as Sprite).InitAction = init.Actions;
                _initOrder.Add(init.SpriteID);
            }
            else if (tag is DefineButtonCxFormTag)
            {
                var cxf = tag as DefineButtonCxFormTag;
                (_characters[cxf.CharacterID] as ButtonInfo).SetCxForm(cxf.CxForm);
            }

            #region Not implemented tags

            /*
            else if (tag is DefineEditTextTag) { }
             */

            // else if (tag is SetTabIndexTag) { }
            // else if (tag is DefineScalingGridTag) { }
            else
                base.UnhandledTag(tag, services);

            #endregion

            #region Unsupported tags
            //TODO: Tags not yet implemented or unsupported
            //DefineFontNameTag
            //{14, "DefineSound"},
            //{17, "DefineButtonSound"},
            //{24, "Protect"},
            //{46, "DefineMorphShape"},
            //{56, "ExportAssets"},
            //{57, "ImportAssets"},
            //{58, "EnableDebugger"},
            //{60, "DefineVideoStream"},
            //{61, "VideoFrame"},
            //{64, "EnableDebugger2"},
            //{65, "ScriptLimits"},
            //{69, "FileAttributes"},
            //{71, "ImportAssets2"},
            //{73, "DefineFontAlignZones"},
            //{74, "CSMTextSettings"},
            //{76, "SymbolClass"},
            //{77, "Metadata"},
            //{84, "DefineMorphShape2"},
            //{89, "StartSound2"},
            //{91, "DefineFont4"}
            #endregion
        }