A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Size limit on string passed to new XML(str)

  1. #1
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204

    Size limit on string passed to new XML(str)

    Is there a size limit on strings passed to a new XML variable during construction?

    I have noticed what I think is a hard limit on the size of strings passed as an argument to the constructor of a new XML variable in actionScript3. I noticed it while trying to pass a large string from javascript to a method in AS3. Everything works fine as long as the string is less than about 330,000 characters, but as soon as the string I pass gets a little bigger than that (say 360,0000 or more) I always get a js error somewhere in the ExternalInterface and a ActionScript error when the data is recieved. I am running on IE.
    Here is what I am doing:
    In javascript I have:

    flashPlayer.generateFromXml(text);

    Where text is some large string of serialized valid xml.

    Then in AS3, I have
    ExternalInterface.addCallback("generateFromXml", generateFromXml); (called in initialize handler)

    then
    public function generateFromXml(serializedXml:String):void
    {
    var x:XML = new XML(serializedXml);
    }

    Everything works fine until the string exceeds about 340,000 characters, then I get this js error at this line in adobe code:
    function __flash__addCallback(instance, name) {
    instance[name] = function () {
    return eval(instance.CallFunction("<invoke name=\""+name+"\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) + "</invoke>")); //<<<<<--- line with breakpoint in js debugger
    }
    }
    The ActionScript error I get is the following. I believe it happens on the line "var x:XML = new XML(serializedXml);"
    (I think this because if I remove that line, I do not get the error.)

    TypeError: Error #1090: XML parser failure: element is malformed.
    at generator/generateFromXml()
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at ()
    at flash.external::ExternalInterface$/flash.external:ExternalInterface::_callIn()
    at ()

  2. #2
    Senior Member
    Join Date
    May 2004
    Posts
    182
    hello, what is the value of serializedXml variable when the exception occurs?

  3. #3
    Senior Member
    Join Date
    Nov 2000
    Posts
    204

    36,000

    Hi,
    I think you may have an extra 0. We seem to have run up against a 36,000 character limit, when using external interface (Flash Player 9 AS3).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center