private void PlaceItem(PlaceObject po) { var character = _context.GetCharacter(po.Character, _sprite); var itemTransform = CreateTransform(po); IDisplayItem displayItem; if (character is Playable) { displayItem = new SpriteItem() { Transform = itemTransform } } ; else { displayItem = new RenderItem() { Transform = itemTransform } }; displayItem.Create(character, _context, this); //add this object as an AS property if (po.Flags.HasFlag(PlaceObjectFlags.HasName)) { _scriptObject.Variables[po.Name] = Value.FromObject(displayItem.ScriptObject); displayItem.Name = po.Name; } _content.Items[po.Depth] = displayItem; }
private void PlaceItem(PlaceObject po) { if (_content.Items.ContainsKey(po.Depth)) { return; } var character = Context.GetCharacter(po.Character, _sprite); var itemTransform = CreateTransform(po); IDisplayItem displayItem; if (character is Playable) { displayItem = new SpriteItem() { Transform = itemTransform } } ; else { displayItem = new RenderItem() { Transform = itemTransform } }; displayItem.Create(character, Context, this); //add this object as an AS property if (po.Flags.HasFlag(PlaceObjectFlags.HasName)) { ScriptObject.Variables[po.Name] = Value.FromObject(displayItem.ScriptObject); displayItem.Name = po.Name; } if (po.Flags.HasFlag(PlaceObjectFlags.HasClipAction)) { if (po.ClipEvents != null) { foreach (var clipEvent in po.ClipEvents) { if (clipEvent.Flags.HasFlag(ClipEventFlags.Initialize)) { Context.Avm.Execute(clipEvent.Instructions, displayItem.ScriptObject); } } } } _content.Items[po.Depth] = displayItem; }