ile xml:
cau truc
music ->nhac src = >
bai1
bai2
bai3
file fla : 1 combox 1 text
code :
// import this so it can be used to set the scope of the combobox listener and the xml onload routine
import mx.utils.Delegate;
// declare variables
var people:Array;
var update:String;
var dirpath:String;
// create a new color object to associate with the bgcolor movieclip
var bgcol:Color;
// set up the XML instance
var peoplexml:XML = new XML();
// initialize items on stage
_global.style.setStyle("fontFamily", "Verdana");
_global.style.setStyle("fontSize", 11);
// define what should happen when the XML loads
// (read data into update, dirpath, and people variables)
function onXmlLoaded(success:Boolean) {
if (success) {
// make a handle to the root node in the xml
var mainnode:XMLNode = peoplexml.firstChild;
update = mainnode.attributes.lastupdate;
dirpath = mainnode.attributes.dir;
// set up an array of all person nodes
var peoplenodes:Array = peoplexml.firstChild.childNodes;
for (var i:Number = 0; i < xmlnode =" peoplenodes;
people.push(
{i:i+1,
pname:personnode.firstChild.nodeValue,
desc:personnode.attributes.src
});
}
// data is all read and put in the right place -- now setup the screen
// using this data
setup();
} else {
trace('error reading XML');
}
}
function setup() {
// set up chosefile dropdown
chosefile.labelField = "pname";
chosefile.dataProvider = people;
chosefile.addEventListener("change", Delegate.create(this, loadScreen));
}
function loadScreen(evt:Object) {
var thisitem:Object = evt.target.selectedItem;
txtdetail.text = thisitem.desc;
txtdetail.vPosition = 0;
my_sound.loadSound(thisitem.desc, true);
}
function init() {
// initialize the people array
people = [{pname:"Choose one"}];
// set up the xml instance to ignore whitespace between tags
peoplexml.ignoreWhite = true;
// set the scope of the onLoad function to the main timeline, not peoplexml
peoplexml.onLoad = Delegate.create(this, onXmlLoaded);
// initialize the bgcol color variable by associating it with the background movieclip
// start the xml loading
peoplexml.load("a.xml");
}
var my_sound:Sound = new Sound();
my_sound.onLoad = function(success:Boolean) {
var totalSeconds:Number = this.duration/1000;
trace(this.duration+" ms ("+Math.round(totalSeconds)+" seconds)");
var minutes:Number = Math.floor(totalSeconds/60);
var seconds = Math.floor(totalSeconds)%60;
if (seconds
12/19/2009
Subscribe to:
Posts (Atom)
List
Profiles Information
About me : Nothing is 1 vài thứ - 1985
Places I've Lived : I ♥ Hà Nội
Home Page : http://www.shimivn.blogspot.com/
Think : 1:1000000000
Languages spoken : Vietnamese,English.
Mobile : sony C2305 ♥ ♥
dell : i3-Ram 3GB- HDD 250GB . ♥♥♥
Places I've Lived : I ♥ Hà Nội
Home Page : http://www.shimivn.blogspot.com/
Think : 1:1000000000
Languages spoken : Vietnamese,English.
Mobile : sony C2305 ♥ ♥
dell : i3-Ram 3GB- HDD 250GB . ♥♥♥