XML

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentXML

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old May 2nd, 2006, 01:35 AM
Kurojigoku Kurojigoku is offline
Contributing User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: Germany
Posts: 19 Kurojigoku New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to Kurojigoku
how do u display a list of whats in your XML ??

:
Ok i've made an mp3 player in flash .
it uses an XML menu to provide the songs ,
what i would like help with is making a list to display all of the songs ,
if there is a tutorial or if anyone can help me i would highly appreciate it

__________________
You have just qualified
for self defense.

Reply With Quote
  #2  
Old May 2nd, 2006, 05:39 AM
Sergiu_spooky Sergiu_spooky is offline
Contributing User
Tutorialized Novice (500 - 999 posts)
 
Join Date: Dec 2005
Location: Romania
Posts: 642 Sergiu_spooky New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 2 m 29 sec
Reputation Power: 0
Send a message via MSN to Sergiu_spooky Send a message via Yahoo to Sergiu_spooky
first of all....you can use a lot of things to display the list...you can use a table(dataGrid component), a html formated text field, a list (list component - you can customize this) or you can just use the Tree component...
using the TREE component :
this is the simplest way...just adda tree instance in a movie,give it a instance name like "myTree", then add this code to the frame on which the component is :
Code:
var myTreeDP:XML = new XML();
myTreeDP.ignoreWhite = true;
myTreeDP.load("treeXML.xml");
myTreeDP.onLoad = function() {
  myTree.dataProvider = this.firstChild;
};
this just loads the xml. In order to make use of the list, you would just use this code, placed in the same place :
Code:
var treeListener:Object = new Object();
treeListener.change = function(evt:Object) {
  trace("selected node is: "+evt.target.selectedNode);
  trace("");
};
myTree.addEventListener("change", treeListener);


you can easily change the trace action in something else to get the desired effect...
using a LIST component :
add a list component to the stage, instance name "myList"
then add this code to the same frame on witch the List component is
Code:
myDP = new Array();
	var songs:XML = new XML();
	songs.ignoreWhite = true;
	songs.onLoad = function(success) {
		i = 1;
		for (var aNode = songs.firstChild; aNode != null; aNode=aNode.nextSibling) {
			myDP.addItem({label:i+"."+aNode.attributes.song+" "+aNode.attributes.duration, data:aNode.attributes.src});
			i++;
		}
		_root.myList.dataProvider = myDP;
	};
	songs.load("treeXML.xml");
}

for making use of the selectedItem property of the list component, you would use this code attached to a button :
Code:
on(release){
trace(_root.myList.selectedItem());
trace("");

using a html formated textField :
this is exactly the same as for the list component, just that you will not be able to use it interactive...so just a simple list...text...
- make a dynamic text field on the root, instance name "myHTMLt", make sure you select the render as HTML option.
- add this code to the same frame on whitch the dynamic text box is :
Code:
myDP = new Array();
	var songs:XML = new XML();
	songs.ignoreWhite = true;
	songs.onLoad = function(success) {
		i = 1;
		for (var aNode = songs.firstChild; aNode != null; aNode=aNode.nextSibling) {
			myHTMLt +=i+"."+aNode.attributes.song+" "+aNode.attributes.duration + "
";
			i++;
		}
		_root.myList.dataProvider = myDP;
	};
	songs.load("treeXML.xml");
}



I think i've covered enough so you can make your choice....
after you decide on what method you whant to use, please let me know...I can help you and explain things in more detail...I have a lot of spare time right now
also, I think this will help...just to make a ideea
http://flashaddict.uv.ro/player/player_final.html
I made this some time ago....

Reply With Quote
  #3  
Old May 3rd, 2006, 04:57 AM
Kurojigoku Kurojigoku is offline
Contributing User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: Germany
Posts: 19 Kurojigoku New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to Kurojigoku
WOOO
Thank you ,
and yes i would like help

(is your actionscript designed for flash 8 ??)
because im at school right now in class
(HIGH SCHOOL 12th grade YAHHHH!!!! )
anyway 8)
and the school has Flash Mx 2004.

The list works , except it does not display my music list it displays
undefined, twice , on one line ,like this:



1. undefined undefined


there is no line 2

this is on the same layer as the list

Code:
myDP = new Array();
var songs:XML = new XML();
songs.ignoreWhite = true;
songs.onLoad = function(success) {
	i = 1;
	for (var aNode = songs.firstChild; aNode != null; aNode=aNode.nextSibling) {
		myDP.addItem({label:i+"."+aNode.attributes.song+" "+aNode.attributes.duration, data:aNode.attributes.src});
		i++;
	}
	_root.myList.dataProvider = myDP;
};
songs.load("playlist.xml");


and i have another layer for the button and i put the code on the button

Code:
on (release) {
	trace(_root.myList.selectedItem());
	trace("");
}


sooo....yah i have no clue
I really appriciate all this help man thank you

Reply With Quote
  #4  
Old May 3rd, 2006, 06:43 AM
Sergiu_spooky Sergiu_spooky is offline
Contributing User
Tutorialized Novice (500 - 999 posts)
 
Join Date: Dec 2005
Location: Romania
Posts: 642 Sergiu_spooky New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 2 m 29 sec
Reputation Power: 0
Send a message via MSN to Sergiu_spooky Send a message via Yahoo to Sergiu_spooky
please give me the structure of the xml file cuz probably that's why it doesen't work....those examples are made for my own xml files, so the structure may differ...
the undefined things tell me that you have something like this in you'r xml :
Code:
<node type="head">
     <node type="album">
          <node type="song" tytle="Nirvana - Molly's Lips" src="c:\folder\file1.mp3">
          <node type="song" tytle="Nirvana - About A Girl" src="c:\folder\file2.mp3">
     </node>
</node>

and my code is making this :
trace "1."
trace first node's tytle attribute (it has no tytle attribute)
trace second node's tytle attrubute (it has no such attribute )
then it stops...
so I need the XML's structure...

I see that you whant to use the list component....I will tell you how to customize that so it look's exactly like you whant it to look (just some simple stuff)

Reply With Quote
  #5  
Old May 3rd, 2006, 07:00 AM
thethanx thethanx is offline
Contributing User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Location: Vermont
Posts: 51 thethanx New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to thethanx
cheers to graduating! I'm in the same boat and thank god for that!

Reply With Quote
  #6  
Old May 3rd, 2006, 07:10 AM
Kurojigoku Kurojigoku is offline
Contributing User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: Germany
Posts: 19 Kurojigoku New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to Kurojigoku
Here is my XmL format


Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<songs>
<song name="Freak on a leash rammstein remix" file="H:\MP3_player\Rammstein\Korn & ramstien - Freak on a leash rammstein remix.mp3"/>
<song name="Letting Go" file="H:\MP3_player\illnino\11 Letting Go Ill Nino Confession.mp3" />
</songs>

basicly...yah

YAHHHHHH HIGH SCHOOL
after this WE officially


HAVE NO LIFE.

Reply With Quote
  #7  
Old May 3rd, 2006, 07:17 AM
Kurojigoku Kurojigoku is offline
Contributing User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: Germany
Posts: 19 Kurojigoku New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to Kurojigoku
Sergiu_spooky:

THANK UUUUUUUUUUUUUUUUUUUUUUU 8) 8) 8)

Reply With Quote
  #8  
Old May 3rd, 2006, 08:02 AM
Sergiu_spooky Sergiu_spooky is offline
Contributing User
Tutorialized Novice (500 - 999 posts)
 
Join Date: Dec 2005
Location: Romania
Posts: 642 Sergiu_spooky New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 2 m 29 sec
Reputation Power: 0
Send a message via MSN to Sergiu_spooky Send a message via Yahoo to Sergiu_spooky
first of all, delete this from your xml : <?xml version="1.0" encoding="iso-8859-1"?>

then, replace the code that loads your xml and places it in the list with this :
Code:
myDP = new Array(); 
var songs:XML = new XML(); 
songs.ignoreWhite = true; 
songs.onLoad = function(success) { 
   i = 1; 
   for (var aNode = songs.firstChild.firstChild; aNode != null; aNode=aNode.nextSibling) { 
      myDP.addItem({label:i+"."+aNode.attributes.name, data:aNode.attributes.file}); 
      i++; 
   } 
   _root.myList.dataProvider = myDP; 
}; 
songs.load("playlist.xml");


