XML and Flash


i'm having trouble creating button in flash movie pulls url xml file.

here action script (bold text i'm having trouble with)
----------------------------------------------------------------
stop();
var ninterval = setinterval(play, 9000);
function play() {
clearinterval(ninterval);
gotoandplay(_currentframe+1);
}
myxml = new xml()
myxml.ignorewhite = true
myxml.load("ascolta.xml")
myxml.ref =
myxml.onload = function(succes){
if(succes){

var root = this.firstchild
nodes = root.childnodes
for(var i=0; i<nodes.length; i++) {
this.ref["title_txt"+i].text = nodes .attributes.name
subnodes = nodes
.childnodes
this.ref["heading"+i].text = subnodes[0].firstchild.tostring()
this.ref["url"+i].text = subnodes[1].firstchild.tostring()
_root.yo = this.ref["url"+i].text

this.ref["article"+i].text = subnodes[2].firstchild.tostring()

}
} else trace("error loading xml document")
}
---------------------------------------------------------------------

below button code

---------------------------------------------------------------------
on (release) { geturl(_root.yo); }

---------------------------------------------------------------------

below xml file

---------------------------------------------------------------------

<?xml version="1.0" ?>
- <widget>
- <menu1 name="menu name 1">
<heading1>heading 1</heading1>

<url1>www.link1.com</url1>

<article1>article 1</article1>

</menu1>


- <menu2 name="menu name 2">
<heading2>heading 2</heading2>

<url2>www.link2.com</url2>

<article2>article 2</article2>

</menu2>


- <menu3 name="menu name 3">
<heading3>heading 3</heading3>

<url3>www.link3.com</url3>

<article3>article 3</article3>

</menu3>


- <menu4 name="menu name 4">
<heading4>heading 4</heading4>

<url4>www.link4.com</url4>

<article4>article 4</article4>

</menu4>




<widget>
---------------------------------------------------------------------
does know why button pulls undefined link?

thanks in advance - dave

hi debriscreator,

maybe forgot post "geturl" loads url
current browser window (like regular http request). it's not used load
xml data. if attempt load xml document being made, it's
coincidence. verify what's going on, grab web debugging proxy
like fiddler or charles. charles commercial *much* better flash.
in event, both should this. run program , run
code. watch requests being made computer. code
requesting url or xml document? if xml request being sent,
what's return error code? should 200. if it's 404 (not found),
it means xml document not think should be. have
look @ full url path (you can right-click , copy full
path), paste browser , try load there.
it's not think is. finally, may security error
(crossdomain or similar). check see if request being made
for crossdomain.xml file...this indicates flash looking
for 1 , if doesn't find it, request cancelled.

hope helps.

regards,
patrick bay
bay new media


"debriscreator" <webforumsuser@macromedia.com> wrote in message
news:fn87mg$1fb$1@forums.macromedia.com...
> i'm having trouble creating button in flash movie pulls url
>
> xml file.
>
> here action script (bold text i'm having trouble with)
> ----------------------------------------------------------------
> stop();
> var ninterval = setinterval(play, 9000);
> function play() {
> clearinterval(ninterval);
> gotoandplay(_currentframe+1);
> }
> myxml = new xml()
> myxml.ignorewhite = true
> myxml.load("ascolta.xml")
> myxml.ref =
> myxml.onload = function(succes){
> if(succes){
>
> var root = this.firstchild
> nodes = root.childnodes
> for(var i=0; i<nodes.length; i++) {
> this.ref["title_txt"+i].text = nodes .attributes.name
> subnodes = nodes
.childnodes
> this.ref["heading"+i].text = subnodes[0].firstchild.tostring()
> this.ref["url"+i].text = subnodes[1].firstchild.tostring()
> _root.yo = this.ref["url"+i].text

> this.ref["article"+i].text = subnodes[2].firstchild.tostring()
>
> }
> } else trace("error loading xml document")
> }
> ---------------------------------------------------------------------
>
> below button code
>
> ---------------------------------------------------------------------
> on (release) { geturl(_root.yo); }
>
> ---------------------------------------------------------------------
>
> below xml file
>
> ---------------------------------------------------------------------
>
> <?xml version="1.0" ?>
> - <widget>
> - <menu1 name="menu name 1">
> <heading1>heading 1</heading1>
>
> <url1>www.link1.com</url1>
>
> <article1>article 1</article1>
>
> </menu1>
>
>
> - <menu2 name="menu name 2">
> <heading2>heading 2</heading2>
>
> <url2>www.link2.com</url2>
>
> <article2>article 2</article2>
>
> </menu2>
>
>
> - <menu3 name="menu name 3">
> <heading3>heading 3</heading3>
>
> <url3>www.link3.com</url3>
>
> <article3>article 3</article3>
>
> </menu3>
>
>
> - <menu4 name="menu name 4">
> <heading4>heading 4</heading4>
>
> <url4>www.link4.com</url4>
>
> <article4>article 4</article4>
>
> </menu4>
>
>
>
>
> <widget>
> ---------------------------------------------------------------------
> know why button pulls undefined link?
>
> in advance - dave
>



More discussions in Adobe Animate CC - General


adobe

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support