Esempio n. 1
0
        private void RegisterEffectTriggers(AbcFile app, AbcCode code)
        {
            if (_effects.Count == 0)
            {
                return;
            }

            var effectManager = _compiler.ImportType(app, "mx.effects.EffectManager");
            var mn            = app.DefineName(QName.MxInternal("registerEffectTrigger"));

            foreach (var pair in _effects)
            {
                code.Getlex(effectManager);
                code.PushString(pair.Key);
                code.PushString(pair.Value);
                code.CallVoid(mn, 2);
            }
        }
Esempio n. 2
0
        private AbcMethod DefineInitFlexAppStyles(AbcInstance instance)
        {
            var done = instance.DefineSlot("_init_styles_done", AvmTypeCode.Boolean);

            return(instance.DefineMethod(
                       Sig.@this("$init_flex_styles$", AvmTypeCode.Void),
                       code =>
            {
                code.LoadThis();
                code.GetProperty(done);

                var br = code.IfFalse();
                code.ReturnVoid();

                br.BranchTarget = code.Label();

                code.LoadThis();
                code.Add(InstructionCode.Pushtrue);
                code.SetProperty(done);

                //TODO: init app CSSStyleDeclaration
                //TODO: init app effects

                if (IsFlex4)
                {
                    code.LoadThis();
                    code.GetProperty("styleManager");
                    code.CallVoid("initProtoChainRoots", 0);
                }
                else
                {
                    var styleMgr = _generator.ImportType("mx.styles.StyleManager");
                    code.Getlex(styleMgr);
                    code.CallVoid(Abc.DefineName(QName.MxInternal("initProtoChainRoots")), 0);
                }

                code.ReturnVoid();
            }));
        }