Ejemplo n.º 1
0
        private void BuildDictionary(Timeline timeline, StringBuilder buff)
        {
            if (this.OutputComments)
            {
                buff.AppendLine("  /* timeline for "+timeline.ToString()+" */");
            }

            foreach (Frame f in Swf.Frames)
            {
                foreach (IDisplayListItem dli in f.DisplayList)
                {
                    if (!Dict.ContainsKey(dli) && dli.Type == DisplayListItemType.PlaceObjectX)
                    {
                        string name = "mc" + Dict.Count + 1;
                        Dict.Add(dli, name);

                        PlaceObject po = dli as PlaceObject;
                        ICharacter ch = po.Character;

                        if (ch is Shape)
                        {
                            buff.AppendLine("  dict['" + name + "'] = \"" + ShapeToJS(ch as Shape) + "\";");
                        }
                        else if (ch is Sprite)
                        {
                            string clipName = RegisterTimeline((Timeline)ch);

                            buff.AppendLine("  var " + clipName + " = swiffoid.createMovieClipClass([o,o,o,o,o]);");
                            buff.AppendLine("  swiffoid.addClip('" + clipName + "', " + clipName + ");");
                            buff.AppendLine("  var instance = swiffoid.instantiateClip('" + clipName + "');");

                            html.JQueryAppendNew(buff, "  ", "$root", "canvas", new string[][] {
                                new string[] {"width", this.Width + "px"},
                                new string[] {"height", this.Height + "px"},
                            });

                            BuildDictionary((Sprite)ch, buff);
                        }
                    }
                }
            }
        }