Zurück   Flashforum > Flash > Flash Fortgeschritten > Flash MX

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 05-07-2008, 10:41   #1 (permalink)
Banned
 
Benutzerbild von ingo@247
 
Registriert seit: Jul 2004
Ort: Hamburg-東京-Dubai
Beiträge: 374
funktion auf menu/buttons duplizieren

merkt man, das ich am wochenende allein arbeite?

ok, folgendes:

ich habe ein menu bestehend aus 8 buttons (link1_btn -link8_btn)
dazu 9 externe swf dateien ( content_0.swf - content_8.swf) die in einen container (container_mc) geladen werden.

im ersten frame auf der HZL hole ich mir die erste externe swf:

PHP-Code:
container_mc.loadMovie("content_0.swf"); 
die restlichen werden über folgendes script des menus geladen:

PHP-Code:
// global array variable containing all content movie clips
_global.contentClips = ["content_0.swf""content_1.swf""content_2.swf""content_3.swf""content_4.swf""content_5.swf""content_6.swf""content_7.swf""content_8.swf"];
// global variable containing the name of the next movie clip to be loaded
_global.nextClip "";
// global function for loading content movie clip
_global.loadContentClip = function() {
    
_root.container_mc.loadMovie(nextClip);    
}
// button events
// button 1
n1.link1_btn.onRelease = function() {
    
nextClip contentClips[1];
    
_root.container_mc.gotoAndPlay("unload");
};
// button 2
n2.link2_btn.onRelease = function() {
    
nextClip contentClips[2];
    
_root.container_mc.gotoAndPlay("unload");
};
// button 3
n3.link3_btn.onRelease = function() {
    
nextClip contentClips[3];
    
_root.container_mc.gotoAndPlay("unload");
};
// button 4
n4.link4_btn.onRelease = function() {
    
nextClip contentClips[4];
    
_root.container_mc.gotoAndPlay("unload");
};
// button 5
n5.link5_btn.onRelease = function() {
    
nextClip contentClips[5];
    
_root.container_mc.gotoAndPlay("unload");
};
// button 6
n6.link6_btn.onRelease = function() {
    
nextClip contentClips[6];
    
_root.container_mc.gotoAndPlay("unload");
};
// button 7
n7.link7_btn.onRelease = function() {
    
nextClip contentClips[7];
    
_root.container_mc.gotoAndPlay("unload");
};
// button 8
n8.link8_btn.onRelease = function() {
    
nextClip contentClips[8];
    
_root.container_mc.gotoAndPlay("unload");
};
stop(); 
jetzt möchte ich aber noch zusätzlich weitere 9 externe swf dateien (inhalt_0.swf - inhalt_8.swf) über das gleiche script ansteueren. also habe ich einen weiteren container erstellt und den befehl in der HZL erweitert:

PHP-Code:
container_mc.loadMovie("content_0.swf");
container_mc2.loadMovie("inhalt_0.swf"); 
ergo sollen bei klick auf einen button jeweils 2 externe swf geladen/entladen werden. wenn ich jetzt das obere script einfach nur dupliziere und die entsprecehnden bezeichnungen (content_0.swf = inhalt_0.swf / container_mc = container_mc2 ) funktioniert das leider nicht.

hier die seite um die es geht: http://www.24-7media.de/mileycyrus/
hier werden momentan nur die cont_x.swfs geladen, die jeweils das bild der sängerin links, sowie die inhaltsboxen enthalten. und genau das möchte ich trennen. also die content_x.swf lädt/entlädt die bilder der sängerin und die inhalt_x.swf lädt/entlädt die contentboxen

hat da jemand eine lösung parat? (falls man mein geschreibsel überhaupt verstanden hat)
ingo@247 ist offline   Mit Zitat antworten
Alt 05-07-2008, 10:57   #2 (permalink)
undefined
 
Benutzerbild von mildesign
 
Registriert seit: Jul 2001
Ort: Stuttgart
Beiträge: 1.839
wäre da ein 2dimensionales Array nicht sinnvoller. alla
PHP-Code:
_global.contentClips = [["content_0.swf""inhalt_0.swf"],
                                [
"content_1.swf""inhalt_1.swf],
... 
somit steht dann in nextClip auch immer ein Array mir den entsprechenden Swf Dateien und nicht nur ein Eintrag.

Wo wird eigentlich "_global.loadContentClip" aufgerufen? Am Ende der unload Animation?

Hoffe ich hab das Problem richtig interpretiert. Nach ner Fla zu fragen macht ja keinen Sinn ;o)
__________________
mfg Frank
mildesign ist offline   Mit Zitat antworten
Alt 05-07-2008, 11:20   #3 (permalink)
Banned
 
Benutzerbild von ingo@247
 
Registriert seit: Jul 2004
Ort: Hamburg-東京-Dubai
Beiträge: 374
hab's (hoffe ich mal)

PHP-Code:
// global array variable containing all content movie clips
_global.contentClips = ["content_0.swf""content_1.swf""content_2.swf""content_3.swf""content_4.swf""content_5.swf""content_6.swf""content_7.swf""content_8.swf"];
_global.contentClips2 = ["inhalt_0.swf""inhalt_1.swf""inhalt_2.swf""inhalt_3.swf""inhalt_4.swf""inhalt_5.swf""inhalt_6.swf""inhalt_7.swf""inhalt_8.swf"];
// global variable containing the name of the next movie clip to be loaded
_global.nextClip "";
_global.nextClip2 "";
// global function for loading content movie clip
_global.loadContentClip = function() {
    
_root.container_mc.loadMovie(nextClip);    
    
_root.container_mc2.loadMovie(nextClip2);
}
// button events
// button 1
n1.link1_btn.onRelease = function() {
    
nextClip contentClips[1];
    
nextClip2 contentClips2[1];
    
_root.container_mc.gotoAndPlay("unload");
    
_root.container_mc2.gotoAndPlay("unload");
};
// button 2
n2.link2_btn.onRelease = function() {
    
nextClip contentClips[2];
    
nextClip2 contentClips2[2];
    
_root.container_mc.gotoAndPlay("unload");
    
_root.container_mc2.gotoAndPlay("unload");
};
// button 3
n3.link3_btn.onRelease = function() {
    
nextClip contentClips[3];
    
nextClip2 contentClips2[3];
    
_root.container_mc.gotoAndPlay("unload");
    
_root.container_mc2.gotoAndPlay("unload");
};
// button 4
n4.link4_btn.onRelease = function() {
    
nextClip contentClips[4];
    
nextClip2 contentClips2[4];
    
_root.container_mc.gotoAndPlay("unload");
    
_root.container_mc2.gotoAndPlay("unload");
};
// button 5
n5.link5_btn.onRelease = function() {
    
nextClip contentClips[5];
    
nextClip2 contentClips2[5];
    
_root.container_mc.gotoAndPlay("unload");
    
_root.container_mc2.gotoAndPlay("unload");
};
// button 6
n6.link6_btn.onRelease = function() {
    
nextClip contentClips[6];
    
nextClip2 contentClips2[6];
    
_root.container_mc.gotoAndPlay("unload");
    
_root.container_mc2.gotoAndPlay("unload");
};
// button 7
n7.link7_btn.onRelease = function() {
    
nextClip contentClips[7];
    
nextClip2 contentClips2[7];
    
_root.container_mc.gotoAndPlay("unload");
    
_root.container_mc2.gotoAndPlay("unload");
};
// button 8
n8.link8_btn.onRelease = function() {
    
nextClip contentClips[8];
    
nextClip2 contentClips2[8];
    
_root.container_mc.gotoAndPlay("unload");
    
_root.container_mc2.gotoAndPlay("unload");
};
stop(); 
kann man bestimmt auch schöner machen....aber für mich alten tweener hat es gereicht
ingo@247 ist offline   Mit Zitat antworten
Alt 05-07-2008, 11:42   #4 (permalink)
undefined
 
Benutzerbild von mildesign
 
Registriert seit: Jul 2001
Ort: Stuttgart
Beiträge: 1.839
hier mal ausgerabeitet. Ich versuch mich gerade vom Lernen abzulenken ;o)
PHP-Code:
// global array variable containing all content movie clips 
_global.contentClips = [["content_0.swf""inhalt_0.swf"],
                        [
"content_1.swf""inhalt_1.swf"],
                        [
"content_2.swf""inhalt_2.swf"],
                        [
"content_3.swf""inhalt_3.swf"],
                        [
"content_4.swf""inhalt_4.swf"],
                        [
"content_5.swf""inhalt_5.swf"],
                        [
"content_6.swf""inhalt_6.swf"], 
                        [
"content_7.swf""inhalt_7.swf"], 
                         [
"content_8.swf""inhalt_8.swf"]
                        ]; 

_global.nextClip = []; 

// global function for loading content movie clip 
_global.loadContentClip = function() { 
    
_root.container_mc.loadMovie(nextClip[0]);     
    
_root.container_mc2.loadMovie(nextClip[1]); 


// number of Buttons
var numOfBtns:Number 8;

initButtons();

// button events 

function initButtons(){
    
    for (var 
i:Number=1;i<=numOfBtnsi++){
        var 
tempMc:MovieClip this["n"+i]["link"+i+"_btn"];
        
tempMc.id=i-1;
        
tempMc.onRelease = function() { 
            
nextClip contentClips[this.id]; 
            
_root.container_mc.gotoAndPlay("unload"); 
            
_root.container_mc2.gotoAndPlay("unload"); 
        }; 
    
    }
    
}

stop(); 
EDIT: oh etwas zu spät ;o)
__________________
mfg Frank

Geändert von mildesign (05-07-2008 um 11:49 Uhr)
mildesign ist offline   Mit Zitat antworten
Alt 05-07-2008, 13:25   #5 (permalink)
muh
 
Benutzerbild von Janoscharlipp
 
Registriert seit: Apr 2002
Ort: Freiburg / Stuttgart
Beiträge: 4.338
Ingo, bist du dir sicher, dass du dir nicht mal gaaanz bissel OOP angucken willst? Das spart Arbeit, macht Spaß, und sieht eleganter aus
__________________
»Carpe diem«, sagte der Graf. (Terry Pratchett: Ruhig Blut!)
Janoscharlipp ist offline   Mit Zitat antworten
Alt 05-07-2008, 18:06   #6 (permalink)
Banned
 
Benutzerbild von ingo@247
 
Registriert seit: Jul 2004
Ort: Hamburg-東京-Dubai
Beiträge: 374
Zitat:
Zitat von Janoscharlipp Beitrag anzeigen
Ingo, bist du dir sicher, dass du dir nicht mal gaaanz bissel OOP angucken willst? Das spart Arbeit, macht Spaß, und sieht eleganter aus

alda, ich sach disch..was ich seit flash 5 nicht kapiert hab, lohnt sich heute auch nicht mehr

nee, laß mal....ich krück mich so durch die projekte, und solange die funktionalität am ende die gleiche ist, kann mir der spaghetti code egal sein
ingo@247 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 02:13 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele