all groups > flash data integration > february 2006 >
You're in the

flash data integration

group:

ASFunction again .. very close but not quite there


ASFunction again .. very close but not quite there Nancy Gill
2/17/2006 5:33:02 AM
flash data integration:
I have to call a new XML file from the current XML file via a link from what
is playing in the TextArea. That link will load a new title into a label
field, a new picture into a loader and new text into the TextArea. I am
trying to use ASFunction to do this, but it doesn't work.

My function to call the new file in the AS looks like this:

function loadFunction(target){
myXML.load(target);
myXML.onLoad = function(success)
{
var myArray:Array = myXML.firstChild.childNodes;
myTitle.text = myXML.firstChild.attributes.title
myLoader.contentPath = myXML.firstChild.nextSibling.attributes.src
myText.text = myXML.firstChild.nextSibling.nextSibling
}
}

my link within the text node of the xml file is this:

<a href='asfunction:loadFunction,newfile.xml'>New Link</a>

What is happening as of now is that the link appears to be valid, but
nothing happens when you click. I am soo out of time .. and I feel I'm
close ... can anyone spot the problem?

Many thanks .. your help is greatly appreciated!

Nancy

Re: ASFunction again .. very close but not quite there Nancy Gill
2/18/2006 3:35:20 PM
I will give this a shot. Someone on the flash.actionscript forum said he
believes it's my XML file and when I put that in DW, truly it doesn't
validate so probably both are a possibility. But if I can keep from having
to remake about 160 files, I surely will. :)

thanks!
Nancy

[quoted text, click to view]

Re: ASFunction again .. very close but not quite there Motion Maker
2/18/2006 4:07:51 PM
<a href='asfunction:loadFunction,newfile.xml'>New Link</a>

Might be a level or loadFunction's scope problem. Does this make a
difference

<a href='asfunction:_root.loadFunction,newfile.xml'>New Link</a>

Add a traces as well to see if the function is called and other data values.
Use Control->Test Movie to observe the traces.

function loadFunction(target){
trace("loadFunction");
trace("\ttarget = " + target);

myXML.load(target);
myXML.onLoad = function(success)
{
trace("myXML.onLoad ");
trace("\tsuccess = " + success);
trace("\tmyXML = " + myXML);

var myArray:Array = myXML.firstChild.childNodes;
myTitle.text = myXML.firstChild.attributes.title
myLoader.contentPath = myXML.firstChild.nextSibling.attributes.src
myText.text = myXML.firstChild.nextSibling.nextSibling
}
}


also consider placing _root for all myXML references ex:

_root.myXML.load
_root.myXML.onLoad

--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!

Re: ASFunction again .. very close but not quite there Nancy Gill
2/18/2006 5:24:49 PM
IT WORKED!!!!! Thank you .. Thank you .. Thank you .. a thousand times ..
Thank you!!! :)


[quoted text, click to view]

Re: ASFunction again .. very close but not quite there Nancy Gill
2/19/2006 2:11:43 PM
Thanks, MM .. you've taught me a LOT! I have all 160 or so links working ..
and was able to apply the ASfunction to the main links to load a movie
rather than the loadfunction routine. Works really well.

Thanks again!
Nancy

[quoted text, click to view]

Re: ASFunction again .. very close but not quite there Motion Maker
2/19/2006 4:00:51 PM
Great!

Also for the future, IE and FireFox both will load an XML file and report if
you have malformed XML.

--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
IT WORKED!!!!! Thank you .. Thank you .. Thank you .. a thousand times ..
Thank you!!! :)


[quoted text, click to view]
AddThis Social Bookmark Button