Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 13-04-2007, 10:42   #1 (permalink)
Neuer User
 
Registriert seit: Dec 2005
Beiträge: 211
Vereinfachung einer "Videogallerie"

Habe eine Seite mit diversen Videos.
- 1 Monitorfeld
- 3 Textinfofelder (duration, titel, genre)
- 3 Buttons (Play, Zurück, Vorwärts)

Wenn man auf Play klickt, soll das erste Video abgespielt werden. Wenn man "vorwärts" anklickt jeweils das nächste (also wenn 1 läuft soll 2 gespielt weren, wenn 2 läuft 3, etc.) Bei Rückwärts soll alles umgekehrt laufen, sprich jeweils das vorherige.

Ich mache das momentan sehr umständlich folgendermaßen:

Frame 1:
PHP-Code:
_root.p_mc.videoDesign_mc._visible true;
_root.p_mc.videoDesignInfo_mc._visible false;
_root.p_mc.soundOnOff_mc._visible false;

var 
netConn:NetConnection = new NetConnection();
netConn.connect(null);
var 
netStreamSound:NetStream = new NetStream(netConn);
soundVideo_flv.attachVideo(netStreamSound);
netStreamSound.setBufferTime(5);
netStreamSound.pause(true);
_root.p_mc.sound_mc.soundPlay_btn.onRelease = function() {
    
trace("soundPlay_btn");
    
_root.p_mc.videoSound_mc._visible true;
    
_root.p_mc.videoSoundInfo_mc._visible true;
    
_root.p_mc.soundOnOff_mc._visible true;
    
_root.p_mc.videoSoundInfo_mc.gotoAndStop("1");
    
netStreamSound.seek(0);
    
netStreamSound.pause(false);
    
netStreamSound.play("FLV/Film1.flv");
};
_root.p_mc.sound_mc.soundNext_btn.onRelease = function() {
    
_root.p_mc.videoSoundInfo_mc.gotoAndStop("2");
    
trace("soundNext_btn");
    
gotoAndStop("2");
};
_root.p_mc.sound_mc.soundPrev_btn.onRelease = function() {
    
_root.p_mc.videoSoundInfo_mc.gotoAndStop("2");
    
trace("soundPrevy_btn");
    
gotoAndStop("2");
};
trace("f1");
stop(); 
Frame 2:
PHP-Code:
var netConn:NetConnection = new NetConnection();
netConn.connect(null);
var 
netStreamSound:NetStream = new NetStream(netConn);
soundVideo_flv.attachVideo(netStreamSound);
netStreamSound.setBufferTime(5);
netStreamSound.play("FLV/film2.flv");
_root.p_mc.sound_mc.soundPlay_btn.onRelease = function() {
    
trace("soundPlay_btn");
    
netStreamSound.seek(0);
    
netStreamSound.pause(false);
    
netStreamSound.play("FLV/film2.flv");
};
_root.p_mc.sound_mc.soundNext_btn.onRelease = function() {
    
_root.p_mc.videoSoundInfo_mc.gotoAndStop("1");
    
trace("soundNext_btn");
    
gotoAndStop("3");
};
_root.p_mc.sound_mc.soundPrev_btn.onRelease = function() {
    
_root.p_mc.videoSoundInfo_mc.gotoAndStop("1");
    
trace("soundPrev_btn");
    
gotoAndStop("3");
};
trace("f2");
stop(); 
Frame3:
PHP-Code:
var netConn:NetConnection = new NetConnection();
netConn.connect(null);
var 
netStreamSound:NetStream = new NetStream(netConn);
soundVideo_flv.attachVideo(netStreamSound);
netStreamSound.setBufferTime(5);
netStreamSound.play("FLV/film3.flv");
_root.p_mc.sound_mc.soundPlay_btn.onRelease = function() {
    
trace("soundPlay_btn");
    
netStreamSound.seek(0);
    
netStreamSound.pause(false);
    
netStreamSound.play("FLV/film3.flv");
};
_root.p_mc.sound_mc.soundNext_btn.onRelease = function() {
    
_root.p_mc.videoSoundInfo_mc.gotoAndStop("2");
    
trace("soundNext_btn");
    
gotoAndStop("2");
};
_root.p_mc.sound_mc.soundPrev_btn.onRelease = function() {
    
_root.p_mc.videoSoundInfo_mc.gotoAndStop("2");
    
trace("soundPrev_btn");
    
gotoAndStop("2");
};
trace("f3");
stop(); 
Wie vereinfache ich das am besten?