this should perfectly load your playlist...
next...that button...
the code should be :
Code:
on (release) {
	if (_root.myList.selectedItem<>undefined) {
		trace(_root.myList.selectedItem.data);
	}
}


next, customizing the list...

themeColor
The base color scheme of a component. Possible values are "haloGreen", "haloBlue", and "haloOrange". The default value is "haloGreen".

alternatingRowColors
Specifies colors for rows in an alternating pattern. The value can be an array of two or more colors, for example, 0xFF00FF, 0xCC6699, and 0x996699. Unlike single-value color styles, alternatingRowColors does not accept color names; the values must be numeric color codes. By default, this style is not set and backgroundColor is used in its place for all rows.

backgroundColor
The background color of the list. The default color is white and is defined on the class style declaration. This style is ignored if alternatingRowColors is specified.

backgroundDisabledColor
The background color when the component’s enabled property is set to "false". The default value is 0xDDDDDD (medium gray).

border styles
The List component uses a RectBorder instance as its border and responds to the styles defined on that class. See RectBorder class.

The default border style is "inset".

color
The text color.

disabledColor
The color for text when the component is disabled. The default color is 0x848384 (dark gray).

embedFonts
A Boolean value that indicates whether the font specified in fontFamily is an embedded font. This style must be set to true if fontFamily refers to an embedded font. Otherwise, the embedded font will not be used. If this style is set to true and fontFamily does not refer to an embedded font, no text will be displayed. The default value is false.

fontFamily
The font name for text. The default value is "_sans".

fontSize
The point size for the font. The default value is 10.

fontStyle
The font style: either "normal" or "italic". The default value is "normal".

fontWeight
The font weight: either "none" or "bold". The default value is "none". All components can also accept the value "normal" in place of "none" during a setStyle() call, but subsequent calls to getStyle() will return "none".

textAlign
The text alignment: either "left", "right", or "center". The default value is "left".

textDecoration
The text decoration: either "none" or "underline". The default value is "none".

textIndent
A number indicating the text indent. The default value is 0.

defaultIcon
The name of the default icon to display on each row. The default value is undefined, which means no icon is displayed.

repeatDelay
The number of milliseconds of delay between when a user first presses a button in the scrollbar and when the action begins to repeat. The default value is 500, half a second.

repeatInterval
The number of milliseconds between automatic clicks when a user holds the mouse button down on a button in the scrollbar. The default value is 35.

rollOverColor
The background color of a rolled-over row. The default value is 0xE3FFD6 (bright green) with the Halo theme and 0xAAAAAA (light gray) with the Sample theme.

When themeColor is changed through a setStyle() call, the framework sets rollOverColor to a value related to the themeColor chosen.

selectionColor
The background color of a selected row. The default value is a 0xCDFFC1 (light green) with the Halo theme and 0xEEEEEE (very light gray) with the Sample theme.

When themeColor is changed through a setStyle() call, the framework sets selectionColor to a value related to the themeColor chosen.

selectionDuration
The length of the transition from a normal to selected state or back from selected to normal, in milliseconds. The default value is 200.

selectionDisabledColor
The background color of a selected row. The default value is a 0xDDDDDD (medium gray). Because the default value for this property is the same as the default for backgroundDisabledColor, the selection is not visible when the component is disabled unless one of these style properties is changed.



textRollOverColor
The color of text when the mouse pointer rolls over it. The default value is 0x2B333C (dark gray). This style is important when you set rollOverColor, because the two settings must complement each other so that text is easily viewable during a rollover.

textSelectedColor
The color of text in the selected row. The default value is 0x005F33 (dark gray). This style is important when you set selectionColor, because the two settings must complement each other so that text is easily viewable while selected.

useRollOver
Determines whether rolling over a row activates highlighting. The default value is true.

(from flash MX 2004 7.2 help)

all these properties can be used like this :
place this code on a frame(preferably in the same place you placed the code that loads the playlist) :
Code:
myList.setStyle("themeColor","haloOrange");
myList.setStyle("useRollOver",false);
myList.setStyle("textRollOverColor",0xFF0000);

Reply With Quote
  #9  
Old May 4th, 2006, 01:45 AM
Kurojigoku Kurojigoku is offline
Contributing User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: Germany
Posts: 19 Kurojigoku New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to Kurojigoku
YES!!!!!!!!!!


Danke
thank u
woooooooo
it wooorks
ok .
calming down........

thanks soo much thank u thank u

Reply With Quote
  #10  
Old May 4th, 2006, 11:43 AM
Sergiu_spooky Sergiu_spooky is offline
Contributing User
Tutorialized Novice (500 - 999 posts)
 
Join Date: Dec 2005
Location: Romania
Posts: 642 Sergiu_spooky New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 2 m 29 sec
Reputation Power: 0
Send a message via MSN to Sergiu_spooky Send a message via Yahoo to Sergiu_spooky
no problem...glad to help

Reply With Quote
  #11  
Old May 8th, 2006, 02:40 AM
Kurojigoku Kurojigoku is offline
Contributing User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: Germany
Posts: 19 Kurojigoku New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to Kurojigoku
ok ,my teacher is asking me to see if i could get the list to work like this

when you click a song name within the list the mp3 player will jump to it , like in windows media player

if you could help i would appreciate it

oh and another thing
why did i have to delete

<?xml version="1.0" encoding="iso-8859-1"?>

from my XML ?


Thank You

Reply With Quote
  #12  
Old May 8th, 2006, 05:15 AM
Sergiu_spooky Sergiu_spooky is offline
Contributing User
Tutorialized Novice (500 - 999 posts)
 
Join Date: Dec 2005
Location: Romania
Posts: 642 Sergiu_spooky New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 2 m 29 sec
Reputation Power: 0
Send a message via MSN to Sergiu_spooky Send a message via Yahoo to Sergiu_spooky
you have to delete that because it's not important for flash(not for what you are making) and because it's one more node that needs to be taken account of in the actionscripting...
you could leave it there...no problem...

as for the play thing, use this code :
Code:
var my_sound:Sound = new Sound();
myDP = new Array();
var songs:XML = new XML();
songs.ignoreWhite = true;
songs.onLoad = function(success) {
	i = 1;
	for (var aNode = songs.firstChild.firstChild; aNode != null; aNode=aNode.nextSibling) {
		myDP.addItem({label:i+"."+aNode.attributes.name, data:aNode.attributes.file});
		i++;
	}
	_root.myList.dataProvider = myDP;
};
songs.load("tree.xml");
var listenerObject:Object = new Object();
listenerObject.change = function(eventObject:Object) {
	my_sound.loadSound(myList.selectedItem.data, true);
	my_sound.start();
};
myList.addEventListener("change", listenerObject);
stop();

the load part is the same, just add this :
Code:
var my_sound:Sound = new Sound();
var listenerObject:Object = new Object();
listenerObject.change = function(eventObject:Object) {
	my_sound.loadSound(myList.selectedItem.data, true);
	my_sound.start();
};
myList.addEventListener("change", listenerObject);



this will play the song when you click it (make sure you have correct paths in the xml)

Reply With Quote
  #13  
Old May 9th, 2006, 01:23 PM
Kurojigoku Kurojigoku is offline
Contributing User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: Germany
Posts: 19 Kurojigoku New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to Kurojigoku
I THANK YOU
you are a genius
My teacher says thanks as well.
!!!!!!!!

Reply With Quote
  #14  
Old May 9th, 2006, 01:27 PM
Sergiu_spooky Sergiu_spooky is offline
Contributing User
Tutorialized Novice (500 - 999 posts)
 
Join Date: Dec 2005
Location: Romania
Posts: 642 Sergiu_spooky New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 2 m 29 sec
Reputation Power: 0
Send a message via MSN to Sergiu_spooky Send a message via Yahoo to Sergiu_spooky
my teacher is an idiot ...

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentXML > how do u display a list of whats in your XML ??


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap