Ask a Question related to Macromedia Flash Data Integration, Design and Development.
-
MaveK #1
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
-
problem with loading xml
i tried to load xml but nothing happend application.onConnect = function(newClient, name) { application.acceptConnection(newClient); var... -
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... -
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... -
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... -
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... -
MaveK #2
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
-
Motion Maker #3
Re: Problem loading XML
>>but I can never get the trace("Status:
"+success);
trace is not a capitalized as Trace.>> Trace("Status: "+success);
--
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
-
Motion Maker #4
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
-
MaveK #5
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
-
Motion Maker #6
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
-
MaveK #7
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
-
Motion Maker #8
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



Reply With Quote