Vielen Dank im Voraus!
thomas_as ist offline   Mit Zitat antworten
Alt 15-04-2007, 15:16   #2 (permalink)
agedoubleju
Gast
 
Beiträge: n/a
Zitat:
Wie vereinfache ich das am besten?
Setz dir statt deiner Sprungbefehle und Framewechsel einfach eine Funktion in Frame 1, die dann über geeignete Parameter die Videos abspielt. Mal als Ansatz:
PHP-Code:
//...
counter 0;
meineVideos = new Array("Film1.flv","Film2.flv","Film3.flv");

soundNext_btn.onRelease = function(){
   
_level0.counter ++;
   if(
_level0.counter == _level0.meineVideos.length){//Ende der Liste erreicht
      
_level0.counter 0;//wieder von vorne...
   
}
   
_level0.videospielen("FLV/"+_level0.meineVideos[_level0.counter]);
}

soundPrev_btn.onRelease = function(){
   
_level0.counter --;
   if(
_level0.counter <0){//Anfang der Liste erreicht
      
_level0.counter 0;//wieder von vorne...
   
}
   
_level0.videospielen("FLV/"+_level0.meineVideos[_level0.counter]);
}
   
function 
videospielen(file){
   
//...
   
netStreamSound.seek(0);
   
netStreamSound.pause(false);
   
netStreamSound.play(file); 


Geändert von agedoubleju (15-04-2007 um 15:17 Uhr)
  Mit Zitat antworten
Alt 24-04-2007, 12:16   #3 (permalink)
Neuer User
 
Registriert seit: Dec 2005
Beiträge: 211
hallo, grüble nun schon ewig darüber nach deinen Ansatz zu erweitern, kenne mich aber leider noch zu wenig aus...

Das mit dem
PHP-Code:
file 
bekomm ich irgendwie nicht hin. Referenzen passen, Buttons passen, funktion lautet:
PHP-Code:
// Funktion StreamFiles
function videospielen(file) {
    var 
netConn:NetConnection = new NetConnection();
    
netConn.connect(null);
    var 
netStreamSound:NetStream = new NetStream(netConn);
    
soundVideo_flv.attachVideo(netStreamSound);
    
netStreamSound.setBufferTime(5);
    
//    netStream.pause(true);
    
netStreamSound.seek(0);
    
netStreamSound.pause(false);
    
netStreamSound.play(file); 
Nächstes Problem: Wie starte ich diese Endlosgeschichte? Am Anfang soll das erste Video noch nicht zu sehen sein, sprich: eigentlich brauche ich
PHP-Code:
netStreamSound.pause(false); 
(s.o.)

Irgendwann muss ich ja so etwas in der Art haben:

PHP-Code:
btn_play.onRelease = function() {
    
_level0.counter;
    if (
_level0.counter<0) {
        
//Anfang der Liste erreicht
        
_level0.counter 0;
        
//wieder von vorne...
    
}
    
_level0.videospielen("FLV/"+_level0.meineVideos[_level0.counter]);
};
netStreamSound.seek(0);
netStreamSound.pause(false);
netStreamSound.play(file); 
Bitte um Hilfe/Tipps. Finde im gesamten Web nichts zu einer dymanischen "Flv-Gallerie".
thomas_as 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 14:20 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele