Ask a Question related to Macromedia Flash Data Integration, Design and Development.

  1. #1

    Default Problem loading XML

    Good evening all. I am new to Flash and have just been learning a lot over the
    last couple days. I bought a pre-made fla file and am trying to customize it.
    This will be a little difficult to explain to please bear with me.

    The fla file has a TON of buttons and a few "Symbol Definitions". I am editing
    a key frame actionscript on one of the "Definitions". I add the following lines
    to load my XML file but nothing happens.

    trace("test");
    var OrgsXML:XML = new XML();
    OrgsXML.ignoreWhite = true;
    OrgsXML.onLoad = function(success:Boolean) {
    if (success) {
    Trace("Status: "+success);
    } else {
    trace("error")
    }
    };
    OrgsXML.load("states.xml");

    This exact code works on a blank fla file as expected but nothing happens in
    the more complex file that I am trying to customize. I know that this is not a
    lot of information and I am sorry that I can't explain it better. I have tried
    moving this code to different key frames but I can never get the trace("Status:
    "+success); or error to come up and I can not access any of the XML data that
    should be there.

    Perhaps I need an initial course on scope and calling functions. Thanks for
    you help and I will try to answer any questions to the best of my ability.


    MaveK Guest

  2. Similar Questions and Discussions

    1. problem with loading xml
      i tried to load xml but nothing happend application.onConnect = function(newClient, name) { application.acceptConnection(newClient); var...
    2. XML Loading Problem
      I have some code that was written to create a thumb gallery of sorts...an image scroller that, when the thumbnail was clicked, another data area was...
    3. Problem Loading Images
      When I load an image onto my webpage, Contribute tells me, "Contribute decreased the size of the image because it exceeded the size limit set by the...
    4. Loading Site Problem
      Hi I have made a site and its about 1mb, when you open it the page will say opening in the browser and wont show the site untill its fully loaded...
    5. Flash Loading Problem
      Hi - I'm new to the site, but I was hoping I could get some help. I have a flash site that seems to load fine 1/2 the time, and improperly the other...
  3. #2

    Default Re: Problem loading XML

    Ok, I have isolated the problem to the XML variable data type. If I define the
    var OrgsXML:XML with the XML data type then the variable is "undefined" but if
    I leave out the XML data type then at least the file loads. Unfortunately the
    onLoad function returns the "error" instead of the sucess.

    First question: Why is the XML datat ype causing the variable to be undefined?

    Second question: Why is the XML onLoad function returning an error? (Does it
    have anything to do with my XML file?)

    Third question: Is there a standard XML format that flash is expecting?
    (Macromedia has presented several diferent XML exammples.)


    <?xml version="1.0" encoding="iso-8859-1"?>
    <STATES>
    <ORG STATE="OR"
    ACRONYM="OCEANetwork"
    URL="http://www.oceanetwork.org" />
    <ORG STATE="VA"
    ACRONYM="HEAV"
    NAME="Home Educators Assocation of Virginia"
    URL="http://www.heav.org" />
    <ORG STATE="IA"
    ACRONYM="IAHE"
    NAME="Indiana Assocation of Home Educators"
    URL="http://www.inhomeeducators.org" />
    </STATES>


    MaveK Guest

  4. #3

    Default Re: Problem loading XML

    >>but I can never get the trace("Status:
    "+success);
    >> Trace("Status: "+success);
    trace is not a capitalized as Trace.

    --
    Lon Hosford
    [url]www.lonhosford.com[/url]
    May many happy bits flow your way!
    "MaveK" <webforumsuser@macromedia.com> wrote in message
    news:dks71b$1ua$1@forums.macromedia.com...
    Good evening all. I am new to Flash and have just been learning a lot over
    the
    last couple days. I bought a pre-made fla file and am trying to customize
    it.
    This will be a little difficult to explain to please bear with me.

    The fla file has a TON of buttons and a few "Symbol Definitions". I am
    editing
    a key frame actionscript on one of the "Definitions". I add the following
    lines
    to load my XML file but nothing happens.

    trace("test");
    var OrgsXML:XML = new XML();
    OrgsXML.ignoreWhite = true;
    OrgsXML.onLoad = function(success:Boolean) {
    if (success) {
    Trace("Status: "+success);
    } else {
    trace("error")
    }
    };
    OrgsXML.load("states.xml");

    This exact code works on a blank fla file as expected but nothing happens
    in
    the more complex file that I am trying to customize. I know that this is
    not a
    lot of information and I am sorry that I can't explain it better. I have
    tried
    moving this code to different key frames but I can never get the
    trace("Status:
    "+success); or error to come up and I can not access any of the XML data
    that
    should be there.

    Perhaps I need an initial course on scope and calling functions. Thanks for
    you help and I will try to answer any questions to the best of my ability.


    Motion Maker Guest

  5. #4

    Default Re: Problem loading XML

    Q1. Try this
    var OrgsXML:XML = new XML();
    trace (typeof(OrgsXML))

    Q2. XML.load will return an error in the output window if it cannot find the
    file. As well the success argument is false.

    Q3. I alway add the <?xml version='1.0' encoding='UTF-8' ?> but you can
    leave it out. Make sure there are no line breaks in the xml file.
    <?xml version='1.0' encoding='UTF-8' ?><datapacket><message>Hello
    World!</message></datapacket>'


    --
    Lon Hosford
    [url]www.lonhosford.com[/url]
    May many happy bits flow your way!
    "MaveK" <webforumsuser@macromedia.com> wrote in message
    news:dl3cpl$r8s$1@forums.macromedia.com...
    Ok, I have isolated the problem to the XML variable data type. If I define
    the
    var OrgsXML:XML with the XML data type then the variable is "undefined" but
    if
    I leave out the XML data type then at least the file loads. Unfortunately
    the
    onLoad function returns the "error" instead of the sucess.

    First question: Why is the XML datat ype causing the variable to be
    undefined?

    Second question: Why is the XML onLoad function returning an error? (Does
    it
    have anything to do with my XML file?)

    Third question: Is there a standard XML format that flash is expecting?
    (Macromedia has presented several diferent XML exammples.)


    <?xml version="1.0" encoding="iso-8859-1"?>
    <STATES>
    <ORG STATE="OR"
    ACRONYM="OCEANetwork"
    URL="http://www.oceanetwork.org" />
    <ORG STATE="VA"
    ACRONYM="HEAV"
    NAME="Home Educators Assocation of Virginia"
    URL="http://www.heav.org" />
    <ORG STATE="IA"
    ACRONYM="IAHE"
    NAME="Indiana Assocation of Home Educators"
    URL="http://www.inhomeeducators.org" />
    </STATES>


    Motion Maker Guest

  6. #5

    Default Re: Problem loading XML

    Originally posted by: Newsgroup User
    Q1. Try this
    var OrgsXML:XML = new XML();
    trace (typeof(OrgsXML))


    Still get "undefined"


    MaveK Guest

  7. #6

    Default Re: Problem loading XML

    Just to be sure the undefined is coming from this line I modified it

    var OrgsXML:XML = new XML();
    trace ("typeof(OrgsXML) = " + typeof(OrgsXML))

    Also try placing the code in a brand new Flash movie on the first frame.

    Not sure if this would do it but check to see if you are using AS 2.0 in
    File->Publish Settings->Flash Tab



    --
    Lon Hosford
    [url]www.lonhosford.com[/url]
    May many happy bits flow your way!
    "MaveK" <webforumsuser@macromedia.com> wrote in message
    news:dl5kc7$nts$1@forums.macromedia.com...
    Originally posted by: Newsgroup User
    Q1. Try this
    var OrgsXML:XML = new XML();
    trace (typeof(OrgsXML))


    Still get "undefined"


    Motion Maker Guest

  8. #7

    Default Re: Problem loading XML

    OK, this was a new-be mistake...

    XML is a ActionScript 2 function. Right?

    I swiched it to ActionScript 2 and it works! Thanks!
    MaveK Guest

  9. #8

    Default Re: Problem loading XML

    XML is in Flash 5.

    AS 2.0 is for using data types like this

    var myXML:XML


    in AS 1.0
    you are restricted to
    var myXML

    --
    Lon Hosford
    [url]www.lonhosford.com[/url]
    May many happy bits flow your way!
    "MaveK" <webforumsuser@macromedia.com> wrote in message
    news:dl5qv0$2q6$1@forums.macromedia.com...
    OK, this was a new-be mistake...

    XML is a ActionScript 2 function. Right?

    I swiched it to ActionScript 2 and it works! Thanks!


    Motion Maker Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139