Zurück   Flashforum > Flash > Flash erweitern > Flash Entwicklungsumgebung erweitern

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 14-06-2004, 10:24   #1 (permalink)
Neuer User
 
Registriert seit: Jun 2004
Beiträge: 6
[AS, xml, css] Hilfe bitte!!

Hallo,

Koennte mir jemand hiermit helfen?

Ich moechte eine xml datei gebrauchen, die Bilder in eine "slideshow" ladet.
Die slideshow funktioniert prima. Allerdings moechte ich zu den Bildern auch noch Text in ein dynamisches Textfeld laden. Dieser Text kommt im moment von einem xml-file der css-formattierten text enthaelt. Wie kann ich die untestehenden scripts combinieren, so das ich den richtigen text zum rictigen Bild einlese?

Fuer die Slideshow:

ActionScript:
  1. -------------------
  2.  
  3. spacing = 10;
  4. containerMC._alpha = 0;
  5. var pArray = new Array();
  6. var tArray = new Array();
  7. MovieClip.prototype.loadPic = function(pic) {
  8. containerMC._alpha = 0;
  9. cur = pic;
  10. this.loadMovie(pArray[pic]);
  11. this._parent.onEnterFrame = function() {
  12. var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
  13. if (t != 0 && Math.round(l/t) == 1 && containerMC._width>0) {
  14. var w = containerMC._width+spacing, h = containerMC._height+spacing;
  15. border.resizeMe(w, h, pic);
  16. delete this._parent.onEnterFrame;
  17. }
  18. };
  19. };
  20. MovieClip.prototype.resizeMe = function(w, h, pic) {
  21. var speed = 3;
  22. this.onEnterFrame = function() {
  23. this._width += (w-this._width)/speed;
  24. this._height += (h-this._height)/speed;
  25. nav._x = Math.round(this._x-this._width/2);
  26. nav._y = Math.round(this._y+this._height/2+spacing/2);
  27.  
  28.  
  29. picinfo.info.text = tArray[pic];
  30. picinfo._x = border._x-picinfo._width/2;
  31. if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
  32. this._width = w;
  33. this._height = h;
  34. containerMC._x = this._x-this._width/2+spacing/2;
  35. containerMC._y = this._y-this._height/2+spacing/2;
  36. containerMC._alpha = 100;
  37. delete this.onEnterFrame;
  38. }
  39. };
  40. };
  41. var gallery_xml = new XML();
  42. gallery_xml.ignoreWhite = true;
  43. gallery_xml.onLoad = function(success) {
  44. if (success) {
  45. var gallery = this.firstChild;
  46. // pathToPics = gallery.attributes.path;
  47. for (var i = 0; i<gallery.childNodes.length; i++) {
  48. tArray.push(gallery.childNodes[i].attributes.title);
  49. pArray.push(gallery.childNodes[i].attributes.source);
  50. }
  51. loadPhoto();
  52. } else {
  53. title_txt.text = "Error!";
  54. }
  55. };
  56. gallery_xml.load("gallery/img_txt/images/gal_one.xml");
  57. prevb.onRelease = function() {
  58. if (cur == 0) {
  59. containerMC.loadPic(pArray.length-1);
  60. } else {
  61. containerMC.loadPic(cur-1);
  62. }
  63. };
  64. nextb.onRelease = function() {
  65. if (cur == pArray.length-1) {
  66. containerMC.loadPic(0);
  67. } else {
  68. containerMC.loadPic(cur+1);
  69. }
  70. };
  71. stop();
-------------------
Fuer das Textfeld:
-------------------
ActionScript:
  1. //init TextArea component
  2. this.myText.html = true;
  3. this.myText.wordWrap = true;
  4. this.myText.multiline = true;
  5. this.myText.label.condenseWhite=true;
  6. /******************************/
  7. //load css
  8. cryoStyle = new TextField.StyleSheet();
  9. cryoStyle.load("gallery/img_txt/text/cryo.css");
  10. this.myText.styleSheet = cryoStyle;
  11.  
  12. /******************************/
  13. //load in XML
  14. cryoStyle = new XML();
  15. cryoStyle.ignoreWhite = true;
  16. cryoStyle.load("gallery/img_txt/text/cryo.xml");
  17. cryoStyle.onLoad = function(success)
  18. {
  19. if(success)
  20. {
  21. myText.text = cryoStyle;
  22. }
  23. }
-------------------

Wie kann ich bei z.B. Bild 1, text 1 einlesen?

Vielen Dank,

Gene
generator1 ist offline   Mit Zitat antworten
Alt 14-06-2004, 13:11   #2 (permalink)
nky
Bontempi Punk
 
Benutzerbild von nky
 
Registriert seit: Dec 2001
Ort: Dtld/Pfalz
Beiträge: 4.185
ohne syntax highlightning sieht das echt schäbig aus
liegt wohl daran das noch kein [AS] support ist...

Vielleicht kannst Du`s noch auf [P HP] umstellen ?

Gruss nky
nky ist offline   Mit Zitat antworten
Alt 14-06-2004, 13:45   #3 (permalink)
FlashLove@FirstSight
 
Benutzerbild von FLASHStyler
 
Registriert seit: Feb 2003
Beiträge: 2.460
PHP-Code:
spacing 10;
containerMC._alpha 0;
var 
pArray = new Array();
var 
tArray = new Array();
MovieClip.prototype.loadPic = function(pic) {
containerMC._alpha 0;
cur pic;
this.loadMovie(pArray[pic]);
this._parent.onEnterFrame = function() {
var 
containerMC.getBytesTotal(), containerMC.getBytesLoaded();
if (
!= && Math.round(l/t) == && containerMC._width>0) {
var 
containerMC._width+spacingcontainerMC._height+spacing;
border.resizeMe(whpic);
delete this._parent.onEnterFrame;
}
};
};
MovieClip.prototype.resizeMe = function(whpic) {
var 
speed 3;
this.onEnterFrame = function() {
this._width += (w-this._width)/speed;
this._height += (h-this._height)/speed;
nav._x Math.round(this._x-this._width/2);
nav._y Math.round(this._y+this._height/2+spacing/2);


picinfo.info.text tArray[pic];
picinfo._x border._x-picinfo._width/2;
if (
Math.abs(this._width-w)<&& Math.abs(this._height-h)<1) {
this._width w;
this._height h;
containerMC._x this._x-this._width/2+spacing/2;
containerMC._y this._y-this._height/2+spacing/2;
containerMC._alpha 100;
delete this.onEnterFrame;
}
};
};
var 
gallery_xml = new XML();
gallery_xml.ignoreWhite true;
gallery_xml.onLoad = function(success) {
if (
success) {
var 
gallery this.firstChild;
// pathToPics = gallery.attributes.path;
for (var 0i<gallery.childNodes.lengthi++) {
tArray.push(gallery.childNodes[i].attributes.title);
pArray.push(gallery.childNodes[i].attributes.source);
}
loadPhoto();
} else {
title_txt.text "Error!";
}
};
gallery_xml.load("gallery/img_txt/images/gal_one.xml");
prevb.onRelease = function() {
if (
cur == 0) {
containerMC.loadPic(pArray.length-1);
} else {
containerMC.loadPic(cur-1);
}
};
nextb.onRelease = function() {
if (
cur == pArray.length-1) {
containerMC.loadPic(0);
} else {
containerMC.loadPic(cur+1);
}
};
stop();

//Fuer das Textfeld:
//init TextArea component
this.myText.html true;
this.myText.wordWrap true;
this.myText.multiline true;
this.myText.label.condenseWhite=true;
/******************************/
//load css
cryoStyle = new TextField.StyleSheet();
cryoStyle.load("gallery/img_txt/text/cryo.css");
this.myText.styleSheet cryoStyle;

/******************************/
//load in XML
cryoStyle = new XML();
cryoStyle.ignoreWhite true;
cryoStyle.load("gallery/img_txt/text/cryo.xml");
cryoStyle.onLoad = function(success)
{
if(
success)
{
myText.text cryoStyle;
}

__________________
www.johannes-erhardt.com | blog | xing me baby
FLASHStyler ist offline   Mit Zitat antworten
Alt 14-06-2004, 13:56   #4 (permalink)
Neuer User
 
Registriert seit: Jun 2004
Beiträge: 6
Danke dass Du mir das Script formattiert hasst!!!

Jetzt wo das Script lesbar ist, kann Mir jemand helfen?
Wie kann ich, wenn ich die next und prev buttons gebrauche, den richtigen Text zum richtigen Bild laden? Der text sollte von einem xml file kommen der CSS gebraucht um den text zu formattieren...?

Danke fuer eventuelle Hilfe,

Gene
generator1 ist offline   Mit Zitat antworten
Alt 14-06-2004, 14:10   #5 (permalink)
nky
Bontempi Punk
 
Benutzerbild von nky
 
Registriert seit: Dec 2001
Ort: Dtld/Pfalz
Beiträge: 4.185
wo ist die xml dazu ?
ich kann momentan rein logisch noch nix zuordnen...

falls das ding zu gross ist reicht auch ein knoten..

Gruss nky
nky ist offline   Mit Zitat antworten
Alt 14-06-2004, 14:20   #6 (permalink)
Neuer User
 
Registriert seit: Jun 2004
Beiträge: 6
Hey,

Hier ist die data die in den xml file steht, fuer die Image URL's und die Image Titel:

<?xml version="1.0" encoding="UTF-8"?>
<gallery path="animation/">
<image title= "Image One" source="gallery/img_txt/images/setOne/pic1.jpg" />
<image title="Image Two" source="gallery/img_txt/images/setOne/pic2.jpg" />
<image title="Image Three" source="gallery/img_txt/images/setOne/pic3.jpg" />
<image title="Image Four" source="gallery/img_txt/images/setOne/pic4.jpg" />
<image title="Image Five" source="gallery/img_txt/images/setOne/pic5.jpg" />
<image title="Image Six" source="gallery/img_txt/images/setOne/pic6.jpg" />

</gallery>


Fuer die Texte die zu den Bildern gehoeren, habe ich einen anderen xml file:

<?xml version="1.0" encoding="UTF-8"?>
<cryo>
<daheading>Text</daheading>
<br></br>
<daheading>Text</daheading>
<br></br>
<dabody>Text</dabody>
<br></br>
<daheading>Text</daheading>
<br></br>
<br></br>
<daheading>Text</daheading>
<br></br>
<dabody>Text</dabody>
<br></br>
<daheading>Text</daheading>
<br></br>
<br></br>
<daheading>Text</daheading>
<br></br>
<dabody>Text</dabody>
<br></br>
<daheading>Text</daheading>
</cryo>

Und dieses xml benutzt "tags" von diesem CSS:

daheading {
color: #333333;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
display: block;
}
dabody {
color: #000000;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
display: block;
}

-----------------------------------

Ist das die information die Du wolltest?

Danke fuer die Muehe,

Gene
generator1 ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist aus.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 01:56 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele