Hoi,
Kben bezig om wat te stoeien met flash mx en xml.
Kheb een menu en daarnaast een foto proberen te maken maar het lukt niet echt.
De info komt uit test.xml
Onafhankelijk werkt dit:
fotoXML = new XML();
fotoXML.ignoreWhite = true;
fotoXML.onLoad = function(success) {
if (success) {
childs = fotoXML.firstChild.childNodes;
fotos = childs.length;
full = new Array();
for (var i=0;i<childs.length;i++) {
fot = _root.createEmptyMovieClip("foto"+i,i);
dummy = _root.createEmptyMovieClip("dummy"+i, 2*fotos+2+i);
dummy.fot = i;
with(fot) {
_x = 165;
_y = 5 + 80*i;
}
full[i] = childs[i].firstChild.nodeValue;
fot.loadMovie(childs[i].attributes.thumb);
dummy.onEnterFrame = function () {
var tmp = _root["foto"+this.fot];
if ((tmp.getBytesLoaded()>100) && (tmp.getBytesTotal()==tmp.getBytesLoaded()) && (tmp._height>0)) {
delete this.onEnterFrame;
tmp.id = this.fot;
tmp._width=70;
tmp._height=70;
tmp.onRelease = function() {
_root.createEmptyMovieClip("fullfoto", fotos+1);
_root.createEmptyMovieClip("dummy", fotos+2);
fullfoto.loadMovie(full[this.id]);
dummy.onEnterFrame = function() {
if ((fullfoto.getBytesTotal()==fullfoto.getBytesLoaded()) && (fullfoto.getBytesLoaded()>100)) {
delete this.onEnterFrame;
fullfoto._width = fullfoto._width;
fullfoto._height = fullfoto._height;
fullfoto._x = 10;
fullfoto._y = 10;
fullfoto.onRelease = function() {
fullfoto.removeMovieClip();
}
}
}
}
}
}
}
}
}
fotoXML.load("test.xml");
en dit :
menuXML = new XML();
menuXML.ignoreWhite = true;
menuXML.onLoad = function(success) {
if (success) {
menuItem = menuXML.firstChild.childNodes;
for (var i=0; i<menuItem.length; i++) {
item = _root.attachMovie("itemClip", "itemClip" + i, i);
item._x = 0;
item._y = 20*i;
item.itemLabel.text = menuItem[i].attributes.name;
item.myUrl = menuItem[i].attributes.url;
item.onRelease = function() {
getURL(this.myUrl,"_blank");
}
}
}
}
menuXml.load("test.xml");
Maar ik wil ze integreren.
Iemand een idee?
thx
Kben bezig om wat te stoeien met flash mx en xml.
Kheb een menu en daarnaast een foto proberen te maken maar het lukt niet echt.
De info komt uit test.xml
Onafhankelijk werkt dit:
fotoXML = new XML();
fotoXML.ignoreWhite = true;
fotoXML.onLoad = function(success) {
if (success) {
childs = fotoXML.firstChild.childNodes;
fotos = childs.length;
full = new Array();
for (var i=0;i<childs.length;i++) {
fot = _root.createEmptyMovieClip("foto"+i,i);
dummy = _root.createEmptyMovieClip("dummy"+i, 2*fotos+2+i);
dummy.fot = i;
with(fot) {
_x = 165;
_y = 5 + 80*i;
}
full[i] = childs[i].firstChild.nodeValue;
fot.loadMovie(childs[i].attributes.thumb);
dummy.onEnterFrame = function () {
var tmp = _root["foto"+this.fot];
if ((tmp.getBytesLoaded()>100) && (tmp.getBytesTotal()==tmp.getBytesLoaded()) && (tmp._height>0)) {
delete this.onEnterFrame;
tmp.id = this.fot;
tmp._width=70;
tmp._height=70;
tmp.onRelease = function() {
_root.createEmptyMovieClip("fullfoto", fotos+1);
_root.createEmptyMovieClip("dummy", fotos+2);
fullfoto.loadMovie(full[this.id]);
dummy.onEnterFrame = function() {
if ((fullfoto.getBytesTotal()==fullfoto.getBytesLoaded()) && (fullfoto.getBytesLoaded()>100)) {
delete this.onEnterFrame;
fullfoto._width = fullfoto._width;
fullfoto._height = fullfoto._height;
fullfoto._x = 10;
fullfoto._y = 10;
fullfoto.onRelease = function() {
fullfoto.removeMovieClip();
}
}
}
}
}
}
}
}
}
fotoXML.load("test.xml");
en dit :
menuXML = new XML();
menuXML.ignoreWhite = true;
menuXML.onLoad = function(success) {
if (success) {
menuItem = menuXML.firstChild.childNodes;
for (var i=0; i<menuItem.length; i++) {
item = _root.attachMovie("itemClip", "itemClip" + i, i);
item._x = 0;
item._y = 20*i;
item.itemLabel.text = menuItem[i].attributes.name;
item.myUrl = menuItem[i].attributes.url;
item.onRelease = function() {
getURL(this.myUrl,"_blank");
}
}
}
}
menuXml.load("test.xml");
Maar ik wil ze integreren.
Iemand een idee?
thx