Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions flixel/graphics/frames/FlxAtlasFrames.hx
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,20 @@ class FlxAtlasFrames extends FlxFramesCollection
var frames:FlxAtlasFrames = FlxAtlasFrames.findFrame(graphic);
if (frames != null)
return frames;

if (graphic == null || xml == null)

final xmlData = xml.getFirstElement();
if (xmlData == null)
{
FlxG.log.warn('Invalid xml: $xml');
return null;

}

if (graphic == null)
return null;

frames = new FlxAtlasFrames(graphic);

var data:Access = new Access(xml.getXml().firstElement());
var data:Access = new Access(xmlData);

for (texture in data.nodes.SubTexture)
{
Expand Down Expand Up @@ -323,15 +330,20 @@ class FlxAtlasFrames extends FlxFramesCollection
var frames = FlxAtlasFrames.findFrame(graphic);
if (frames != null)
return frames;

if (graphic == null || xml == null)

final xmlData = xml.getFirstElement();
if (xmlData == null)
{
FlxG.log.warn('Invalid xml: $xml');
return null;

}

if (graphic == null)
return null;

frames = new FlxAtlasFrames(graphic);

final data = xml.getXml();

for (sprite in data.firstElement().elements())

for (sprite in xmlData.elements())
{
var trimmed = (sprite.exists("oX") || sprite.exists("oY"));
var rotated = (sprite.exists("r") && sprite.get("r") == "y");
Expand Down
5 changes: 5 additions & 0 deletions flixel/system/FlxAssets.hx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ abstract FlxXmlAsset(OneOfTwo<Xml, String>) from Xml from String
return cast(this, Xml);
}

inline public function getFirstElement()
{
return getXml().getFirstElement();
}

static inline function fromPath<T>(path:String):Xml
{
return fromXmlString(Assets.getText(path));
Expand Down