Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 19-04-2004, 13:18   #1 (permalink)
Neuer User
 
Registriert seit: Apr 2004
Beiträge: 1
Question business präsentation mit html-formatierungen aus xml erweitern??

Hallo!

von der Businesspräsentation auf
http://www.macromedia.com/de/devnet/...entations.html
inspiriert versuche ich nun - als totaler flash-anfänger - einen weiteren folientyp hinzuzufügen, der:
-text in html formatiert anzeigen kann
-eine kleine überschrift hat
-ein kleines bildchen enthält

so sieht die xml datei zum test aus:
PHP-Code:
<Presentation>
  <
slide type="0">
    <
title>Titel zum Test</title>
    <
description>...hier die testbeschreibung....</description>
    <
owner>hier der Autor </owner>
    <
background>testhintergrund.swf</background>
  </
slide>
  <
slide type="3">
    <
teilueberschrift>Teilüberschirft hier</teilueberschrift>
    <
bildchen>graph1.swf</bildchen>
    <
stext> <i>text Design</iblablubbb bla text</stext>
    <
ltext>hier der lange text.... <b>funktioniert!</b></ltext>
  </
slide>
  <
slide type="1">
    <
line>nochwas</line>
    <
lineblablablablabla sehr inhaltsstark</line>
  </
slide>
  <
slide type="1">
    <
line>schon wieder ne folie </line>
    <
line>und noch mehr text zum test</line>
  </
slide>
  <
slide type="2">
    <
picture>graph1.swf</picture>
  </
slide>
  <
slide type="1">
    <
line>blababababababab-bla</line>
  </
slide>
  <
slide type="1">
    <
line>und hier ist schon schluss!</line>
  </
slide>
</
Presentation
und so sieht das ergänzte action script aus:
ActionScript:
  1. VSPACE = 30;
  2. MAXLINES = 7;
  3. line.htmlText = true;
  4.  
  5.  
  6.  
  7. // Load XML presentation file and then call: startPresentation()
  8. pres_xml = new XML();
  9. pres_xml.load("presentation.xml");
  10. pres_xml.ignoreWhite = true;
  11. pres_xml.onLoad = startPresentation;
  12.  
  13.  
  14. // Get the rootNode, then the first slide node and
  15. // finally call showSlide(firstSlide);
  16.  
  17. function startPresentation() {
  18.     rootNode = pres_xml.firstChild;
  19.     firstSlide = rootNode.firstChild;
  20.     currentSlide = firstSlide;
  21.     showSlide(firstSlide);
  22. }
  23.  
  24. // first determine the slide type = $type
  25. // then show right slide
  26. function showSlide($slideNode) {
  27.     $type = $slideNode.attributes.type;
  28.     switch ($type) {
  29.         case "0":
  30.             hideSlides();
  31.             showSlideType0($slideNode);
  32.             break;
  33.         case "1":
  34.             hideSlides();
  35.             showSlideType1($slideNode);
  36.             break;
  37.         case "2":
  38.             hideSlides();
  39.             showSlideType2($slideNode);
  40.             break;
  41.         case "3":
  42.             hideSlides();
  43.             showSlideType3($slideNode);
  44.             break;
  45.     }
  46. }
  47.  
  48.  
  49. function hideSlides() {
  50.     _root.stype0._visible = false;
  51.     _root.stype1._visible = false;
  52.     _root.stype2._visible = false;
  53.     _root.stype3._visible = false;
  54. }
  55.    
  56.  
  57. function showSlideType1($slideNode) {
  58.    
  59.     prevScreenLine = _root.stype1.line1;
  60.     lineNode = $slideNode.firstChild;
  61.     i = 1;
  62.  
  63.     // loop through the XML <line> nodes (lineNode.nextSibling)
  64.     // and copy their content (lineNode.firstChild.nodeValue)
  65.     // into the textfield instance (currScreenLine.line.text).
  66.     do {
  67.         currScreenLine = eval("_root.stype1.line" + i );
  68.         currScreenLine.line.text = lineNode.firstChild.nodeValue;
  69.  
  70.         PositionLine();
  71.         prevScreenLine = currScreenLine;
  72.  
  73.         lineNode = lineNode.nextSibling;
  74.         i++;
  75.     } while (lineNode != null)
  76.    
  77.     // Clear out extra lines that have no content
  78.     for (j=i; j < MAXLINES+1; j++) {
  79.         scrnLine = eval("_root.stype1.line" + j );
  80.         scrnLine.line.htmlText = "";
  81.     }
  82.    
  83.     // make slide visible
  84.     _root.stype1._visible = true;
  85. }
  86.  
  87. // Get the content of the <picture> node and
  88. // load it into slide type 2.
  89. function showSlideType2($slideNode) {
  90.     pictNode = $slideNode.firstChild;
  91.     _root.stype2.thepicture.loadMovie(pictNode.firstChild.nodeValue);
  92.     _root.stype2._visible = true;
  93. }
  94.  
  95. // Get the individual nodes (title, description, owner, background)
  96. // and populate slide type 0
  97. function showSlideType0($slideNode) {
  98.    
  99.     titleNode = $slideNode.firstChild;
  100.     _root.stype0.titleline.line.text = titleNode.firstChild.nodeValue;
  101.    
  102.     descNode = titleNode.nextSibling;
  103.     _root.stype0.descline.line.text = descNode.firstChild.nodeValue;
  104.        
  105.     ownerNode = descNode.nextSibling;
  106.     _root.stype0.ownerline.line.text = ownerNode.firstChild.nodeValue;
  107.  
  108.     if (! bgLoaded) {
  109.         bgNode = ownerNode.nextSibling;
  110.         _root.background.loadMovie(bgNode.firstChild.nodeValue);
  111.         bgLoaded = true;
  112.     }   
  113.     _root.stype0._visible = true;
  114. }
  115.  
  116.  
  117.  
  118.  
  119. // Funktion zum Anzeigen vom 3ten Folientyp:
  120. function showSlideType3($slideNode) {
  121.     // teilüberschrift anzeigen
  122.     teilueberschriftNode = $slideNode.firstChild;
  123.     _root.stype3.teilueberschriftanzeige.line.text = teilueberschriftNode.firstChild.nodeValue;
  124.    
  125.     // bildchen anzeigen
  126.     bildchenNode = teilueberschriftNode.nextSibling;
  127.     _root.stype3.bildchenanzeige.loadMovie(bildchenNode.firstChild.nodeValue);
  128.    
  129.     // stext anzeigen (kurzer Text) 
  130.     stextNode = bildchenNode.nextSibling;
  131.     _root.stype3.stextanzeige.httext.htmlText = stextNode.firstChild.nodeValue;
  132.        
  133.     // ltext anzeigen (längerer Text)
  134.     ltextNode = stextNode.nextSibling;
  135.     _root.stype3.ltextanzeige.httext.htmlText = ltextNode.firstChild.nodeValue;
  136.    
  137.     // nun alles eingelesen -> einblenden
  138.     _root.stype3._visible = true;
  139. }
  140.  
  141.  
  142.  
  143. function PositionLine() {
  144.     // make the height of the text box the same as the height of the text in it, plus 5.
  145.     currScreenLine.line._height = currScreenLine.line.textHeight + 5;
  146.    
  147.     // position current line below the previous line at a distance of:
  148.     // "previous lines text height + VSPACE"
  149.     if (currScreenLine != prevScreenLine) {
  150.         currScreenLine._y = (prevScreenLine._y + prevScreenLine.line.textHeight + VSPACE);
  151.     }
  152. }
  153.  
  154. function gotoNextSlide() {
  155.    
  156.     if (currentSlide.nextSibling == null) {
  157.             return;
  158.     } else {
  159.             currentSlide = currentSlide.nextSibling;
  160.             showSlide(currentSlide);
  161.     }
  162. }
  163.  
  164.  
  165. function gotoPrevSlide() {
  166.  
  167.     if (currentSlide.previousSibling == null) {
  168.             return;
  169.     } else {
  170.             currentSlide = currentSlide.previousSibling;
  171.             showSlide(currentSlide);
  172.     }
  173. }
  174.  
  175.  
  176. function gotoFirstSlide() {
  177.    
  178.         currentSlide = rootNode.firstChild;
  179.         showSlide(currentSlide);
  180. }

aber irgendwie hab ich ein riesenproblem: im Film-Explorer wird z.B. slideType3 und httext überhaupt nicht angezeigt unter den symboldefinitionen. in der Bibliothek und im Drop-Down menu "Symbole bearbeiten" dagegen schon, aber irgendwie muss ich die ja noch einbinden.

Die html-formatierten texte will ich mit einem dynamischen textfeld (httext) ausgeben, andere versuche "line" dafür zu nutzen sind immer fehlgeschlagen, auch wenn ich .....htmlText = true; gesetzt hatte, da kam dann immer "null" wenn ein paar wörter z.B. kursiv waren.

Zu Sicherheit hier meine ganzen Dateien: unter
http://home.arcor.de/kypdyroon/flash...sentation.html
gibt es die präsentation, im selben verzeichnis http://home.arcor.de/kypdyroon/flash123/ auch die .fla datei.

Wie gesagt: das ganze funktioniert soweit, dass beim typ3 nix angezeigt wird.
Wie krieg ich es hin dass es auch funktioniert mit der html-Formatierung?

Vielen Dank im Vorraus!!!

mFg
molnium
molnium 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 an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 23:57 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele