get nested xml tags in Flash, loop within loop
- northstjarna
- Beginner


- Joined: Nov 14, 2006
- Posts: 58
- Loc: Chertsey, UK
- Status: Offline
Hi there,,
I am trying to get this data into flash. I can get the results for each memeber but, when I put in my nested loop to get the information I get the entire array of all the members or just the end results. Here's a bit of the xml file schema first...
now here is the actionscript so far...
on success I go to the frame label with success and set a menuID to each instance of a movie clip and when I rollover it is suppose to get my list of countries for each person
on my instance of the persons Icon I have this
thumb_hit_area.onRelease = function(){
trace(menuID);
trace(_global.team_member_countries[menuID]);
}
I know it's something to do with my nested for loop.
I'm trying to get the array to look like this.
if anyone can help me get the information into the nested array for each person I would be very greatful
thanks
Andi
I am trying to get this data into flash. I can get the results for each memeber but, when I put in my nested loop to get the information I get the entire array of all the members or just the end results. Here's a bit of the xml file schema first...
Code: [ Select ]
<?xml version="1.0" encoding="iso-8859-1"?>
<coreteam>
<member>
<id>1</id>
<name>Person A</name>
<location>UK</location>
<profile></profile>
<ThumbnailURL></ThumbnailURL>
<photoURL></photoURL>
<countriesVisited>
<country>DB Kenya</country>
<country>DB Rwanda</country>
<country>DB Tanzania</country>
<country>DB Uganda</country>
</countriesVisited>
</member>
<member>
<id>2</id>
<name>Person B</name>
<location>UK</location>
<profile></profile>
<ThumbnailURL></ThumbnailURL>
<photoURL></photoURL>
<countriesVisited>
<country>TC Egypt</country>
<country>TC Tanzania</country>
<country>TC Uganda</country>
</countriesVisited>
</member>
etc etc....
<coreteam>
<member>
<id>1</id>
<name>Person A</name>
<location>UK</location>
<profile></profile>
<ThumbnailURL></ThumbnailURL>
<photoURL></photoURL>
<countriesVisited>
<country>DB Kenya</country>
<country>DB Rwanda</country>
<country>DB Tanzania</country>
<country>DB Uganda</country>
</countriesVisited>
</member>
<member>
<id>2</id>
<name>Person B</name>
<location>UK</location>
<profile></profile>
<ThumbnailURL></ThumbnailURL>
<photoURL></photoURL>
<countriesVisited>
<country>TC Egypt</country>
<country>TC Tanzania</country>
<country>TC Uganda</country>
</countriesVisited>
</member>
etc etc....
- <?xml version="1.0" encoding="iso-8859-1"?>
- <coreteam>
- <member>
- <id>1</id>
- <name>Person A</name>
- <location>UK</location>
- <profile></profile>
- <ThumbnailURL></ThumbnailURL>
- <photoURL></photoURL>
- <countriesVisited>
- <country>DB Kenya</country>
- <country>DB Rwanda</country>
- <country>DB Tanzania</country>
- <country>DB Uganda</country>
- </countriesVisited>
- </member>
- <member>
- <id>2</id>
- <name>Person B</name>
- <location>UK</location>
- <profile></profile>
- <ThumbnailURL></ThumbnailURL>
- <photoURL></photoURL>
- <countriesVisited>
- <country>TC Egypt</country>
- <country>TC Tanzania</country>
- <country>TC Uganda</country>
- </countriesVisited>
- </member>
- etc etc....
now here is the actionscript so far...
Code: [ Select ]
stop();
///set up this default, not worth explaining
XML.prototype.ignoreWhite = true;
///Create a new empty XML Object
var myXMLCoreTeam:XML = new XML();
///load in the xml files
myXMLCoreTeam.load("xml/coreteam.xml"); // xml xource for the core team
myXMLCoreTeam.onLoad = function(success){ //open function statement (1)
var rootNode:XMLNode = myXMLCoreTeam.firstChild;
var contentNode:XMLNode = rootNode.firstChild;
//new array for the total number of childNodes
_global.menuArray = new Array();
_global.menuArray = rootNode.childNodes;
_global.numOfItems = _global.menuArray.length;
_global.team_member_id = new Array();
_global.team_member_name = new Array();
_global.team_member_location = new Array();
_global.team_member_profile = new Array();
_global.team_member_thumbnail = new Array();
_global.team_member_photo = new Array();
_global.team_member_country = new Array();
_global.team_member_countries = new Array();
//set up Arrays for each attribute of each child
for(var i=0;i<=_global.numOfItems;i++){ // (2) For loop - length ends up being the total number of child rows of <flashMenu> in the XML
_global.team_member_id.push(menuArray[i].childNodes[0].childNodes[0].nodeValue);
_global.team_member_name.push(menuArray[i].childNodes[1].childNodes[0].nodeValue);
_global.team_member_location.push(menuArray[i].childNodes[2].childNodes[0].nodeValue);
_global.team_member_profile.push(menuArray[i].childNodes[3].childNodes[0].nodeValue);
_global.team_member_thumbnail.push(menuArray[i].childNodes[4].childNodes[0].nodeValue);
_global.team_member_photo.push(menuArray[i].childNodes[5].childNodes[0].nodeValue);
for(L=0;L<_global.menuArray[i].childNodes[6].childNodes.length;L++){ //for loop for each country, need to assign to each ID
_global.team_member_country[i]=_global.menuArray[i].childNodes[6].childNodes[L].childNodes[0].nodeValue;
trace(_global.team_member_country[i]);
_global.team_member_countries[i] = _global.team_member_country[i];
trace(_global.team_member_countries[i]);
trace(_global.team_member_countries);
}// close loop
} //Close Loop (2)
gotoAndPlay("success");
} //Close function (1)
///set up this default, not worth explaining
XML.prototype.ignoreWhite = true;
///Create a new empty XML Object
var myXMLCoreTeam:XML = new XML();
///load in the xml files
myXMLCoreTeam.load("xml/coreteam.xml"); // xml xource for the core team
myXMLCoreTeam.onLoad = function(success){ //open function statement (1)
var rootNode:XMLNode = myXMLCoreTeam.firstChild;
var contentNode:XMLNode = rootNode.firstChild;
//new array for the total number of childNodes
_global.menuArray = new Array();
_global.menuArray = rootNode.childNodes;
_global.numOfItems = _global.menuArray.length;
_global.team_member_id = new Array();
_global.team_member_name = new Array();
_global.team_member_location = new Array();
_global.team_member_profile = new Array();
_global.team_member_thumbnail = new Array();
_global.team_member_photo = new Array();
_global.team_member_country = new Array();
_global.team_member_countries = new Array();
//set up Arrays for each attribute of each child
for(var i=0;i<=_global.numOfItems;i++){ // (2) For loop - length ends up being the total number of child rows of <flashMenu> in the XML
_global.team_member_id.push(menuArray[i].childNodes[0].childNodes[0].nodeValue);
_global.team_member_name.push(menuArray[i].childNodes[1].childNodes[0].nodeValue);
_global.team_member_location.push(menuArray[i].childNodes[2].childNodes[0].nodeValue);
_global.team_member_profile.push(menuArray[i].childNodes[3].childNodes[0].nodeValue);
_global.team_member_thumbnail.push(menuArray[i].childNodes[4].childNodes[0].nodeValue);
_global.team_member_photo.push(menuArray[i].childNodes[5].childNodes[0].nodeValue);
for(L=0;L<_global.menuArray[i].childNodes[6].childNodes.length;L++){ //for loop for each country, need to assign to each ID
_global.team_member_country[i]=_global.menuArray[i].childNodes[6].childNodes[L].childNodes[0].nodeValue;
trace(_global.team_member_country[i]);
_global.team_member_countries[i] = _global.team_member_country[i];
trace(_global.team_member_countries[i]);
trace(_global.team_member_countries);
}// close loop
} //Close Loop (2)
gotoAndPlay("success");
} //Close function (1)
- stop();
- ///set up this default, not worth explaining
- XML.prototype.ignoreWhite = true;
- ///Create a new empty XML Object
- var myXMLCoreTeam:XML = new XML();
- ///load in the xml files
- myXMLCoreTeam.load("xml/coreteam.xml"); // xml xource for the core team
- myXMLCoreTeam.onLoad = function(success){ //open function statement (1)
- var rootNode:XMLNode = myXMLCoreTeam.firstChild;
- var contentNode:XMLNode = rootNode.firstChild;
- //new array for the total number of childNodes
- _global.menuArray = new Array();
- _global.menuArray = rootNode.childNodes;
- _global.numOfItems = _global.menuArray.length;
- _global.team_member_id = new Array();
- _global.team_member_name = new Array();
- _global.team_member_location = new Array();
- _global.team_member_profile = new Array();
- _global.team_member_thumbnail = new Array();
- _global.team_member_photo = new Array();
- _global.team_member_country = new Array();
- _global.team_member_countries = new Array();
- //set up Arrays for each attribute of each child
- for(var i=0;i<=_global.numOfItems;i++){ // (2) For loop - length ends up being the total number of child rows of <flashMenu> in the XML
- _global.team_member_id.push(menuArray[i].childNodes[0].childNodes[0].nodeValue);
- _global.team_member_name.push(menuArray[i].childNodes[1].childNodes[0].nodeValue);
- _global.team_member_location.push(menuArray[i].childNodes[2].childNodes[0].nodeValue);
- _global.team_member_profile.push(menuArray[i].childNodes[3].childNodes[0].nodeValue);
- _global.team_member_thumbnail.push(menuArray[i].childNodes[4].childNodes[0].nodeValue);
- _global.team_member_photo.push(menuArray[i].childNodes[5].childNodes[0].nodeValue);
- for(L=0;L<_global.menuArray[i].childNodes[6].childNodes.length;L++){ //for loop for each country, need to assign to each ID
- _global.team_member_country[i]=_global.menuArray[i].childNodes[6].childNodes[L].childNodes[0].nodeValue;
- trace(_global.team_member_country[i]);
- _global.team_member_countries[i] = _global.team_member_country[i];
- trace(_global.team_member_countries[i]);
- trace(_global.team_member_countries);
- }// close loop
- } //Close Loop (2)
- gotoAndPlay("success");
- } //Close function (1)
on success I go to the frame label with success and set a menuID to each instance of a movie clip and when I rollover it is suppose to get my list of countries for each person
Code: [ Select ]
L = 0;
pushoverX = 72;
pushoverY = (Stage.width/(_global.numOfItems/2))/2;
while(L<_global.numOfItems){//open loop (1)
this.attachMovie("thumbnail_container", "thumbnail_container" + L, (-L) , {_x:pushoverX ,_y:pushoverY});
set("thumbnail_container" + L + ".menuID" , L);
with (eval("thumbnail_container" + L )){
thumbnail_txt = _global.team_member_name[L];
}// end with evaluation
pushoverX = pushoverX + thumbnail_container0._width + _global.Xmargin;
if(pushoverX >= Stage.width - thumbnail_container0._width - _global.Xmargin){
pushoverY= pushoverY + thumbnail_container0._height + _global.Ymargin;
pushoverX= 72;
}
L=L+1;
} // closes loop (1)
pushoverX = 72;
pushoverY = (Stage.width/(_global.numOfItems/2))/2;
while(L<_global.numOfItems){//open loop (1)
this.attachMovie("thumbnail_container", "thumbnail_container" + L, (-L) , {_x:pushoverX ,_y:pushoverY});
set("thumbnail_container" + L + ".menuID" , L);
with (eval("thumbnail_container" + L )){
thumbnail_txt = _global.team_member_name[L];
}// end with evaluation
pushoverX = pushoverX + thumbnail_container0._width + _global.Xmargin;
if(pushoverX >= Stage.width - thumbnail_container0._width - _global.Xmargin){
pushoverY= pushoverY + thumbnail_container0._height + _global.Ymargin;
pushoverX= 72;
}
L=L+1;
} // closes loop (1)
- L = 0;
- pushoverX = 72;
- pushoverY = (Stage.width/(_global.numOfItems/2))/2;
- while(L<_global.numOfItems){//open loop (1)
- this.attachMovie("thumbnail_container", "thumbnail_container" + L, (-L) , {_x:pushoverX ,_y:pushoverY});
- set("thumbnail_container" + L + ".menuID" , L);
- with (eval("thumbnail_container" + L )){
- thumbnail_txt = _global.team_member_name[L];
- }// end with evaluation
- pushoverX = pushoverX + thumbnail_container0._width + _global.Xmargin;
- if(pushoverX >= Stage.width - thumbnail_container0._width - _global.Xmargin){
- pushoverY= pushoverY + thumbnail_container0._height + _global.Ymargin;
- pushoverX= 72;
- }
- L=L+1;
- } // closes loop (1)
on my instance of the persons Icon I have this
Code: [ Select ]
thumb_hit_area.onRelease = function(){
trace(menuID);
trace(_global.team_member_countries[menuID]);
}
- thumb_hit_area.onRelease = function(){
- trace(menuID);
- trace(_global.team_member_countries[menuID]);
- }
I know it's something to do with my nested for loop.
I'm trying to get the array to look like this.
Code: [ Select ]
var ticTacToe:Array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
trace(ticTacToe[0]);// output: 1,2,3
trace(ticTacToe[0]);// output: 1,2,3
- var ticTacToe:Array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
- trace(ticTacToe[0]);// output: 1,2,3
if anyone can help me get the information into the nested array for each person I would be very greatful
thanks
Andi
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
January 21st, 2007, 5:30 am
- IceCold
- Guru


- Joined: Nov 05, 2004
- Posts: 1254
- Loc: Ro
- Status: Offline
wooow, you sure are a global and old style user
From my point of view, i'd use directly movieclips instead of arrays ... or objects. They make life easier.
Maybe your mistake lies within this code:
If thumbnail_txt is not a variable for the dynamic text, then you should use:
thumbnail_txt.text = _global.team_member_name[L];
If it is a variable, then you might want to embed the font. Stage -> select the text from the movieclip-> goto properties panel -> Character button -> check Specify Ranges and select Basic Latin.
Anyway, consider this code:
From my point of view, i'd use directly movieclips instead of arrays ... or objects. They make life easier.
Maybe your mistake lies within this code:
Code: [ Select ]
with (eval("thumbnail_container" + L )){
thumbnail_txt = _global.team_member_name[L];
}
thumbnail_txt = _global.team_member_name[L];
}
- with (eval("thumbnail_container" + L )){
- thumbnail_txt = _global.team_member_name[L];
- }
If thumbnail_txt is not a variable for the dynamic text, then you should use:
thumbnail_txt.text = _global.team_member_name[L];
If it is a variable, then you might want to embed the font. Stage -> select the text from the movieclip-> goto properties panel -> Character button -> check Specify Ranges and select Basic Latin.
Anyway, consider this code:
Code: [ Select ]
XML.prototype.ignoreWhite = true;
///Create a new empty XML Object
var myXMLCoreTeam:XML = new XML();
///load in the xml files
myXMLCoreTeam.load("coreteam.xml"); // xml xource for the core team
myXMLCoreTeam.onLoad = function(success)
{
ProcessXMLData();
}
function ProcessXMLData()
{
var rootNode:XMLNode = myXMLCoreTeam.firstChild;
var contentNode:XMLNode = rootNode.firstChild;
menuArray = rootNode.childNodes;
var numOfItems = menuArray.length;
var pushoverX = 72;
var pushoverY = (Stage.width/(numOfItems/2))/2;
var iIndex, iNodeIndex0, iNodeIndex1, iNodeIndex2;
for (iNodeIndex0 = 0; iNodeIndex0<numOfItems; iNodeIndex0++)
{
var crtMember = rootNode.childNodes[iNodeIndex0];
var crtMC = this.createEmptyMovieClip("member" + iNodeIndex0, iNodeIndex0);
iNodeIndex1 = 0;
crtMC.ID = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.sName = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.sLocation = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.profile = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.thumbnailURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.photoURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.countriesVisited = new Array();
// countries
var VisitedCountry = crtMember.childNodes[iNodeIndex1];
var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++)
crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
// atach thumbnail_container for each member
crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
crtMC.thumbnail_container.thumbnail_txt.text = crtMC.countriesVisited;
pushoverX += thumbnail_container._width + Xmargin;
if(pushoverX >= Stage.width - crtMC.thumbnail_container._width - Xmargin)
{
pushoverY += crtMC.humbnail_container._height + Ymargin;
pushoverX= 72;
}
}
}
var menuArray = new Array();
var Xmargin = 20;
var Ymargin = 30;
stop();
///Create a new empty XML Object
var myXMLCoreTeam:XML = new XML();
///load in the xml files
myXMLCoreTeam.load("coreteam.xml"); // xml xource for the core team
myXMLCoreTeam.onLoad = function(success)
{
ProcessXMLData();
}
function ProcessXMLData()
{
var rootNode:XMLNode = myXMLCoreTeam.firstChild;
var contentNode:XMLNode = rootNode.firstChild;
menuArray = rootNode.childNodes;
var numOfItems = menuArray.length;
var pushoverX = 72;
var pushoverY = (Stage.width/(numOfItems/2))/2;
var iIndex, iNodeIndex0, iNodeIndex1, iNodeIndex2;
for (iNodeIndex0 = 0; iNodeIndex0<numOfItems; iNodeIndex0++)
{
var crtMember = rootNode.childNodes[iNodeIndex0];
var crtMC = this.createEmptyMovieClip("member" + iNodeIndex0, iNodeIndex0);
iNodeIndex1 = 0;
crtMC.ID = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.sName = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.sLocation = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.profile = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.thumbnailURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.photoURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.countriesVisited = new Array();
// countries
var VisitedCountry = crtMember.childNodes[iNodeIndex1];
var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++)
crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
// atach thumbnail_container for each member
crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
crtMC.thumbnail_container.thumbnail_txt.text = crtMC.countriesVisited;
pushoverX += thumbnail_container._width + Xmargin;
if(pushoverX >= Stage.width - crtMC.thumbnail_container._width - Xmargin)
{
pushoverY += crtMC.humbnail_container._height + Ymargin;
pushoverX= 72;
}
}
}
var menuArray = new Array();
var Xmargin = 20;
var Ymargin = 30;
stop();
- XML.prototype.ignoreWhite = true;
- ///Create a new empty XML Object
- var myXMLCoreTeam:XML = new XML();
- ///load in the xml files
- myXMLCoreTeam.load("coreteam.xml"); // xml xource for the core team
- myXMLCoreTeam.onLoad = function(success)
- {
- ProcessXMLData();
- }
- function ProcessXMLData()
- {
- var rootNode:XMLNode = myXMLCoreTeam.firstChild;
- var contentNode:XMLNode = rootNode.firstChild;
- menuArray = rootNode.childNodes;
- var numOfItems = menuArray.length;
- var pushoverX = 72;
- var pushoverY = (Stage.width/(numOfItems/2))/2;
- var iIndex, iNodeIndex0, iNodeIndex1, iNodeIndex2;
- for (iNodeIndex0 = 0; iNodeIndex0<numOfItems; iNodeIndex0++)
- {
- var crtMember = rootNode.childNodes[iNodeIndex0];
- var crtMC = this.createEmptyMovieClip("member" + iNodeIndex0, iNodeIndex0);
- iNodeIndex1 = 0;
- crtMC.ID = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.sName = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.sLocation = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.profile = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.thumbnailURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.photoURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.countriesVisited = new Array();
- // countries
- var VisitedCountry = crtMember.childNodes[iNodeIndex1];
- var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
- for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++)
- crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
- // atach thumbnail_container for each member
- crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
- crtMC.thumbnail_container.thumbnail_txt.text = crtMC.countriesVisited;
- pushoverX += thumbnail_container._width + Xmargin;
- if(pushoverX >= Stage.width - crtMC.thumbnail_container._width - Xmargin)
- {
- pushoverY += crtMC.humbnail_container._height + Ymargin;
- pushoverX= 72;
- }
- }
- }
- var menuArray = new Array();
- var Xmargin = 20;
- var Ymargin = 30;
- stop();
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
- northstjarna
- Beginner


- Joined: Nov 14, 2006
- Posts: 58
- Loc: Chertsey, UK
- Status: Offline
- northstjarna
- Beginner


- Joined: Nov 14, 2006
- Posts: 58
- Loc: Chertsey, UK
- Status: Offline
Hi there,
thanks for your help. This code didn't help me much, as it created the movie clips but did not spread them out evenly accross the stage 550 X 420. I had to take the attach movie clips out of the nested loop. I also amended so that it would give a new instance name otherwise it did not work.
I have amended it. It almost works. Each Icon or thumbnail should return information about that person, and a seperate array for the countries they have been to.
OK, so I am having trouble setting a unique ID to each movie clip. with this code here...
the function is also returning the last know result in the array, and soes not work if you put it as
trace(crtMC.sName[iNodeIndex0]);
it's why I must try to set the ID of each, I am almost there. The clips are laid out and the names of each person assigned to the dynamic text. But its the function when I click on them that's causing the trouble.
Thanks
Andi
[/quote][/code]
thanks for your help. This code didn't help me much, as it created the movie clips but did not spread them out evenly accross the stage 550 X 420. I had to take the attach movie clips out of the nested loop. I also amended so that it would give a new instance name otherwise it did not work.
I have amended it. It almost works. Each Icon or thumbnail should return information about that person, and a seperate array for the countries they have been to.
Code: [ Select ]
XML.prototype.ignoreWhite = true;
///Create a new empty XML Object
var myXMLCoreTeam:XML = new XML();
///load in the xml files
myXMLCoreTeam.load("xml/coreteam.xml"); // xml xource for the core team
myXMLCoreTeam.onLoad = function(success)
{
ProcessXMLData();
}
function ProcessXMLData()
{
var rootNode:XMLNode = myXMLCoreTeam.firstChild;
var contentNode:XMLNode = rootNode.firstChild;
menuArray = rootNode.childNodes;
var numOfItems = menuArray.length;
var pushoverX = 72;
var pushoverY = (Stage.width/(numOfItems/2))/2;
var iIndex, iNodeIndex0, iNodeIndex1, iNodeIndex2;
for (iNodeIndex0 = 0; iNodeIndex0<numOfItems; iNodeIndex0++)
{
var crtMember = rootNode.childNodes[iNodeIndex0];
var crtMC = this.createEmptyMovieClip("member" + iNodeIndex0, iNodeIndex0);
iNodeIndex1 = 0;
crtMC.ID = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.sName = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.sLocation = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.profile = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.thumbnailURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.photoURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
// atach thumbnail_container for each member
crtMC.attachMovie("thumbnail_container", "thumbnail_container" + iNodeIndex0, (-iNodeIndex0), {_x:pushoverX ,_y:pushoverY});
set("crtMC.thumbnail_container" + iNodeIndex0 + ".thumbnailID", iNodeIndex0);
with(eval("crtMC.thumbnail_container" + iNodeIndex0)){
thumbnail_txt = crtMC.sName;
var thumbnailWidth = _parent._width;
var thumbnailHeight = _parent._height;
thumb_hit_area.onRelease = function(){
trace(crtMC.sName);
}
}
pushoverX += thumbnailWidth + Xmargin;
if(pushoverX >= Stage.width -thumbnailWidth - Xmargin)
{
pushoverY += thumbnailHeight + Ymargin;
pushoverX= 72;
}
// countries
crtMC.countriesVisited = new Array();
var VisitedCountry = crtMember.childNodes[iNodeIndex1];
var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++)
crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
}
}
var menuArray = new Array();
var Xmargin = 36;
var Ymargin = 24;
stop();
///Create a new empty XML Object
var myXMLCoreTeam:XML = new XML();
///load in the xml files
myXMLCoreTeam.load("xml/coreteam.xml"); // xml xource for the core team
myXMLCoreTeam.onLoad = function(success)
{
ProcessXMLData();
}
function ProcessXMLData()
{
var rootNode:XMLNode = myXMLCoreTeam.firstChild;
var contentNode:XMLNode = rootNode.firstChild;
menuArray = rootNode.childNodes;
var numOfItems = menuArray.length;
var pushoverX = 72;
var pushoverY = (Stage.width/(numOfItems/2))/2;
var iIndex, iNodeIndex0, iNodeIndex1, iNodeIndex2;
for (iNodeIndex0 = 0; iNodeIndex0<numOfItems; iNodeIndex0++)
{
var crtMember = rootNode.childNodes[iNodeIndex0];
var crtMC = this.createEmptyMovieClip("member" + iNodeIndex0, iNodeIndex0);
iNodeIndex1 = 0;
crtMC.ID = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.sName = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.sLocation = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.profile = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.thumbnailURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.photoURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
// atach thumbnail_container for each member
crtMC.attachMovie("thumbnail_container", "thumbnail_container" + iNodeIndex0, (-iNodeIndex0), {_x:pushoverX ,_y:pushoverY});
set("crtMC.thumbnail_container" + iNodeIndex0 + ".thumbnailID", iNodeIndex0);
with(eval("crtMC.thumbnail_container" + iNodeIndex0)){
thumbnail_txt = crtMC.sName;
var thumbnailWidth = _parent._width;
var thumbnailHeight = _parent._height;
thumb_hit_area.onRelease = function(){
trace(crtMC.sName);
}
}
pushoverX += thumbnailWidth + Xmargin;
if(pushoverX >= Stage.width -thumbnailWidth - Xmargin)
{
pushoverY += thumbnailHeight + Ymargin;
pushoverX= 72;
}
// countries
crtMC.countriesVisited = new Array();
var VisitedCountry = crtMember.childNodes[iNodeIndex1];
var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++)
crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
}
}
var menuArray = new Array();
var Xmargin = 36;
var Ymargin = 24;
stop();
- XML.prototype.ignoreWhite = true;
- ///Create a new empty XML Object
- var myXMLCoreTeam:XML = new XML();
- ///load in the xml files
- myXMLCoreTeam.load("xml/coreteam.xml"); // xml xource for the core team
- myXMLCoreTeam.onLoad = function(success)
- {
- ProcessXMLData();
- }
- function ProcessXMLData()
- {
- var rootNode:XMLNode = myXMLCoreTeam.firstChild;
- var contentNode:XMLNode = rootNode.firstChild;
- menuArray = rootNode.childNodes;
- var numOfItems = menuArray.length;
- var pushoverX = 72;
- var pushoverY = (Stage.width/(numOfItems/2))/2;
- var iIndex, iNodeIndex0, iNodeIndex1, iNodeIndex2;
- for (iNodeIndex0 = 0; iNodeIndex0<numOfItems; iNodeIndex0++)
- {
- var crtMember = rootNode.childNodes[iNodeIndex0];
- var crtMC = this.createEmptyMovieClip("member" + iNodeIndex0, iNodeIndex0);
- iNodeIndex1 = 0;
- crtMC.ID = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.sName = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.sLocation = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.profile = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.thumbnailURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.photoURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- // atach thumbnail_container for each member
- crtMC.attachMovie("thumbnail_container", "thumbnail_container" + iNodeIndex0, (-iNodeIndex0), {_x:pushoverX ,_y:pushoverY});
- set("crtMC.thumbnail_container" + iNodeIndex0 + ".thumbnailID", iNodeIndex0);
- with(eval("crtMC.thumbnail_container" + iNodeIndex0)){
- thumbnail_txt = crtMC.sName;
- var thumbnailWidth = _parent._width;
- var thumbnailHeight = _parent._height;
- thumb_hit_area.onRelease = function(){
- trace(crtMC.sName);
- }
- }
- pushoverX += thumbnailWidth + Xmargin;
- if(pushoverX >= Stage.width -thumbnailWidth - Xmargin)
- {
- pushoverY += thumbnailHeight + Ymargin;
- pushoverX= 72;
- }
- // countries
- crtMC.countriesVisited = new Array();
- var VisitedCountry = crtMember.childNodes[iNodeIndex1];
- var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
- for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++)
- crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
- }
- }
- var menuArray = new Array();
- var Xmargin = 36;
- var Ymargin = 24;
- stop();
OK, so I am having trouble setting a unique ID to each movie clip. with this code here...
Code: [ Select ]
crtMC.attachMovie("thumbnail_container", "thumbnail_container" + iNodeIndex0, (-iNodeIndex0), {_x:pushoverX ,_y:pushoverY});
set("crtMC.thumbnail_container" + iNodeIndex0 + ".thumbnailID", iNodeIndex0);
with(eval("crtMC.thumbnail_container" + iNodeIndex0)){
thumbnail_txt = crtMC.sName;
var thumbnailWidth = _parent._width;
var thumbnailHeight = _parent._height;
thumb_hit_area.onRelease = function(){
trace(crtMC.sName);
}
}
set("crtMC.thumbnail_container" + iNodeIndex0 + ".thumbnailID", iNodeIndex0);
with(eval("crtMC.thumbnail_container" + iNodeIndex0)){
thumbnail_txt = crtMC.sName;
var thumbnailWidth = _parent._width;
var thumbnailHeight = _parent._height;
thumb_hit_area.onRelease = function(){
trace(crtMC.sName);
}
}
- crtMC.attachMovie("thumbnail_container", "thumbnail_container" + iNodeIndex0, (-iNodeIndex0), {_x:pushoverX ,_y:pushoverY});
- set("crtMC.thumbnail_container" + iNodeIndex0 + ".thumbnailID", iNodeIndex0);
- with(eval("crtMC.thumbnail_container" + iNodeIndex0)){
- thumbnail_txt = crtMC.sName;
- var thumbnailWidth = _parent._width;
- var thumbnailHeight = _parent._height;
- thumb_hit_area.onRelease = function(){
- trace(crtMC.sName);
- }
- }
the function is also returning the last know result in the array, and soes not work if you put it as
trace(crtMC.sName[iNodeIndex0]);
it's why I must try to set the ID of each, I am almost there. The clips are laid out and the names of each person assigned to the dynamic text. But its the function when I click on them that's causing the trouble.
Thanks
Andi
[/quote][/code]
- northstjarna
- Beginner


- Joined: Nov 14, 2006
- Posts: 58
- Loc: Chertsey, UK
- Status: Offline
ok just got the setting of ID with this
Code: [ Select ]
set(crtMC+ ".thumbnail_container" + iNodeIndex0 +".thumbID", iNodeIndex0);
- IceCold
- Guru


- Joined: Nov 05, 2004
- Posts: 1254
- Loc: Ro
- Status: Offline
ohhh nooo, don't go old style again.
set(crtMC+ ".thumbnail_container" + iNodeIndex0 +".thumbID", iNodeIndex0);
is the same as
crtMC["thumbnail_container"+iNodeIndex0].thumbID = iNodeIndex0;
And i'm not sure what exactly you trying to do there.
Probably you didn't understand exactly what i did up there. Let me explain it to you.
I create a movieclip for each member, set it's properties (ID, name, location ....), then attach in every member movieclip one single thumbnail_container, since i presume you use only one thumbnail for each member. All you had to do was to dynamically arrange the movieclips on the stage, not to get the thumbnails out of the member movieclips.
If i'm wrong please let me know.
set(crtMC+ ".thumbnail_container" + iNodeIndex0 +".thumbID", iNodeIndex0);
is the same as
crtMC["thumbnail_container"+iNodeIndex0].thumbID = iNodeIndex0;
And i'm not sure what exactly you trying to do there.
Probably you didn't understand exactly what i did up there. Let me explain it to you.
I create a movieclip for each member, set it's properties (ID, name, location ....), then attach in every member movieclip one single thumbnail_container, since i presume you use only one thumbnail for each member. All you had to do was to dynamically arrange the movieclips on the stage, not to get the thumbnails out of the member movieclips.
If i'm wrong please let me know.
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
- northstjarna
- Beginner


- Joined: Nov 14, 2006
- Posts: 58
- Loc: Chertsey, UK
- Status: Offline
Sorry.... I am not so good with the new style, lots to learn.
Ok I'll describe what we are trying to achieve here.
I am building a portfolio for a charity organisation.
There is a portfolio which I am building which will load into the main load box on the site. It will be stored as a seperate swf on the server and called into the loadbox when clicked on the portfolio icon. (or the page will end up massive..
So I have and XML file for this swf (see the schema above)
For Each member there is a number of countries which they have done work in.
so from the first set of childnodes in the menuArray we get the basic info about the person, and loads in an icon for each one. When you click in the icon I want to load in the list of each country that person has done work in.
So you get this:
Member A : Tanzania
: Uganda
: Kenya
Menmber B : Ghana
: Uganda
The problem I had was returning all the Countries into a list. component ... addItem in the childnodes of the country
I can get all the countries as a single item in an Array, but not as a list
IE I got
TanzaniaAfricaKenya
instead of
Tanzania
Africa
Kenya
hope this explains better.
Thanks
Andi
Ok I'll describe what we are trying to achieve here.
I am building a portfolio for a charity organisation.
There is a portfolio which I am building which will load into the main load box on the site. It will be stored as a seperate swf on the server and called into the loadbox when clicked on the portfolio icon. (or the page will end up massive..
So I have and XML file for this swf (see the schema above)
For Each member there is a number of countries which they have done work in.
so from the first set of childnodes in the menuArray we get the basic info about the person, and loads in an icon for each one. When you click in the icon I want to load in the list of each country that person has done work in.
So you get this:
Member A : Tanzania
: Uganda
: Kenya
Menmber B : Ghana
: Uganda
The problem I had was returning all the Countries into a list. component ... addItem in the childnodes of the country
I can get all the countries as a single item in an Array, but not as a list
IE I got
TanzaniaAfricaKenya
instead of
Tanzania
Africa
Kenya
hope this explains better.
Thanks
Andi
- IceCold
- Guru


- Joined: Nov 05, 2004
- Posts: 1254
- Loc: Ro
- Status: Offline
that's because you pass the array to the list, not each member of the array separated by a "\n" (end of line).
What you need is (i work here on my example, provided upper):
also make sure that thumbnail_txt is a multiline dynamic text
What you need is (i work here on my example, provided upper):
Code: [ Select ]
// countries
var VisitedCountry = crtMember.childNodes[iNodeIndex1];
var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++)
crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
// atach thumbnail_container for each member
crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
// here is the change made
for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++)
crtMC.thumbnail_container.thumbnail_txt.text = crtMC.countriesVisited[iNodeIndex2] + "\n";
var VisitedCountry = crtMember.childNodes[iNodeIndex1];
var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++)
crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
// atach thumbnail_container for each member
crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
// here is the change made
for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++)
crtMC.thumbnail_container.thumbnail_txt.text = crtMC.countriesVisited[iNodeIndex2] + "\n";
- // countries
- var VisitedCountry = crtMember.childNodes[iNodeIndex1];
- var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
- for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++)
- crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
- // atach thumbnail_container for each member
- crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
- // here is the change made
- for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++)
- crtMC.thumbnail_container.thumbnail_txt.text = crtMC.countriesVisited[iNodeIndex2] + "\n";
also make sure that thumbnail_txt is a multiline dynamic text
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
- northstjarna
- Beginner


- Joined: Nov 14, 2006
- Posts: 58
- Loc: Chertsey, UK
- Status: Offline
Hi there thanks for that...
I now understand almost everything here.
The reason it didn't work first time is that there were a few spelling mistakes and now they are corrected, everything loads in.
heres the code I have now.
Ok I had to make some small changes, as the dynamic text in the thumbnail contains the name of each person. What I am trying to do is return the countries when that thumbnail is clicked on.
the code here is supposed to trace this however is comming back with the last known person or undefined..
I was hoping that the array of items for each thumbnail would be something more like this, by referring the array back to the first index Node...
crtMC.countriesVisited[iNodeIndex0]= VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
I feel I nearly there.. a bit like there and back again by Bilbo Baggins.
Cheers
Andi
I now understand almost everything here.
The reason it didn't work first time is that there were a few spelling mistakes and now they are corrected, everything loads in.
heres the code I have now.
Code: [ Select ]
XML.prototype.ignoreWhite = true;
///Create a new empty XML Object
var myXMLCoreTeam:XML = new XML();
///load in the xml files
myXMLCoreTeam.load("xml/coreteam.xml"); // xml xource for the core team
myXMLCoreTeam.onLoad = function(success){
ProcessXMLData();
}
function ProcessXMLData()
{
/// First set of Variables and Arrays
var rootNode:XMLNode = myXMLCoreTeam.firstChild;
/// var contentNode:XMLNode = rootNode.firstChild; //// do we actually need this?
menuArray = rootNode.childNodes;
var numOfItems = menuArray.length;
var pushoverX = 72;
var pushoverY = (Stage.width/(numOfItems/2))/2;
var iIndex, iNodeIndex0, iNodeIndex1, iNodeIndex2;
//// First For Loop
for (iNodeIndex0 = 0; iNodeIndex0<numOfItems; iNodeIndex0++){
iNodeIndex1 = 0;
var crtMember = rootNode.childNodes[iNodeIndex0];
var crtMC = this.createEmptyMovieClip("member" + iNodeIndex0, iNodeIndex0);
crtMC.ID = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.sName = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.sLocation = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.profile = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.thumbnailURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.photoURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.countriesVisited = new Array();
// countries
var VisitedCountry = crtMember.childNodes[iNodeIndex1];
var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
// here is the change made
for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++){
// attach thumbnail_container for each member
crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
crtMC.thumbnail_container.thumbnail_txt = crtMC.sName + "\n"; /// changed the text to reflect the members name
crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
crtMC.thumbnail_container.onRelease = function(){
trace(crtMC.countriesVisited[0]);
}//close imediate function
} // close loop iNodeIndex2
pushoverX += crtMC.thumbnail_container._width + Xmargin; /// had to add in the crtMC.
if(pushoverX >= Stage.width - crtMC.thumbnail_container._width - Xmargin) /// was mispelled, so corrected
{
pushoverY += crtMC.thumbnail_container._height + Ymargin;
pushoverX= 72;
}// close if statement
}// close loop iNodeIndex0
}// End Function
//var menuArray = new Array(); /// is this needed now?
var Xmargin = 20;
var Ymargin = 30;
stop();
///Create a new empty XML Object
var myXMLCoreTeam:XML = new XML();
///load in the xml files
myXMLCoreTeam.load("xml/coreteam.xml"); // xml xource for the core team
myXMLCoreTeam.onLoad = function(success){
ProcessXMLData();
}
function ProcessXMLData()
{
/// First set of Variables and Arrays
var rootNode:XMLNode = myXMLCoreTeam.firstChild;
/// var contentNode:XMLNode = rootNode.firstChild; //// do we actually need this?
menuArray = rootNode.childNodes;
var numOfItems = menuArray.length;
var pushoverX = 72;
var pushoverY = (Stage.width/(numOfItems/2))/2;
var iIndex, iNodeIndex0, iNodeIndex1, iNodeIndex2;
//// First For Loop
for (iNodeIndex0 = 0; iNodeIndex0<numOfItems; iNodeIndex0++){
iNodeIndex1 = 0;
var crtMember = rootNode.childNodes[iNodeIndex0];
var crtMC = this.createEmptyMovieClip("member" + iNodeIndex0, iNodeIndex0);
crtMC.ID = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.sName = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.sLocation = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.profile = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.thumbnailURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.photoURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
crtMC.countriesVisited = new Array();
// countries
var VisitedCountry = crtMember.childNodes[iNodeIndex1];
var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
// here is the change made
for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++){
// attach thumbnail_container for each member
crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
crtMC.thumbnail_container.thumbnail_txt = crtMC.sName + "\n"; /// changed the text to reflect the members name
crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
crtMC.thumbnail_container.onRelease = function(){
trace(crtMC.countriesVisited[0]);
}//close imediate function
} // close loop iNodeIndex2
pushoverX += crtMC.thumbnail_container._width + Xmargin; /// had to add in the crtMC.
if(pushoverX >= Stage.width - crtMC.thumbnail_container._width - Xmargin) /// was mispelled, so corrected
{
pushoverY += crtMC.thumbnail_container._height + Ymargin;
pushoverX= 72;
}// close if statement
}// close loop iNodeIndex0
}// End Function
//var menuArray = new Array(); /// is this needed now?
var Xmargin = 20;
var Ymargin = 30;
stop();
- XML.prototype.ignoreWhite = true;
- ///Create a new empty XML Object
- var myXMLCoreTeam:XML = new XML();
- ///load in the xml files
- myXMLCoreTeam.load("xml/coreteam.xml"); // xml xource for the core team
- myXMLCoreTeam.onLoad = function(success){
- ProcessXMLData();
- }
- function ProcessXMLData()
- {
- /// First set of Variables and Arrays
- var rootNode:XMLNode = myXMLCoreTeam.firstChild;
- /// var contentNode:XMLNode = rootNode.firstChild; //// do we actually need this?
- menuArray = rootNode.childNodes;
- var numOfItems = menuArray.length;
- var pushoverX = 72;
- var pushoverY = (Stage.width/(numOfItems/2))/2;
- var iIndex, iNodeIndex0, iNodeIndex1, iNodeIndex2;
- //// First For Loop
- for (iNodeIndex0 = 0; iNodeIndex0<numOfItems; iNodeIndex0++){
- iNodeIndex1 = 0;
- var crtMember = rootNode.childNodes[iNodeIndex0];
- var crtMC = this.createEmptyMovieClip("member" + iNodeIndex0, iNodeIndex0);
- crtMC.ID = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.sName = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.sLocation = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.profile = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.thumbnailURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.photoURL = crtMember.childNodes[iNodeIndex1++].firstChild.nodeValue;
- crtMC.countriesVisited = new Array();
- // countries
- var VisitedCountry = crtMember.childNodes[iNodeIndex1];
- var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
- // here is the change made
- for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++){
- // attach thumbnail_container for each member
- crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
- crtMC.thumbnail_container.thumbnail_txt = crtMC.sName + "\n"; /// changed the text to reflect the members name
- crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
- crtMC.thumbnail_container.onRelease = function(){
- trace(crtMC.countriesVisited[0]);
- }//close imediate function
- } // close loop iNodeIndex2
- pushoverX += crtMC.thumbnail_container._width + Xmargin; /// had to add in the crtMC.
- if(pushoverX >= Stage.width - crtMC.thumbnail_container._width - Xmargin) /// was mispelled, so corrected
- {
- pushoverY += crtMC.thumbnail_container._height + Ymargin;
- pushoverX= 72;
- }// close if statement
- }// close loop iNodeIndex0
- }// End Function
- //var menuArray = new Array(); /// is this needed now?
- var Xmargin = 20;
- var Ymargin = 30;
- stop();
Ok I had to make some small changes, as the dynamic text in the thumbnail contains the name of each person. What I am trying to do is return the countries when that thumbnail is clicked on.
the code here is supposed to trace this however is comming back with the last known person or undefined..
Code: [ Select ]
// attach thumbnail_container for each member
crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
crtMC.thumbnail_container.thumbnail_txt = crtMC.sName + "\n"; /// changed the text to reflect the members name
crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
crtMC.thumbnail_container.onRelease = function(){
trace(crtMC.countriesVisited[0]);
}//close imediate function
} // close loop iNodeIndex2
crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
crtMC.thumbnail_container.thumbnail_txt = crtMC.sName + "\n"; /// changed the text to reflect the members name
crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
crtMC.thumbnail_container.onRelease = function(){
trace(crtMC.countriesVisited[0]);
}//close imediate function
} // close loop iNodeIndex2
- // attach thumbnail_container for each member
- crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
- crtMC.thumbnail_container.thumbnail_txt = crtMC.sName + "\n"; /// changed the text to reflect the members name
- crtMC.countriesVisited[iNodeIndex2] = VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
- crtMC.thumbnail_container.onRelease = function(){
- trace(crtMC.countriesVisited[0]);
- }//close imediate function
- } // close loop iNodeIndex2
I was hoping that the array of items for each thumbnail would be something more like this, by referring the array back to the first index Node...
crtMC.countriesVisited[iNodeIndex0]= VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
Code: [ Select ]
crtMC.countriesVisited[iNodeIndex0]= VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
crtMC.thumbnail_container.onRelease = function(){
trace(crtMC.countriesVisited[0]);
}//close imediate function
} // close loop iNodeIndex2
crtMC.thumbnail_container.onRelease = function(){
trace(crtMC.countriesVisited[0]);
}//close imediate function
} // close loop iNodeIndex2
- crtMC.countriesVisited[iNodeIndex0]= VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue;
- crtMC.thumbnail_container.onRelease = function(){
- trace(crtMC.countriesVisited[0]);
- }//close imediate function
- } // close loop iNodeIndex2
I feel I nearly there.. a bit like there and back again by Bilbo Baggins.
Cheers
Andi
- northstjarna
- Beginner


- Joined: Nov 14, 2006
- Posts: 58
- Loc: Chertsey, UK
- Status: Offline
Ok this works into a dynamic text area.
by jove, he's nearly there...
Code: [ Select ]
// countries
var VisitedCountry = crtMember.childNodes[iNodeIndex1];
var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
// attach thumbnail_container for each member
crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
crtMC.thumbnail_container.thumbnail_txt = crtMC.sName; /// changed the text to reflect the members name
// here is the change made
for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++){
crtMC.countriesVisited.push(VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue);
crtMC.thumbnail_container.countries_txt = crtMC.thumbnail_container.countries_txt + "\n" + crtMC.countriesVisited[iNodeIndex2];
} // close loop iNodeIndex2
var VisitedCountry = crtMember.childNodes[iNodeIndex1];
var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
// attach thumbnail_container for each member
crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
crtMC.thumbnail_container.thumbnail_txt = crtMC.sName; /// changed the text to reflect the members name
// here is the change made
for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++){
crtMC.countriesVisited.push(VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue);
crtMC.thumbnail_container.countries_txt = crtMC.thumbnail_container.countries_txt + "\n" + crtMC.countriesVisited[iNodeIndex2];
} // close loop iNodeIndex2
- // countries
- var VisitedCountry = crtMember.childNodes[iNodeIndex1];
- var numOfCountries = crtMember.childNodes[iNodeIndex1].childNodes.length;
- // attach thumbnail_container for each member
- crtMC.attachMovie("thumbnail_container", "thumbnail_container", 0, {_x:pushoverX ,_y:pushoverY});
- crtMC.thumbnail_container.thumbnail_txt = crtMC.sName; /// changed the text to reflect the members name
- // here is the change made
- for (iNodeIndex2 = 0; iNodeIndex2 < numOfCountries; iNodeIndex2++){
- crtMC.countriesVisited.push(VisitedCountry.childNodes[iNodeIndex2].firstChild.nodeValue);
- crtMC.thumbnail_container.countries_txt = crtMC.thumbnail_container.countries_txt + "\n" + crtMC.countriesVisited[iNodeIndex2];
- } // close loop iNodeIndex2
by jove, he's nearly there...
- northstjarna
- Beginner


- Joined: Nov 14, 2006
- Posts: 58
- Loc: Chertsey, UK
- Status: Offline
that's a better way of putting it..
... now I'm talking to myself, posting as I do this... quite insane....
Code: [ Select ]
crtMC.thumbnail_container.countries_txt += "\n" + crtMC.countriesVisited[iNodeIndex2];
... now I'm talking to myself, posting as I do this... quite insane....
- northstjarna
- Beginner


- Joined: Nov 14, 2006
- Posts: 58
- Loc: Chertsey, UK
- Status: Offline
Hi there thanks for all your help.
I applied your methods to various things and now am a new kind of action script guy...
you can see the workings in many of the pages in a test site I created here... It's almost finished..
http://www.northstjarna.com/mission_africa/mission_africa.html
heres the code that doesn the map....
and heres some code for a photo gallery using the same method...
My issue is now reolved thanks!
Andi
I applied your methods to various things and now am a new kind of action script guy...
you can see the workings in many of the pages in a test site I created here... It's almost finished..
http://www.northstjarna.com/mission_africa/mission_africa.html
heres the code that doesn the map....
Code: [ Select ]
import mx.transitions.Tween;
import mx.transitions.easing.*
var my_sound:Sound = new Sound();
my_sound.attachSound("click");
africa_grouped_anim.attachMovie("tooltip_main1","africa_tip",0,{_x:352.4, _y:186.4});
africa_grouped_anim.africa_tip.tipText.text = "currently opperating in... Click for more";
this.attachMovie("country_info_whole","country_info_whole",999,{_x:-58,_y:210});
this.country_info_whole._alpha = 0;
XML.prototype.ignoreWhite = true;
var profiles_xml:XML = new XML();
profiles_xml.load("xml/country_profiles.xml");
profiles_xml.onLoad = function(success){
var rootNode:XMLNode = profiles_xml.firstChild;
var contentNode = rootNode.childNodes;
numOfItems = contentNode.length;
var indexNode0 , indexNode1;
for (indexNode0=0;indexNode0<numOfItems;indexNode0++){
// Set the Country Clips up
var CoID = contentNode[indexNode0].attributes.ID;
var CoIDX = contentNode[indexNode0].attributes.X;
var CoIDY = contentNode[indexNode0].attributes.Y;
var my_country_name = contentNode[indexNode0].childNodes[0].childNodes;
var my_population = contentNode[indexNode0].childNodes[1].childNodes;
var my_capital = contentNode[indexNode0].childNodes[2].childNodes;
var my_area = contentNode[indexNode0].childNodes[3].childNodes;
var my_major_languages = contentNode[indexNode0].childNodes[4].childNodes;
var my_major_religions = contentNode[indexNode0].childNodes[5].childNodes;
var my_life_expectancy = contentNode[indexNode0].childNodes[6].childNodes;
var my_monetary_unit = contentNode[indexNode0].childNodes[7].childNodes;
var my_main_exports = contentNode[indexNode0].childNodes[8].childNodes;
var my_gni_per_capita = contentNode[indexNode0].childNodes[9].childNodes;
var my_internet_domain = contentNode[indexNode0].childNodes[10].childNodes;
var my_international_dialing_code = contentNode[indexNode0].childNodes[11].childNodes;
var my_source = contentNode[indexNode0].childNodes[12].childNodes;
var My_countryMC = africa_grouped_anim.africa_grouped.attachMovie(CoID , CoID + indexNode0 ,indexNode0 ,{_x:CoIDX,_y:CoIDY});
My_countryMC.country_name = my_country_name;
My_countryMC.population = my_population;
My_countryMC.capital = my_capital;
My_countryMC.area = my_area;
My_countryMC.major_languages = my_major_languages;
My_countryMC.major_religions = my_major_religions;
My_countryMC.life_expectancy = my_life_expectancy;
My_countryMC.monetary_unit = my_monetary_unit;
My_countryMC.main_exports = my_main_exports;
My_countryMC.gni_per_capita = my_gni_per_capita;
My_countryMC.internet_domain = my_internet_domain;
My_countryMC.international_dialing_code = my_international_dialing_code;
My_countryMC.sources = my_source;
My_countryMC._alpha = 0;
My_countryMC.onRollOver = C_over;
My_countryMC.onRollOut = C_out;
My_countryMC.onRelease = C_released;
}// End indexNode0
} // end XML Function
function C_over(){
this._alpha = 70;
africa_grouped_anim.africa_tip._alpha = 0;
this.attachMovie("tooltip_main1","country_tip",1000,{_x:-25, _y:-75});
this.country_tip.tipText.text = this.country_name;
my_sound.start();
}
function C_out(){
this._alpha = 30;
this.country_tip.removeMovieClip();
africa_grouped_anim.africa_tip._alpha = 100;
}
function C_released(){
my_sound.start();
this._alpha = 100;
africa_grouped_anim.africa_tip._alpha = 0;
this.attachMovie("tooltip_main1","country_tip",1000,{_x:-25, _y:-75});
this.country_tip.tipText.text = this.country_name;
country_info_whole.country_information.country_name.text = "Country: " + this.country_name;
country_info_whole.country_information.population.text = "Population: " + this.population;
country_info_whole.country_information.capital.text = "Capital: " + this.capital;
country_info_whole.country_information.area.text = "Area " + this.area;
country_info_whole.country_information.major_languages.text = "Languages: " + this.major_languages;
country_info_whole.country_information.major_religions.text = "Religions: " + this.major_religions;
country_info_whole.country_information.life_expectancy.text = "Life Expectancy: " + this.life_expectancy;
country_info_whole.country_information.monetary_unit.text = "Currency: " + this.monetary_unit;
country_info_whole.country_information.main_exports.text = "Exports: " + this.main_exports;
country_info_whole.country_information.gni_per_capita.text = "GNI Per Capita: " + this.gni_per_capita;
country_info_whole.country_information.internet_domain.text = "Intenet Domain: " + this.internet_domain;
country_info_whole.country_information.international_dialing_code.text = "International Dialing Code: " + this.international_dialing_code;
country_info_whole.country_information.sources.text = "Information Source BBC: " + this.sources;
country_info_whole.country_information.other_info.text = "" ;
var my_tween:Object = new Tween (country_info_whole, "_alpha" , Regular.easeOut , 0, 100, 1, true);
}
import mx.transitions.easing.*
var my_sound:Sound = new Sound();
my_sound.attachSound("click");
africa_grouped_anim.attachMovie("tooltip_main1","africa_tip",0,{_x:352.4, _y:186.4});
africa_grouped_anim.africa_tip.tipText.text = "currently opperating in... Click for more";
this.attachMovie("country_info_whole","country_info_whole",999,{_x:-58,_y:210});
this.country_info_whole._alpha = 0;
XML.prototype.ignoreWhite = true;
var profiles_xml:XML = new XML();
profiles_xml.load("xml/country_profiles.xml");
profiles_xml.onLoad = function(success){
var rootNode:XMLNode = profiles_xml.firstChild;
var contentNode = rootNode.childNodes;
numOfItems = contentNode.length;
var indexNode0 , indexNode1;
for (indexNode0=0;indexNode0<numOfItems;indexNode0++){
// Set the Country Clips up
var CoID = contentNode[indexNode0].attributes.ID;
var CoIDX = contentNode[indexNode0].attributes.X;
var CoIDY = contentNode[indexNode0].attributes.Y;
var my_country_name = contentNode[indexNode0].childNodes[0].childNodes;
var my_population = contentNode[indexNode0].childNodes[1].childNodes;
var my_capital = contentNode[indexNode0].childNodes[2].childNodes;
var my_area = contentNode[indexNode0].childNodes[3].childNodes;
var my_major_languages = contentNode[indexNode0].childNodes[4].childNodes;
var my_major_religions = contentNode[indexNode0].childNodes[5].childNodes;
var my_life_expectancy = contentNode[indexNode0].childNodes[6].childNodes;
var my_monetary_unit = contentNode[indexNode0].childNodes[7].childNodes;
var my_main_exports = contentNode[indexNode0].childNodes[8].childNodes;
var my_gni_per_capita = contentNode[indexNode0].childNodes[9].childNodes;
var my_internet_domain = contentNode[indexNode0].childNodes[10].childNodes;
var my_international_dialing_code = contentNode[indexNode0].childNodes[11].childNodes;
var my_source = contentNode[indexNode0].childNodes[12].childNodes;
var My_countryMC = africa_grouped_anim.africa_grouped.attachMovie(CoID , CoID + indexNode0 ,indexNode0 ,{_x:CoIDX,_y:CoIDY});
My_countryMC.country_name = my_country_name;
My_countryMC.population = my_population;
My_countryMC.capital = my_capital;
My_countryMC.area = my_area;
My_countryMC.major_languages = my_major_languages;
My_countryMC.major_religions = my_major_religions;
My_countryMC.life_expectancy = my_life_expectancy;
My_countryMC.monetary_unit = my_monetary_unit;
My_countryMC.main_exports = my_main_exports;
My_countryMC.gni_per_capita = my_gni_per_capita;
My_countryMC.internet_domain = my_internet_domain;
My_countryMC.international_dialing_code = my_international_dialing_code;
My_countryMC.sources = my_source;
My_countryMC._alpha = 0;
My_countryMC.onRollOver = C_over;
My_countryMC.onRollOut = C_out;
My_countryMC.onRelease = C_released;
}// End indexNode0
} // end XML Function
function C_over(){
this._alpha = 70;
africa_grouped_anim.africa_tip._alpha = 0;
this.attachMovie("tooltip_main1","country_tip",1000,{_x:-25, _y:-75});
this.country_tip.tipText.text = this.country_name;
my_sound.start();
}
function C_out(){
this._alpha = 30;
this.country_tip.removeMovieClip();
africa_grouped_anim.africa_tip._alpha = 100;
}
function C_released(){
my_sound.start();
this._alpha = 100;
africa_grouped_anim.africa_tip._alpha = 0;
this.attachMovie("tooltip_main1","country_tip",1000,{_x:-25, _y:-75});
this.country_tip.tipText.text = this.country_name;
country_info_whole.country_information.country_name.text = "Country: " + this.country_name;
country_info_whole.country_information.population.text = "Population: " + this.population;
country_info_whole.country_information.capital.text = "Capital: " + this.capital;
country_info_whole.country_information.area.text = "Area " + this.area;
country_info_whole.country_information.major_languages.text = "Languages: " + this.major_languages;
country_info_whole.country_information.major_religions.text = "Religions: " + this.major_religions;
country_info_whole.country_information.life_expectancy.text = "Life Expectancy: " + this.life_expectancy;
country_info_whole.country_information.monetary_unit.text = "Currency: " + this.monetary_unit;
country_info_whole.country_information.main_exports.text = "Exports: " + this.main_exports;
country_info_whole.country_information.gni_per_capita.text = "GNI Per Capita: " + this.gni_per_capita;
country_info_whole.country_information.internet_domain.text = "Intenet Domain: " + this.internet_domain;
country_info_whole.country_information.international_dialing_code.text = "International Dialing Code: " + this.international_dialing_code;
country_info_whole.country_information.sources.text = "Information Source BBC: " + this.sources;
country_info_whole.country_information.other_info.text = "" ;
var my_tween:Object = new Tween (country_info_whole, "_alpha" , Regular.easeOut , 0, 100, 1, true);
}
- import mx.transitions.Tween;
- import mx.transitions.easing.*
- var my_sound:Sound = new Sound();
- my_sound.attachSound("click");
- africa_grouped_anim.attachMovie("tooltip_main1","africa_tip",0,{_x:352.4, _y:186.4});
- africa_grouped_anim.africa_tip.tipText.text = "currently opperating in... Click for more";
- this.attachMovie("country_info_whole","country_info_whole",999,{_x:-58,_y:210});
- this.country_info_whole._alpha = 0;
- XML.prototype.ignoreWhite = true;
- var profiles_xml:XML = new XML();
- profiles_xml.load("xml/country_profiles.xml");
- profiles_xml.onLoad = function(success){
- var rootNode:XMLNode = profiles_xml.firstChild;
- var contentNode = rootNode.childNodes;
- numOfItems = contentNode.length;
- var indexNode0 , indexNode1;
- for (indexNode0=0;indexNode0<numOfItems;indexNode0++){
- // Set the Country Clips up
- var CoID = contentNode[indexNode0].attributes.ID;
- var CoIDX = contentNode[indexNode0].attributes.X;
- var CoIDY = contentNode[indexNode0].attributes.Y;
- var my_country_name = contentNode[indexNode0].childNodes[0].childNodes;
- var my_population = contentNode[indexNode0].childNodes[1].childNodes;
- var my_capital = contentNode[indexNode0].childNodes[2].childNodes;
- var my_area = contentNode[indexNode0].childNodes[3].childNodes;
- var my_major_languages = contentNode[indexNode0].childNodes[4].childNodes;
- var my_major_religions = contentNode[indexNode0].childNodes[5].childNodes;
- var my_life_expectancy = contentNode[indexNode0].childNodes[6].childNodes;
- var my_monetary_unit = contentNode[indexNode0].childNodes[7].childNodes;
- var my_main_exports = contentNode[indexNode0].childNodes[8].childNodes;
- var my_gni_per_capita = contentNode[indexNode0].childNodes[9].childNodes;
- var my_internet_domain = contentNode[indexNode0].childNodes[10].childNodes;
- var my_international_dialing_code = contentNode[indexNode0].childNodes[11].childNodes;
- var my_source = contentNode[indexNode0].childNodes[12].childNodes;
- var My_countryMC = africa_grouped_anim.africa_grouped.attachMovie(CoID , CoID + indexNode0 ,indexNode0 ,{_x:CoIDX,_y:CoIDY});
- My_countryMC.country_name = my_country_name;
- My_countryMC.population = my_population;
- My_countryMC.capital = my_capital;
- My_countryMC.area = my_area;
- My_countryMC.major_languages = my_major_languages;
- My_countryMC.major_religions = my_major_religions;
- My_countryMC.life_expectancy = my_life_expectancy;
- My_countryMC.monetary_unit = my_monetary_unit;
- My_countryMC.main_exports = my_main_exports;
- My_countryMC.gni_per_capita = my_gni_per_capita;
- My_countryMC.internet_domain = my_internet_domain;
- My_countryMC.international_dialing_code = my_international_dialing_code;
- My_countryMC.sources = my_source;
- My_countryMC._alpha = 0;
- My_countryMC.onRollOver = C_over;
- My_countryMC.onRollOut = C_out;
- My_countryMC.onRelease = C_released;
- }// End indexNode0
- } // end XML Function
- function C_over(){
- this._alpha = 70;
- africa_grouped_anim.africa_tip._alpha = 0;
- this.attachMovie("tooltip_main1","country_tip",1000,{_x:-25, _y:-75});
- this.country_tip.tipText.text = this.country_name;
- my_sound.start();
- }
- function C_out(){
- this._alpha = 30;
- this.country_tip.removeMovieClip();
- africa_grouped_anim.africa_tip._alpha = 100;
- }
- function C_released(){
- my_sound.start();
- this._alpha = 100;
- africa_grouped_anim.africa_tip._alpha = 0;
- this.attachMovie("tooltip_main1","country_tip",1000,{_x:-25, _y:-75});
- this.country_tip.tipText.text = this.country_name;
- country_info_whole.country_information.country_name.text = "Country: " + this.country_name;
- country_info_whole.country_information.population.text = "Population: " + this.population;
- country_info_whole.country_information.capital.text = "Capital: " + this.capital;
- country_info_whole.country_information.area.text = "Area " + this.area;
- country_info_whole.country_information.major_languages.text = "Languages: " + this.major_languages;
- country_info_whole.country_information.major_religions.text = "Religions: " + this.major_religions;
- country_info_whole.country_information.life_expectancy.text = "Life Expectancy: " + this.life_expectancy;
- country_info_whole.country_information.monetary_unit.text = "Currency: " + this.monetary_unit;
- country_info_whole.country_information.main_exports.text = "Exports: " + this.main_exports;
- country_info_whole.country_information.gni_per_capita.text = "GNI Per Capita: " + this.gni_per_capita;
- country_info_whole.country_information.internet_domain.text = "Intenet Domain: " + this.internet_domain;
- country_info_whole.country_information.international_dialing_code.text = "International Dialing Code: " + this.international_dialing_code;
- country_info_whole.country_information.sources.text = "Information Source BBC: " + this.sources;
- country_info_whole.country_information.other_info.text = "" ;
- var my_tween:Object = new Tween (country_info_whole, "_alpha" , Regular.easeOut , 0, 100, 1, true);
- }
and heres some code for a photo gallery using the same method...
Code: [ Select ]
import mx.transitions.Tween;
import mx.transitions.easing.*
var Xmargin = 20;
var Ymargin = 40;
XML.prototype.ignoreWhite = true;
///Create a new empty XML Object
var my_gallery_xml:XML = new XML();
///load in the xml files
my_gallery_xml.load("xml/gallery.xml"); // xml xource for the core team
my_gallery_xml.onLoad = function(success){
ProcessXMLData();
}
function ProcessXMLData(){
var SetOverX = 0;
/// First set of Variables and Arrays
var rootNode:XMLNode = my_gallery_xml.firstChild;
menuArray = rootNode.childNodes;
var numOfItems = menuArray.length;
var iIndexSet, iIndexSet0, iIndex, iNodeIndex0, iNodeIndex1;
iNodeIndex0 = 0;
//// First For Loop to load in each member
for (iIndexSet0 = 0;iIndexSet0<(numOfItems/6); iIndexSet0++){
var pushoverX = 100;
var pushoverY = 100;
var containerMC = this.attachMovie("container_MC", "container" + iIndexSet0, -(iIndexSet0) ,{_x:SetOverX,_y:0});
//// Create Thumbnails in this Container
for (var set_thumbs = 0 ; set_thumbs<6; set_thumbs++ , iNodeIndex0++){
iNodeIndex1 = 0;
var crtThumb = rootNode.childNodes[iNodeIndex0];
var thumbMC = containerMC.createEmptyMovieClip("thumbnail" + iNodeIndex0, iNodeIndex0);
thumbMC.ID = crtThumb.attributes.ID;
thumbMC.thumbnailURL = crtThumb.attributes.thumbnail;
thumbMC.imageURL = crtThumb.attributes.imageURL;
thumbMC.annotation = crtThumb.childNodes[iNodeIndex1].nodeValue;
// attach thumbnail_container for each image thumbnail
thumbMC.attachMovie("thumb_MC", "thumb_MC", 0, {_x:pushoverX ,_y:pushoverY});
thumbMC.thumb_MC.loadMovie(thumbMC.thumbnailURL);
thumbMC.onRelease = t_hit;
/// Pushover Functions for thumbnails
pushoverX += thumbMC.thumb_MC._width + Xmargin; /// had to add in the crtMC.
if(pushoverX >= 550 - (thumbMC.thumb_MC._width*2)){
pushoverX = 100;
pushoverY += 75 + Ymargin;
}
}// close loop iNodeIndex0
SetOverX += + 550;
}// close loop iIndexSet0
}// End Function
function t_hit(){
var myURL = this.imageURL;
var myCaption = this.annotation;
_parent.photo_loadi._xscale = 48;
_parent.photo_loadi._yscale = 45;
_parent.photo_loadi.swapDepths(0);
_parent.photo_loadi._alpha = 100;
var jpgTween:Object = new Tween(_parent.photo_loadi, "_alpha", Regular.easeOut , 0 , 100 , 2, true );
var mcLoader:MovieClipLoader = new MovieClipLoader ();
mcLoader.loadClip(myURL , _parent.photo_loadi.the_loader);
_parent.caption_says = myCaption;
_parent.photo_loadi.attachMovie("the_close_btn","closer",1,{_x:0 , _y:0});
_parent.photo_loadi.closer._xscale = 120;
_parent.photo_loadi.closer._yscale = 120;
_parent.photo_loadi.closer.onRelease = function(){
var jpgTween:Object = new Tween(_parent.photo_loadi, "_alpha", Regular.easeOut ,100 , 0 , 1, true );
_parent.caption_says = "";
} // Close immediate function for closing image
} // End on Release function for each thumbnail
import mx.transitions.easing.*
var Xmargin = 20;
var Ymargin = 40;
XML.prototype.ignoreWhite = true;
///Create a new empty XML Object
var my_gallery_xml:XML = new XML();
///load in the xml files
my_gallery_xml.load("xml/gallery.xml"); // xml xource for the core team
my_gallery_xml.onLoad = function(success){
ProcessXMLData();
}
function ProcessXMLData(){
var SetOverX = 0;
/// First set of Variables and Arrays
var rootNode:XMLNode = my_gallery_xml.firstChild;
menuArray = rootNode.childNodes;
var numOfItems = menuArray.length;
var iIndexSet, iIndexSet0, iIndex, iNodeIndex0, iNodeIndex1;
iNodeIndex0 = 0;
//// First For Loop to load in each member
for (iIndexSet0 = 0;iIndexSet0<(numOfItems/6); iIndexSet0++){
var pushoverX = 100;
var pushoverY = 100;
var containerMC = this.attachMovie("container_MC", "container" + iIndexSet0, -(iIndexSet0) ,{_x:SetOverX,_y:0});
//// Create Thumbnails in this Container
for (var set_thumbs = 0 ; set_thumbs<6; set_thumbs++ , iNodeIndex0++){
iNodeIndex1 = 0;
var crtThumb = rootNode.childNodes[iNodeIndex0];
var thumbMC = containerMC.createEmptyMovieClip("thumbnail" + iNodeIndex0, iNodeIndex0);
thumbMC.ID = crtThumb.attributes.ID;
thumbMC.thumbnailURL = crtThumb.attributes.thumbnail;
thumbMC.imageURL = crtThumb.attributes.imageURL;
thumbMC.annotation = crtThumb.childNodes[iNodeIndex1].nodeValue;
// attach thumbnail_container for each image thumbnail
thumbMC.attachMovie("thumb_MC", "thumb_MC", 0, {_x:pushoverX ,_y:pushoverY});
thumbMC.thumb_MC.loadMovie(thumbMC.thumbnailURL);
thumbMC.onRelease = t_hit;
/// Pushover Functions for thumbnails
pushoverX += thumbMC.thumb_MC._width + Xmargin; /// had to add in the crtMC.
if(pushoverX >= 550 - (thumbMC.thumb_MC._width*2)){
pushoverX = 100;
pushoverY += 75 + Ymargin;
}
}// close loop iNodeIndex0
SetOverX += + 550;
}// close loop iIndexSet0
}// End Function
function t_hit(){
var myURL = this.imageURL;
var myCaption = this.annotation;
_parent.photo_loadi._xscale = 48;
_parent.photo_loadi._yscale = 45;
_parent.photo_loadi.swapDepths(0);
_parent.photo_loadi._alpha = 100;
var jpgTween:Object = new Tween(_parent.photo_loadi, "_alpha", Regular.easeOut , 0 , 100 , 2, true );
var mcLoader:MovieClipLoader = new MovieClipLoader ();
mcLoader.loadClip(myURL , _parent.photo_loadi.the_loader);
_parent.caption_says = myCaption;
_parent.photo_loadi.attachMovie("the_close_btn","closer",1,{_x:0 , _y:0});
_parent.photo_loadi.closer._xscale = 120;
_parent.photo_loadi.closer._yscale = 120;
_parent.photo_loadi.closer.onRelease = function(){
var jpgTween:Object = new Tween(_parent.photo_loadi, "_alpha", Regular.easeOut ,100 , 0 , 1, true );
_parent.caption_says = "";
} // Close immediate function for closing image
} // End on Release function for each thumbnail
- import mx.transitions.Tween;
- import mx.transitions.easing.*
- var Xmargin = 20;
- var Ymargin = 40;
- XML.prototype.ignoreWhite = true;
- ///Create a new empty XML Object
- var my_gallery_xml:XML = new XML();
- ///load in the xml files
- my_gallery_xml.load("xml/gallery.xml"); // xml xource for the core team
- my_gallery_xml.onLoad = function(success){
- ProcessXMLData();
- }
- function ProcessXMLData(){
- var SetOverX = 0;
- /// First set of Variables and Arrays
- var rootNode:XMLNode = my_gallery_xml.firstChild;
- menuArray = rootNode.childNodes;
- var numOfItems = menuArray.length;
- var iIndexSet, iIndexSet0, iIndex, iNodeIndex0, iNodeIndex1;
- iNodeIndex0 = 0;
- //// First For Loop to load in each member
- for (iIndexSet0 = 0;iIndexSet0<(numOfItems/6); iIndexSet0++){
- var pushoverX = 100;
- var pushoverY = 100;
- var containerMC = this.attachMovie("container_MC", "container" + iIndexSet0, -(iIndexSet0) ,{_x:SetOverX,_y:0});
- //// Create Thumbnails in this Container
- for (var set_thumbs = 0 ; set_thumbs<6; set_thumbs++ , iNodeIndex0++){
- iNodeIndex1 = 0;
- var crtThumb = rootNode.childNodes[iNodeIndex0];
- var thumbMC = containerMC.createEmptyMovieClip("thumbnail" + iNodeIndex0, iNodeIndex0);
- thumbMC.ID = crtThumb.attributes.ID;
- thumbMC.thumbnailURL = crtThumb.attributes.thumbnail;
- thumbMC.imageURL = crtThumb.attributes.imageURL;
- thumbMC.annotation = crtThumb.childNodes[iNodeIndex1].nodeValue;
- // attach thumbnail_container for each image thumbnail
- thumbMC.attachMovie("thumb_MC", "thumb_MC", 0, {_x:pushoverX ,_y:pushoverY});
- thumbMC.thumb_MC.loadMovie(thumbMC.thumbnailURL);
- thumbMC.onRelease = t_hit;
- /// Pushover Functions for thumbnails
- pushoverX += thumbMC.thumb_MC._width + Xmargin; /// had to add in the crtMC.
- if(pushoverX >= 550 - (thumbMC.thumb_MC._width*2)){
- pushoverX = 100;
- pushoverY += 75 + Ymargin;
- }
- }// close loop iNodeIndex0
- SetOverX += + 550;
- }// close loop iIndexSet0
- }// End Function
- function t_hit(){
- var myURL = this.imageURL;
- var myCaption = this.annotation;
- _parent.photo_loadi._xscale = 48;
- _parent.photo_loadi._yscale = 45;
- _parent.photo_loadi.swapDepths(0);
- _parent.photo_loadi._alpha = 100;
- var jpgTween:Object = new Tween(_parent.photo_loadi, "_alpha", Regular.easeOut , 0 , 100 , 2, true );
- var mcLoader:MovieClipLoader = new MovieClipLoader ();
- mcLoader.loadClip(myURL , _parent.photo_loadi.the_loader);
- _parent.caption_says = myCaption;
- _parent.photo_loadi.attachMovie("the_close_btn","closer",1,{_x:0 , _y:0});
- _parent.photo_loadi.closer._xscale = 120;
- _parent.photo_loadi.closer._yscale = 120;
- _parent.photo_loadi.closer.onRelease = function(){
- var jpgTween:Object = new Tween(_parent.photo_loadi, "_alpha", Regular.easeOut ,100 , 0 , 1, true );
- _parent.caption_says = "";
- } // Close immediate function for closing image
- } // End on Release function for each thumbnail
My issue is now reolved thanks!
Andi
Page 1 of 1
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 12 posts
- Users browsing this forum: No registered users and 40 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum
