Advertisement

02.27.2008 at 02:01AM PST, ID: 23196398
[x]
Attachment Details

How can I print  images loaded from an xml into a movieclip which in the library

Asked by newbie_soup in Macromedia Flash, Extensible Markup Language (XML)

Tags: macromedia, flash, actionscript 2

Hi, I need flash to display some images from an xml file, into a movieclip placed on the library with an instance name of "myImageHolder"
"myImageHolder" is inside another movieclip named "item".

At the moment I have the images into the array "imgArr" but I don't know how to print them inside that movieclip.

inside  "item" movieclip I have a dynamic text  with an instance name of "txt"
and the empty one "myImageHolder"

Thanks in advance

VicStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
var dataXML:XML = new XML();//create xml object
var titleArr = new Array();//title array object
var urlArr = new Array();//url array object
var imgArr = new Array();//img array object
var originX = Stage.width / 2;//xPos of the middle node
var originY = Stage.height / 2;//yPos of the middle node
var DEPTH = 1000;
var perspective = 500;//change this to get different results
//this is how fast the items spin. The higher you go, the slower it goes.
//You can also make it a negative to get it to rotate the opposite way ie:
//var toRadians = Math.PI / -180;
var toRadians = Math.PI / 180;
 
fscommand("fullscreen", "true")
 
/*Load the XML Data*/
dataXML.ignoreWhite = true;
dataXML.onLoad = function() {
	var pageLength = dataXML.firstChild.childNodes.length;//Length of XML
	cursorLocation._visible = follower._visible = false;
	origin._x = originX;
	origin._y = originY;
	for (i = 0; i < pageLength; i++) {
		var title = dataXML.firstChild.childNodes[i].attributes.title;//title atr in the xml
		var erl = dataXML.firstChild.childNodes[i].attributes.url;//url atr in the xml
		var img = dataXML.firstChild.childNodes[i].attributes.isrc;//img atr in the xml
		var title = title;
		var erlArr = erl;
		titleArr.push(title);//put titles into an array
		urlArr.push(erlArr);//put urls into an array
		imgArr.push(img);//put imgs into an array
	}
	
	buildUI();
};
 
dataXML.load("data.xml");
 
 
function buildUI() {
	cursorLocation._visible = follower._visible = false;
	origin._x = originX;
	origin._y = originY;
	for (var x = 0; x < titleArr.length; x++) {
		temp = this.attachMovie("item", "item" + x, DEPTH++);
		temp.id = x;
		temp.txt.text = titleArr[x];
	
 		myImageHolder.loadMovie(nodes[i].attributes.isrc);
 
		temp.xPosition = (240 - Math.random() * 480);
		temp.yPosition = (100 - Math.random() * 50);
		temp.zPosition = (100 - Math.random() * 160);
		if (int(Math.random() * 100) % 2 > 0) {
			temp.yPosition = temp.yPosition * -1;
		}
		temp.onRelease = function() {
			getURL(urlArr[this.id]);
			/////////////////////////////////////////////
			/*Insert you're own onRelease function here*/
			/////////////////////////////////////////////
		};
		temp.onRollOver = function() {
			trace("You just rolled over "+titleArr[this.id]+imgArr[this.id]);
			//////////////////////////////////////////////
			/*Insert you're own onRollOver function here*/
			//////////////////////////////////////////////
		}
		temp.onRollOut = function() {
			trace("You just rolled over "+titleArr[this.id]);
			/////////////////////////////////////////////
			/*Insert you're own onRollOut function here*/
			/////////////////////////////////////////////
		}
		this.attachMovie("connector","connector" + x,400 + x);
		eval("connector" + x)._x = origin._x;
		eval("connector" + x)._y = origin._y;
		nodes.push(temp);
	}
}
[+][-]02.27.2008 at 08:31PM PST, ID: 21001239

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Macromedia Flash, Extensible Markup Language (XML)
Tags: macromedia, flash, actionscript 2
Sign Up Now!
Solution Provided By: trigger-happy
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628