Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-26-2007, 02:26 PM   #1
Registered User
Join Date: Apr 2007
Posts: 2
Red face xml gallery question

Hiya Guys,

I have a script that that loads an XML file (filled with image paths and urls) and navigates the xml object until it reaches all the nodes I wish to grab. Then, it saves the image paths to an array and the same for the urls.

What I need to do is for every imagepath/url combination, I wish to create a button. When you click this button it triggers the URL in a new window, but also displays the image relating to the image path on the flash stage.

I know how to create buttons, and instances of buttons. I am not sure how to pass the values to the button and create a button for every imagepath/url pair and display the image/trigger the URL.

Could someone help?

P.S. The last couple of actionscript lines are probably redundant. I was just experimenting alittle but I fear I have hit a brick wall with this.

XML file
Actionscript code:
//Create new instance of XML for Flash to parse
var my_xml = new XML();
//Remove shitespace from xml file
my_xml.ignoreWhite = true;
//Load XML
my_xml.onLoad = function(success){
//If xml loaded
if (success){

//This function navigates the xml actionscript object
function CreateMenu(menu_xml){
		//Target the nodes you need and save them to the variable items
		var items = menu_xml.firstChild.childNodes;
		//Loop through each node
		for (var i=0; i<items.length; i++) {
		//Target the values of each node and resave to a new variable
		var imagepath = items[i].firstChild;
		var imagepath_nodeValue = imagepath.firstChild;
		var url = items[i].childNodes[1];
		var url_nodeValue = url.firstChild;
tenderfoot is offline   Reply With Quote
Old 04-26-2007, 03:41 PM   #2
Registered User
Join Date: Apr 2007
Posts: 2

Aah, I was wrong! I need to do is for every imagepath/url combination, create a a new button. When you click this button it loads the image in an empty movie clip on the stage from the images folder. When the image loads the image needs to be clickable and go the the URL grabbed from the XML file.

I am guessing I need to loop through an array like this

for i=0 1<array.length i++{
Create button(i);
Button(i) = url;
Button(i) = imagepath

Button(i).onRelease = function() {
assign imagepath to button
attach button to stage.


Don't know if this is the right logic? Any ideas of the syntax?

Also once the image is loaded, how can I make it clickable to trigger the url?

I know I am asking alot, but all help is greatly appreciated!

Last edited by tenderfoot; 04-26-2007 at 03:43 PM. Reason: Sentance error.
tenderfoot is offline   Reply With Quote
Old 01-02-2008, 04:24 AM   #3
Registered User
Join Date: Dec 2004
Location: Philadelphia
Posts: 1
Default exactly the same issue

Did you ever get the answer, I have exactly the same issue and would really appreciate the help. Thanks Eric
comicprophet is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
xml photo gallery dgc ActionScript 2.0 0 04-25-2007 04:35 PM
xml and dynamic text box question Zaphod ActionScript 1.0 (and below) 3 04-05-2007 11:05 AM
dumb image gallery question zoostory ActionScript 1.0 (and below) 1 05-10-2006 05:57 PM
photo gallery question hondo311 ActionScript 1.0 (and below) 0 08-04-2004 08:13 PM
Gallery viewer using XML question Chewbacca7779 ActionScript 1.0 (and below) 1 06-17-2004 05:01 PM

All times are GMT. The time now is 02:38 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.