[Xerte] rootIcon.loadIcon() - getting it working with xml

Kemp Johnathan johnathan.kemp at ntlworld.com
Mon Dec 5 22:19:05 GMT 2011


The Xerte help specifies

rootIcon.loadIcon(FileLOcation + 'media/icon.png');

as the way to call loadIcon, but how do you use it when you don't want to
hard code the file name?

I have an xwd based form that collects the url value as
"FileLocation + 'media/bannerTest1.png'"

In my script I have tried

rootIcon.loadIcon(templateData.learningObject[0].projDisplay[0].logoUrl);

which fails, even though

debug( templateData.learningObject[0].projDisplay[0].logoUrl );

outputs

FileLocation + 'media/bannerTest1.png'

I have tried tests such as

fred = "media/bannerTest1.png";
rootIcon.loadIcon(FileLocation + "'" + fred + "'");

and

fred = "'media/bannerTest1.png'";
rootIcon.loadIcon(FileLocation + fred);

In an attempt to figure out what hoops I will have to go through to get it
to work, but the only way I can get the image to display is if I hard code
it into the script.

i.e.
rootIcon.loadIcon(FileLocation + 'media/bannerTest1.png');

works.

I cannot get the image to display when the path is passed in a variable.

I don't know if the issue is something to do with FileLocation converting
to a path with back slashes whilst the media/bannerTest1.png has a forward
slash, but this hasn't stopped the method call working when I hard code the
file name.

Can anyone suggest a way forward?

Kind regards

Johnathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20111205/7929a3ce/attachment-0001.html>


More information about the Xerte mailing list