Antworten auf deine Fragen:
Neues Thema erstellen

Antworten zum Thema „fehler in actionscript“

susiH

Aktives Mitglied

hi leute,
ich mache gerade eine bildergalerie mit flash. jetzt habe ich den actionscriptcode geschrieben, aber beim veröffentlichen wird mir immer ein fehler angezeigt.

Scene 1, Layer 'Layer 6', Frame 1, Line 80 1087: Syntax error: extra characters found after end of program.

HTML:
l. 78    }
l. 79    picture._y = 0;
l. 80    picture._x = 0;}
l. 81    };

kann vielleicht jemand den fehler entdecken?
 

gonzo6969

Internetschrauber

AW: fehler in actionscript

Ich würde mal ganz einfach sagen: Klammerfehler:
Die geschweifte Klammer in Zeile 80: Machst du vorher irgendwo mit einer runden Klammer auf?
 

susiH

Aktives Mitglied

AW: fehler in actionscript

hier ist mal der komplette code
HTML:
centerimages = 1;
controlheight = previous_btn._height+23;
bodybg._x = 0;
bodybg._y = 0;
bodybg._width = Stage.width+5;
bodybg._height = Stage.height+5;
previous_btn._x = 0;
previous_btn._y = Stage.height-previous_btn._height;
next_btn._x = Stage.width-next_btn._width;
next_btn._y = Stage.height-next_btn._height;


function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
// listen = new Object();
// listen.onKeyDown = function() {
// if (Key.getCode() == Key.LEFT) {
// prevImage();
// }
// if (Key.getCode() == Key.RIGHT) {
// nextImage();
// }
// };
// Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
preloader._x = Stage.width/2 - preloader._width/2;
preloader._y = (Stage.height-controlheight)/2 - preloader._height/2;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
    
}
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
if(picture._height >= Stage.height - controlheight){
picture._height = Stage.height - controlheight;
picture._xscale = picture._yscale;
}
if(picture._width >= Stage.width){
picture._width = Stage.width;
picture._yscale = picture._xscale;
}
if(centerimages > 0){
picture._y = (Stage.height-controlheight)/2 - picture._height/2;
picture._x = Stage.width/2 - picture._width/2;
} else {
    
}
picture._y = 0;
picture._x = 0;}
};

function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture._yscale = 100;
picture._xscale = 100;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
if(total == p+1){
next_btn._visible = false;
previous_btn._visible = true;
} else {
    
    next_btn._visible = true;
previous_btn._visible = true;
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture._yscale = 100;
picture._xscale = 100;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
if(p < 1){
previous_btn._visible = false;
next_btn._visible = true;
} else {
previous_btn._visible = true;
next_btn._visible = true;
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture._yscale = 100;
picture._xscale = 100;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
previous_btn._visible = false;
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos +” / “+total;
}
 

gonzo6969

Internetschrauber

AW: fehler in actionscript

hier ist mal der komplette code
HTML:
centerimages = 1;
controlheight = previous_btn._height+23;
bodybg._x = 0;
bodybg._y = 0;
bodybg._width = Stage.width+5;
bodybg._height = Stage.height+5;
previous_btn._x = 0;
previous_btn._y = Stage.height-previous_btn._height;
next_btn._x = Stage.width-next_btn._width;
next_btn._y = Stage.height-next_btn._height;


function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
// listen = new Object();
// listen.onKeyDown = function() {
// if (Key.getCode() == Key.LEFT) {
// prevImage();
// }
// if (Key.getCode() == Key.RIGHT) {
// nextImage();
// }
// };
// Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
preloader._x = Stage.width/2 - preloader._width/2;
preloader._y = (Stage.height-controlheight)/2 - preloader._height/2;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
    
}
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
if(picture._height >= Stage.height - controlheight){
picture._height = Stage.height - controlheight;
picture._xscale = picture._yscale;
}
if(picture._width >= Stage.width){
picture._width = Stage.width;
picture._yscale = picture._xscale;
}
if(centerimages > 0){
picture._y = (Stage.height-controlheight)/2 - picture._height/2;
picture._x = Stage.width/2 - picture._width/2;
} else {
    
}<-- die ist zuviel, bitte löschen
picture._y = 0;
picture._x = 0;}
};

function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture._yscale = 100;
picture._xscale = 100;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
if(total == p+1){
next_btn._visible = false;
previous_btn._visible = true;
} else {
    
    next_btn._visible = true;
previous_btn._visible = true;
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture._yscale = 100;
picture._xscale = 100;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
if(p < 1){
previous_btn._visible = false;
next_btn._visible = true;
} else {
previous_btn._visible = true;
next_btn._visible = true;
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture._yscale = 100;
picture._xscale = 100;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
previous_btn._visible = false;
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos +” / “+total;
}

Geschweifte Klammer in Zeile 79 löschen, die gibt einen leeren 'else' und damit ist die geschweifte Klammer in Zeile 80 zuviel
Grüße
Richard
 
Zuletzt bearbeitet:

susiH

Aktives Mitglied

AW: fehler in actionscript

nachdem ich die klammer entfernt habe, wird mir ein fehler in der zeile 81 angezeigt

Scene 1, Layer 'Layer 6', Frame 1, Line 81 1087: Syntax error: extra characters found after end of program.
 

muh83

Nicht mehr ganz neu hier

AW: fehler in actionscript

Ich würde dir als Tipp geben, besser zu formatieren, dann hast du auch keine Probleme mehr! Außerdem gehören am Ende einer function keine Semikolon hin!
Habe dir mal deinen Code formatiert!

Code:
centerimages = 1;
controlheight = previous_btn._height + 23;
bodybg._x = 0;
bodybg._y = 0;
bodybg._width = Stage.width + 5;
bodybg._height = Stage.height + 5;
previous_btn._x = 0;
previous_btn._y = Stage.height - previous_btn._height;
next_btn._x = Stage.width - next_btn._width;
next_btn._y = Stage.height - next_btn._height;


function loadXML(loaded)
{
    if (loaded)
    {
        xmlNode = this.firstChild;
        image = [];
        description = [];
        total = xmlNode.childNodes.length;

        for (i=0; i<total; i++)
        {
            image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
            description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
        }

        firstImage();

    }
    else
    {
        content = "file not loaded!";
    }

    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("images.xml");
    // listen = new Object();
    // listen.onKeyDown = function() {
    // if (Key.getCode() == Key.LEFT) {
    // prevImage();
    // }
    // if (Key.getCode() == Key.RIGHT) {
    // nextImage();
    // }
    // };
    // Key.addListener(listen);
    previous_btn.onRelease = function() 
    {
    prevImage();
    };
    next_btn.onRelease = function() 
    {
    nextImage();
    };
    p = 0;
}
this.onEnterFrame = function() 
{
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
preloader._x = Stage.width/2 - preloader._width/2;
preloader._y = (Stage.height-controlheight)/2 - preloader._height/2;

if (loaded != filesize) 
{
preloader.preload_bar._xscale = 100*loaded/filesize;
}
else 
{
    }

preloader._visible = false;

if (picture._alpha<100) 
picture._alpha += 10;

if(picture._height >= Stage.height - controlheight)
{
picture._height = Stage.height - controlheight;
picture._xscale = picture._yscale;
}
if(picture._width >= Stage.width)
{
picture._width = Stage.width;
picture._yscale = picture._xscale;
}
if(centerimages > 0)
{
picture._y = (Stage.height-controlheight)/2 - picture._height/2;
picture._x = Stage.width/2 - picture._width/2;
} 
else 
{
picture._y = 0;
picture._x = 0;
}
};

function nextImage()
{
    if (p<(total-1))
    {
        p++;
        if (loaded==filesize)
        {
            picture._alpha=0;
            picture._yscale=100;
            picture._xscale=100;
            picture.loadMovie(image[p], 1);
            desc_txt.text=description[p];
            picture_num();
        }
    }
    if (total==p+1)
    {
        next_btn._visible=false;
        previous_btn._visible=true;
    }
    else
    {
        next_btn._visible=true;
        previous_btn._visible=true;
    }
}

function prevImage()
{
    if (p>0)
    {
        p--;
        picture._alpha=0;
        picture._yscale=100;
        picture._xscale=100;
        picture.loadMovie(image[p], 1);
        desc_txt.text=description[p];
        picture_num();
    }
    if (p<1)
    {
        previous_btn._visible=false;
        next_btn._visible=true;
    }
    else
    {
        previous_btn._visible=true;
        next_btn._visible=true;
    }
}
function firstImage()
{
    if (loaded==filesize)
    {
        picture._alpha=0;
        picture._yscale=100;
        picture._xscale=100;
        picture.loadMovie(image[0], 1);
        desc_txt.text=description[0];
        picture_num();
        previous_btn._visible=false;
    }
}

function picture_num()
{
    current_pos=p+1;
    pos_txt.text=current_pos+" / "+total;
}
 

susiH

Aktives Mitglied

AW: fehler in actionscript

ich habe den code jetzt so eingefügt, aber jetzt werden mir gleich 125 fehler angezeigt.
woher kann denn sowas kommen?
 

ssandner

Nicht mehr Newbie

AW: fehler in actionscript

Du willst doch in AS3 schreiben, oder?

Also nach ihrem ursprünglichen Code hat sie in AS2 geschrieben. Sieht man an
Code:
bodybg._x = 0;
bodybg._y = 0;
bodybg._width = Stage.width+5;
bodybg._height = Stage.height+5;
In AS3 wird "x", "y", width" und "height" ohne Unterstrich angesprochen.
 

muh83

Nicht mehr ganz neu hier

AW: fehler in actionscript

Wobei hierbei handelt es sich doch um AS3, oder gab es da auch so in AS2? Denn dort werden ja Objecte erzeugt und die gab es doch so nicht in AS2.

Code:
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
 

susiH

Aktives Mitglied

AW: fehler in actionscript

ich hab den fehler gefunden. ich hatte einen fehler beim veröffentlichen. da war beim script as 3.0 eingestellt. warum das auch immer so war. hatte ja beim einrichten eine as2 datei gewählt.
danke für eure hilfe. jetzt klappt es
 

ssandner

Nicht mehr Newbie

AW: fehler in actionscript

Wobei hierbei handelt es sich doch um AS3, oder gab es da auch so in AS2? Denn dort werden ja Objecte erzeugt und die gab es doch so nicht in AS2.

Code:
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;

OOP war auch schon unter AS2 möglich, allerdings ist es unter AS3 vervollständigt und verfeinert worden.
 
Bilder bitte hier hochladen und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Antworten auf deine Fragen:
Neues Thema erstellen

Willkommen auf PSD-Tutorials.de

In unseren Foren vernetzt du dich mit anderen Personen, um dich rund um die Themen Fotografie, Grafik, Gestaltung, Bildbearbeitung und 3D auszutauschen. Außerdem schalten wir für dich regelmäßig kostenlose Inhalte frei. Liebe Grüße senden dir die PSD-Gründer Stefan und Matthias Petri aus Waren an der Müritz. Hier erfährst du mehr über uns.

Stefan und Matthias Petri von PSD-Tutorials.de

Nächster neuer Gratisinhalt

03
Stunden
:
:
25
Minuten
:
:
19
Sekunden

Neueste Themen & Antworten

Flatrate für Tutorials, Assets, Vorlagen

Zurzeit aktive Besucher

Statistik des Forums

Themen
175.182
Beiträge
2.582.054
Mitglieder
67.254
Neuestes Mitglied
MKP
Oben