Example #1
0
        private void GenerateFlexSystemManagerFrame()
        {
            if (IsSwc)
            {
                return;
            }
            if (!IsFlexApplication)
            {
                return;
            }

            var managerFullName = FlexSystemManager.BuildFrame();

            Debug.Assert(FrameWithFlexSystemManager != null);
            Swf.FrameCount++;

            Swf.SetFrameLabel("System Manager");

            var symTable = new SwfTagSymbolClass();

            AddAbcTag(FrameWithFlexSystemManager);
            Assets.ImportLateAssets();
            Assets.FlushAssets(symTable);

            symTable.AddSymbol(0, managerFullName);
            Swf.Tags.Add(symTable);
            Swf.ShowFrame();
        }
Example #2
0
        void GenerateApplicationFrame()
        {
            Swf.FrameCount++;

            var g = new AbcGenerator {
                SwfCompiler = this
            };
            var abc = g.Generate(AppAssembly);

            if (IsSwc)
            {
                var symTable = new SwfTagSymbolClass();

                CreateScripts(abc, symTable);

                if (symTable.Symbols.Count > 0)
                {
                    Swf.Tags.Add(symTable);
                }
            }
            else
            {
                var rootName = IsFlexApplication ? _flexAppType.FullName : g.RootSprite.Instance.FullName;

                //label should be the same as root name
                Swf.SetFrameLabel(rootName);

                if (g.IsNUnit)
                {
                    GenerateHtmlWrapper = false;
                }

                var symTable = new SwfTagSymbolClass();
                //see http://bugs.adobe.com/jira/browse/ASC-3235
                AddAbcTag(abc);
                Assets.ImportLateAssets();
                Assets.FlushAssets(symTable);

                //NOTE: In MX application root sprite is autogenerated subclass of mx.managers.SystemManager.
                if (!IsFlexApplication)
                {
                    //define symbol for root sprite
                    symTable.AddSymbol(0, rootName);
                }

                if (symTable.Symbols.Count > 0)
                {
                    Swf.Tags.Add(symTable);
                }
            }

            Swf.ShowFrame();
        }
Example #3
0
        void CreateScripts(AbcFile app, SwfTagSymbolClass symbols)
        {
            _scripts = new List <AbcFile>();
            foreach (var script in app.Scripts)
            {
                var abc = new AbcFile
                {
                    ImportTypeStrategy = ImportTypeStrategy.External,
                    IsSwcScript        = true,
                };

                abc.ImportScript(script);
                abc.Name = GetScriptName(abc);
                abc.Finish();

                //abc.Test();

                //LogSwc(abc);

                _scripts.Add(abc);
                AddAbcTag(abc);
            }
        }
Example #4
0
        //NOTE: assets should be defined before ABC file.

        public void FlushAssets(SwfTagSymbolClass table)
        {
            if (_exports.Count > 0)
            {
                var export = new SwfTagExportAssets();
                export.Assets.AddRange(_exports);
                Swf.Tags.Add(export);
                _exports.Clear();
            }

            if (_symbols.Count > 0)
            {
                //_symbols.Sort(delegate (SwfAsset a, SwfAsset b)
                //                  {
                //                      AbcScript s1 = a.Class.Script;
                //                      AbcScript s2 = b.Class.Script;
                //                      return s1.Index - s2.Index;
                //                  });

                table.Symbols.AddRange(_symbols);
                _symbols.Clear();
            }
        }