RobinJJJ
Threadersteller
Dabei seit: 15.05.2010
Ort: Berlin
Alter: -
Geschlecht:
|
Verfasst Do 10.03.2011 23:20
Titel Brauche Hilfe bei flash/xml/html problem |
|
|
hi leute,
bin grad an ner seite für nen künstler. hab mir nen image-slider zusammengebastelt der die bilder aus einer xml-datei erst preloaded und anzeigt. in der xml-datei ist im image-knoten ein title-attribut. Der titel wird im txt-feld vom preloader vom full_image angezeigt.
Meine Frage ist, wie kann ich den title-attribut als html auslesen? Hab schon alle möglichen CDATA varianten und as2 auslesemöglichkeiten die ich kenne ausprobiert. google natürlich auch. ich bekomm einfach das title attribut nicht richtig angesprochen. es geht los bei der function(callFullImage), bei der im preloader das my_txt feld erstellt wird. aber erst mal das script:
AS2 ohne meine html versuche:
Code: | import mx.transitions.Tween;
import mx.transitions.easing.*;
var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;
myGalleryXML.load("gallery.xml");
myGalleryXML.onLoad = function() {
_root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
_root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
_root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
_root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;
_root.myImages = myGalleryXML.firstChild.childNodes;
_root.myImagesTotal = myImages.length;
_root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
_root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;
_root.full_x = myGalleryXML.firstChild.attributes.full_x;
_root.full_y = myGalleryXML.firstChild.attributes.full_y;
callThumbs();
createMask();
scrolling();
};
function callThumbs() {
_root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());
container_mc._x = _root.gallery_x;
container_mc._y = _root.gallery_y;
var clipLoader = new MovieClipLoader();
var preloader = new Object();
clipLoader.addListener(preloader);
for (i=0; i<_root.myImagesTotal; i++) {
thumbURL = myImages[i].attributes.thumb_url;
myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth() );
myThumb_mc._x = _root.thumb_width*i;
clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc);
preloader.onLoadStart = function(target) {
target.createTextField("my_txt",target.getNextHighestDepth(),0,0,100,20);
target.my_txt.selectable = false;
};
preloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
};
preloader.onLoadComplete=function(target){
new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
target.my_txt.removeTextField();
target.onRelease=function(){
callFullImage(this._name);
}
target.onRollOver=function(){
new Tween(target, "_alpha", Strong.easeOut, 100, 50, 1, true);
};
target.onRollOut=function(){
new Tween(target, "_alpha", Strong.easeOut, 50, 100, 1, true);
};
}
}
}
function callFullImage(myNumber) {
myURL = myImages[myNumber].attributes.full_url;
myTitle = myImages[myNumber].attributes.title;
_root.createEmptyMovieClip("fullImage_mc",_root.getNextHighestDepth());
fullImage_mc._x = _root.full_x;
fullImage_mc._y = _root.full_y;
var fullClipLoader = new MovieClipLoader();
var fullPreloader = new Object();
fullClipLoader.addListener(fullPreloader);
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "helvetica";
my_fmt.size = 18;
my_fmt.color = 0xffffff;
fullPreloader.onLoadStart = function(target) {
target.createTextField("my_txt",target.getNextHighestDepth(),10,10,300,260);
target.my_txt.selectable = false;
target.my_txt.background = false;
target.my_txt.backgroundColor = 0x222222;
target.my_txt.border = false;
target.my_txt.multiline = true;
target.my_txt.wordWrap = true;
target.my_txt.setNewTextFormat(my_fmt);
};
fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
};
fullPreloader.onLoadComplete = function(target) {
new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
target.my_txt.text = myTitle;
};
fullClipLoader.loadClip("full_images/"+myURL,fullImage_mc);
this.close_btn.onRelease = function() {
removeMovieClip(this._parent.fullImage_mc);
};
}
function createMask() {
_root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth());
mask_mc._x = _root.gallery_x;
mask_mc._y = _root.gallery_y;
mask_mc.beginFill(0x000000,100);
mask_mc.lineTo(_root.gallery_width,0);
mask_mc.lineTo(_root.gallery_width,_root.gallery_height);
mask_mc.lineTo(0,_root.gallery_height);
mask_mc.lineTo(0,0);
container_mc.setMask(mask_mc);
}
function scrolling() {
_root.onEnterFrame = function() {
if (mask_mc._xmouse<(mask_mc._width*(1/3)) || mask_mc._xmouse>(mask_mc._width*(2/3))) {
container_mc._x += Math.cos(((mask_mc._xmouse)/mask_mc._width)*Math.PI)*15;
if (container_mc._x>mask_mc._x) {
container_mc._x = mask_mc._x;
}
if (container_mc._x<(mask_mc._x-(container_mc._width-mask_mc._width))) {
container_mc._x = mask_mc._x-(container_mc._width-mask_mc._width);
}
}
};
}
|
und der XML-code auch ohne html
Code: | <gallery thumb_width="105" thumb_height="150" gallery_width="1000" gallery_height="150" gallery_x="0" gallery_y="275"
full_x="0" full_y="0">
<image thumb_url="thumb01.jpg" full_url="01.png" title="Mango Juice" />
<image thumb_url="thumb02.jpg" full_url="02.png" title="Cherry Seven Up" />
<image thumb_url="thumb03.jpg" full_url="03.png" title="Strawberry Juice, and other stuff is not to complain about" />
<image thumb_url="thumb04.jpg" full_url="04.png" title="Rice and Chicken" />
<image thumb_url="thumb05.jpg" full_url="05.png" title="Mixed Capsicum" />
<image thumb_url="thumb06.jpg" full_url="06.png" title="Roma at Barbera Cafe" />
<image thumb_url="thumb07.jpg" full_url="07.png" title="Orange Juice" />
<image thumb_url="thumb08.jpg" full_url="08.png" title="Fries in Salalah" />
<image thumb_url="thumb09.jpg" full_url="09.png" title="Chicken Tacos" />
<image thumb_url="thumb10.jpg" full_url="10.png" title="Club Sandwiches" />
</gallery> |
wär echt nett wenn ihr mir weiterhelfen könntet.
Gruß, Robin.
Zuletzt bearbeitet von RobinJJJ am Do 10.03.2011 23:23, insgesamt 1-mal bearbeitet
|
|