thibou Posted November 25, 2013 Share Posted November 25, 2013 When using PIXI.Bitmaptext with Ejecta, there is a problem occurring in PIXI.BitmapFontLoader.prototype.onXMLLoaded: this.ajaxRequest.responseXML seems to undefined. this.ajaxRequest.response contains the font xml file in textual format, but the responseXML is undefined. With Chrome/safari browsers, bitmaptext works fine. Any ideas why is this happening with Ejecta? Quote Link to comment Share on other sites More sharing options...
rich Posted November 26, 2013 Share Posted November 26, 2013 Does it exist in responseText at all? If so that would be a safe swap (responseXML for responseText). Quote Link to comment Share on other sites More sharing options...
cphillips Posted November 26, 2013 Share Posted November 26, 2013 Although I do not myself use Ejecta (yet), it appears their XMLHttpRequest API does not support responseXML, only response types of text or JSON: http://impactjs.com/ejecta/supported-apis-methods Quote Link to comment Share on other sites More sharing options...
enpu Posted November 26, 2013 Share Posted November 26, 2013 Same issue is with Windows Phone 8. Here is my fix:var responseXML = this.ajaxRequest.responseXML;if(!responseXML) { var div = document.createElement('div'); div.innerHTML = this.ajaxRequest.responseText; responseXML = div;}After that, change every this.ajaxRequest.responseXML into responseXML Try if that works for Ejecta too Quote Link to comment Share on other sites More sharing options...
rich Posted November 26, 2013 Share Posted November 26, 2013 To save you injecting it into a div, you could use the DOMParser:var domparser = new DOMParser();xml = domparser.parseFromString(data, "text/xml");Then it will validate the XML for you too. Quote Link to comment Share on other sites More sharing options...
enpu Posted November 26, 2013 Share Posted November 26, 2013 Nice, thanks! Quote Link to comment Share on other sites More sharing options...
thibou Posted December 4, 2013 Author Share Posted December 4, 2013 Ejecta doesn't support DOMParser. My solution was to convert the font XML definition file into a JSON file and then load it with minor tweaks in Pixi. Quote Link to comment Share on other sites More sharing options...
enpu Posted December 4, 2013 Share Posted December 4, 2013 Here is my modification of the onXMLLoaded function.It uses DOMParser, but also supports CocoonJS and IE9 (maybe Ejecta too?). https://gist.github.com/ekelokorpi/7784739 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.