Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 27-12-2005, 13:47   #1 (permalink)
Neuer User
 
Registriert seit: Dec 2005
Beiträge: 9
[flash 8] externe bilder crossfaden

hallo zusammen
ich bräuchte hilfe. nach einer ausführlichen recherche hab ich leider nichts zu meinem problem gefunden.
ich habe eine fotogalerie mit sound, bei der zu jedem bild ein spezieller sound geladen wird. die bilder und sounds werden über xml geladen, um das ganze leicht aktualisierbar zu haltenl.

ich möchte die bilder ein-, und ausfaden. diese werden aber nur solange angezeigt, wie der dazugehörige sound dauert. ist der sound vorbei - wechselt auch das bild.

kann mir jemand bitte einen tipp geben?

hier das actionscript

PHP-Code:
stop();//film anhalten

//-------------Bilderladen----------------------------------------------------------------
mein_xml = new XML();
mein_xml.ignoreWhite true;
mein_xml.load("bilddaten.xml");

// Lesevorgang 
mein_xml.onLoad = function(status) {
    if (
status && this.loaded) {
    
anzahl mein_xml.firstChild.childNodes.length;
    
geladen true;
    
aktbild 0;
    
ladeBild(aktBild);

    }
};


function 
ladeBild(aktBild) {
    
status_mc._visible 1;
    
bild mein_xml.firstChild.childNodes[aktBild].attributes.pic;
    
bildname mein_xml.firstChild.childNodes[aktBild].attributes.name;
    
loadMovie(bild"bild_mc");
}

//---------------------------Songs laden--------------------------------------------

songliste = new XML();
songliste.ignoreWhite=true;
songliste.onLoad = function (success) {
if(
success) {
_global.songnamen = [];
_global.songfiles = [];
for (var 
i=0i<songliste.firstChild.childNodes.lengthi++) {
_global.songnamen[i] = songliste.firstChild.childNodes[i].attributes.name;
_global.songfiles[i] = songliste.firstChild.childNodes[i].attributes.file;



_root.createEmptyMovieClip("sound_mc",1);
_root.sound_mc.sound_obj = new Sound();
_global.song_nr random(songfiles.length songfiles.length 1);  
_root.sound_mc.song_starten(songfiles[song_nr],songnamen[song_nr]);
} else {
anz.text="Fehler beim Laden der XML datei"}
}

MovieClip.prototype.song_starten = function (filename) {
this.sound_obj.loadSound(file,true)
}

this.onEnterFrame = function () {
this._parent.moment.textaktbild 1
this
._parent.insgesamt.textsongfiles.length 

if(this.sound_obj.position>0) {
delete this.onEnterFrame
this._parent.titel_txt.text=name;
} else {
this._parent.titel_txt.text="loading..." 
}
}

this.sound_obj.onSoundComplete = function () {
(
song_nr==songfiles.length-1)? _root.sound_mc.sound_obj.stop _global.song_nr++ 
_root.sound_mc.song_starten(songfiles[song_nr],songnamen[song_nr]); {
    if (
geladen && aktbild<anzahl-1) {
        
aktbild++;
        
ladeBild(aktBild);
        
    }
}}

//--------------------- Sound lauter-leiser --------------------------------

onEnterFrame = function() {
globalSound = new Sound();
var 
maxVolume 200;
var 
minVolume 0;
var 
volSteigerung 20;
vol globalSound.getVolume()
regler._xscale vol 2




lauter
.onRelease = function() {
    
globalSound.setVolume(Math.min(globalSound.getVolume()+volSteigerungmaxVolume));
    
};
leiser.onRelease = function() {
    
globalSound.setVolume(Math.max(globalSound.getVolume()-volSteigerungminVolume));
};  
}

//--------------------- Play/Stop - Bild / Sound ---------------------------------

btn_play.onRelease = function () {
this._parent.sound_mc.song_starten(songfiles[song_nr],songnamen[song_nr]);//aktuell ausgewählten Song starten
}
btn_stop.onRelease = function() {
this._parent.sound_mc.sound_obj.stop(); 
}

//--------------------- Nächstes Bild / Sound ---------------------------------
btn_next.onRelease = function () {
(
song_nr==songfiles.length-1)? _global.song_nr=aktbild _global.song_nr++;
    
    if (
geladen && aktbild<anzahl-1) {
        
aktbild++;
        
ladeBild(aktBild);
    }
_root.sound_mc.song_starten(songfiles[song_nr],songnamen[song_nr]);
}

//--------------------- Vorheriges Bild / Sound ---------------------------------
btn_back.onRelease = function () {
(
song_nr==0)? _global.song_nr=aktbild _global.song_nr--;
    if (
geladen && aktbild>0) {
        
aktbild--;
        
ladeBild(aktBild);
    }

_root.sound_mc.song_starten(songfiles[song_nr],songnamen[song_nr]);
}
songliste.load("songlist.xml");//Liste laden 

Geändert von stabilo5 (28-12-2005 um 13:37 Uhr)
stabilo5 ist offline   Mit Zitat antworten
Alt 27-12-2005, 16:35   #2 (permalink)
The Man Who Wasn't There
 
Benutzerbild von fraggle two
 
Registriert seit: Jul 2003
Ort: BÄRLIN
Beiträge: 1.156
hi,

kommentier das mal aus:

PHP-Code:
this.sound_obj.onSoundComplete = function () {
(
song_nr==songfiles.length-1)? _root.sound_mc.sound_obj.stop _global.song_nr++ 
_root.sound_mc.song_starten(songfiles[song_nr],songnamen[song_nr]); {
    if (
geladen && aktbild<anzahl-1) {
        
aktbild++;
        
ladeBild(aktBild);
        
    }
}} 
dann sollte das bild nur über die vor und zurückbuttons geändert werden können...

gruß
mike
__________________
Dot-Realities
Mike Broders
Berlin

ICQ:105925103

Dot-Realities v4.0 under construction!
fraggle two ist offline   Mit Zitat antworten
Alt 28-12-2005, 08:35   #3 (permalink)
Neuer User
 
Registriert seit: Dec 2005
Beiträge: 9
danke für die schnelle antwort!

die "this.sound_obj.onSoundComplete " funktion ist absicht, das soll so bleiben. ich hätte gerne dass das bild ein- und ausgefaded wird am beginn und ende des sounds.
weiss aber nicht wie ich das angehen soll.
stabilo5 ist offline   Mit Zitat antworten
Alt 28-12-2005, 13:11   #4 (permalink)
The Man Who Wasn't There
 
Benutzerbild von fraggle two
 
Registriert seit: Jul 2003
Ort: BÄRLIN
Beiträge: 1.156
hi,

ahhh soooo...

also ich glaub das liegt an diesem teil...

PHP-Code:
MovieClip.prototype.song_starten = function (filename) {
this.sound_obj.loadSound(file,true)
}

this.onEnterFrame = function () {
this._parent.moment.textaktbild 1
this
._parent.insgesamt.textsongfiles.length 

if(this.sound_obj.position>0) {
delete this.onEnterFrame
this._parent.titel_txt.text=name;
} else {
this._parent.titel_txt.text="loading..." 
}
}

this.sound_obj.onSoundComplete = function () {
(
song_nr==songfiles.length-1)? _root.sound_mc.sound_obj.stop _global.song_nr++ 
_root.sound_mc.song_starten(songfiles[song_nr],songnamen[song_nr]); {
    if (
geladen && aktbild<anzahl-1) {
        
aktbild++;
        
ladeBild(aktBild);
        
    }
}} 
oben die prototy-funktion machst du ja gleich wieder zu...

und den rest danach referenzierst du immer mit this.sound_obj

da this.sound_obj aber nicht mehr in deiner prototyp-funktion liegt findet die funktion das sound-objekt nicht...

ein bsp. file wär vielleicht nicht schlecht...

gruß
mike
__________________
Dot-Realities
Mike Broders
Berlin

ICQ:105925103

Dot-Realities v4.0 under construction!
fraggle two ist offline   Mit Zitat antworten
Alt 28-12-2005, 13:35   #5 (permalink)
Neuer User
 
Registriert seit: Dec 2005
Beiträge: 9
hallo ich hab hier die dateien
http://www2.klz.apa.net/test/fotogalerie.zip

mittlerweile hab ich schon wieder etwas herumgepfuscht
hier das [AS]

PHP-Code:
stop();

songliste = new XML();
songliste.ignoreWhite=true;
songliste.onLoad = function (success) {
    if(
success) {
    
_global.songfiles = [];
    
    for (var 
i=0i<songliste.firstChild.childNodes.lengthi++) {
    
_global.songfiles[i] = songliste.firstChild.childNodes[i].attributes.file;
    }
    
globalSound = new Sound();
var 
maxVolume 200;
var 
minVolume 0;
var 
volSteigerung 20;

lauter.onRelease = function() {
    
globalSound.setVolume(Math.min(globalSound.getVolume()+volSteigerungmaxVolume));
};

leiser.onRelease = function() {
    
globalSound.setVolume(Math.max(globalSound.getVolume()-volSteigerungminVolume));
};  

_root.createEmptyMovieClip("sound_mc",1);
_root.sound_mc.sound_obj = new Sound();
_global.song_nr random(songfiles.length); 
_root.sound_mc.song_starten(songfiles[song_nr]);
} else {
trace("fehler")}
}

MovieClip.prototype.song_starten = function (file) {
this.sound_obj.loadSound(file,true)
this.onEnterFrame = function () {
if(
this.sound_obj.position>0) {
delete this.onEnterFrame

}
}

this.sound_obj.onSoundComplete = function () {
(
song_nr==songfiles.length-1)? _global.song_nr=_global.song_nr++;
_root.sound_mc.song_starten(songfiles[song_nr]);
_root.changePhoto(1);}



songliste.load("songlist.xml");//Liste laden



bilder = new XML;
bilder.ignoreWhite=true;
bilder.load("bilddaten.xml");

bilder.onLoad = function (success) {
    if (
success) {
    
this.pathToPics "bilder/";
    
this.pArray = [];
    
    for (var 
i=0i<bilder.firstChild.childNodes.lengthi++) {
    
this.pArray[i] = this.pathToPics bilder.firstChild.childNodes[i].attributes.pfad;
    }
        }
    
//trace(this.pArray[0])
    
this.fadeSpeed 30;
loadMovie(this.pArray[0], _root.photo);
}


MovieClip.prototype.changePhoto = function(d) {
    
this.pIndex = (this.pIndex+d)%this.pArray.length;
    if (
this.pIndex<0) {
        
this.pIndex += this.pArray.length;
    }
    
    
this.onEnterFrame fadeOut;
};

MovieClip.prototype.fadeOut = function() {
    if (
this.photo._alpha>this.fadeSpeed) {
        
this.photo._alpha -= this.fadeSpeed;
    } else {
        
this.loadPhoto();
    }
};

MovieClip.prototype.loadPhoto = function() {
    var 
_root.photo;
    
//------------------------------------------
    
p._alpha 0;
    
p.loadMovie(this.pArray[this.pIndex]);
    
this.onEnterFrame loadMeter;
};

MovieClip.prototype.loadMeter = function() {
    var 
ilt;
    
this.photo.getBytesLoaded();
    
this.photo.getBytesTotal();
    if (
t>&& == l) {
        
this.onEnterFrame fadeIn;
    } else {
        
trace(l/t);
    }
};

MovieClip.prototype.fadeIn = function() {
    if (
this.photo._alpha<100-this.fadeSpeed) {
        
this.photo._alpha += this.fadeSpeed;
    } else {
        
this.photo._alpha 100;
        
this.onEnterFrame null;
    }
};

btn_play.onRelease = function () {
this._parent.sound_mc.song_starten(songfiles[song_nr],songnamen[song_nr]);
}
btn_stop.onRelease = function() {
this._parent.sound_mc.sound_obj.stop(); 
}
btn_next.onRelease = function () {
(
song_nr==songfiles.length-1)? _global.song_nr=_global.song_nr++;
_root.sound_mc.song_starten(songfiles[song_nr],songnamen[song_nr]);
_root.changePhoto(1);
}

btn_prev.onRelease = function () {
(
song_nr==0)? _global.song_nr=songfiles.length-_global.song_nr--;
_root.sound_mc.song_starten(songfiles[song_nr],songnamen[song_nr]);starten
_root
.changePhoto(-1);

das faden und das changePhoto hauen nicht hin

bitte um hilfe!
stabilo5 ist offline   Mit Zitat antworten
Alt 28-12-2005, 15:49   #6 (permalink)
The Man Who Wasn't There
 
Benutzerbild von fraggle two
 
Registriert seit: Jul 2003
Ort: BÄRLIN
Beiträge: 1.156
hi,

hoffe du kannst noch bis morgen warten...

gruß
mike
__________________
Dot-Realities
Mike Broders
Berlin

ICQ:105925103

Dot-Realities v4.0 under construction!
fraggle two ist offline   Mit Zitat antworten
Alt 29-12-2005, 10:11   #7 (permalink)
Neuer User
 
Registriert seit: Dec 2005
Beiträge: 9
fraggle two: kann ich - danke!
stabilo5 ist offline   Mit Zitat antworten
Alt 29-12-2005, 12:05   #8 (permalink)
The Man Who Wasn't There
 
Benutzerbild von fraggle two
 
Registriert seit: Jul 2003
Ort: BÄRLIN
Beiträge: 1.156
hi,

schick mal ne mail adresse für den kram...

hier kann ichs nicht posten...

gruß
mike
__________________
Dot-Realities
Mike Broders
Berlin

ICQ:105925103

Dot-Realities v4.0 under construction!
fraggle two 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 08:48 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele