Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 27-06-2008, 12:00   #1 (permalink)
Neuer User
 
Registriert seit: Jun 2008
Beiträge: 3
Thumbs up "beginFill" durch .jpg ersetzen

Hallo zusammen!

Ich habe auf dreamincode.net dieses großartige Skript für ein dynamisches Memory gefunden. Das Skript erstellt anhand der Bühnengröße und der gewünschten Größe der Karten eine maximal mögliche Anzahl an Memorykarten und lädt entsprechend viele .JPGs als Motive für die Kartenrückseiten. Das klappt soweit wunderbar, allerdings bekomme ich es nicht hin, an der Stelle, wo per beginFill die Farbe der Kartenrücken definiert wird per loadMovie alternativ ein universelles JPG (z.B. background.jpg) zu laden, so dass die Kartenrücken z.B. ein gleiches Muster haben. Ich sehe plötzlich nurnoch das Spiel mit dem JPG-Kartenrücken, kann aber die Karten nicht mehr anklicken... Irgendwas mache ich falsch, es muss doch theoretisch total simpel sein...
Wo würdet ihr das loadMovie mit verweis auf ein background.jpg, in welcher Ebene und in welchen (neuen?) Clip platzieren?

Anbei mal das komplette Skript und die FLA bzw. was wichtiger ist, da die FLA nur aus diesem Skript besteht, die Grafiken im Anhang...

Danke schonmal für jeden Hinweis!

PHP-Code:
// Gamefield settings

// EDIT HERE
card_w 70;
card_h 90;
card_wdistance 10;
card_hdistance 10;

// STOP EDIT
card_dw card_w card_wdistance;
card_dh card_h card_hdistance;
row_card Math.floor((Stage.width card_wdistance) / card_dw);
col_card Math.floor((Stage.height card_hdistance) / card_dh);
n_card col_card row_card == col_card row_card : (col_card 1) * row_card;
imgs_n n_card 2;



// CENTER THE IMAGE IN THE CARD
centerImage = function(target){
    
target.front._visible false
    target
.front.container._x -= target.front.container._width 2
    target
.front.container._y -= target.front.container._height 2
}
// ---------------------------------------------
  
empty = new Array();
function 
createCard(nwh) {
    empty.
push(n);
    
this.createEmptyMovieClip('card' nn);
    
with (this['card' n]) {
        
lineStyle(00xFF00FF100);
        
// An dieser Stelle müsste statt des Fills das JPG integriert werden...
        
beginFill(0x00FF3360);
        
moveTo(20);
        
lineTo(22);
        
lineTo(-22);
        
lineTo(-2, -2);
        
lineTo(2, -2);
        
lineTo(20);
        
endFill();
        
createEmptyMovieClip('front'1);
        
front.createEmptyMovieClip('container'2);
        
front.createEmptyMovieClip('backgr'1);
        
with (front.backgr) {
            
moveTo(-2, -2);
            
lineStyle(00x0000000);
            
beginFill(0xFFFF00100);
            
lineTo(2, -2);
            
lineTo(22);
            
lineTo(-22);
            
lineTo(-2, -2);
            
endFill();
        }
        
front.onEnterFrame = function() {
            
tot this.container.getBytesTotal();
            
car this.container.getBytesLoaded();
            if (
tot == car && tot 200) {
                
this._parent._parent.centerImage(this._parent);
                
delete this.onEnterFrame;
            }
        };
    }
}
selcards = [];
function 
placeImages() {
    
act_img 0;
    for (
img 0img imgs_nimg++) {
        for (
02k++) {
            
act Math.round(Math.random() * (empty.length 1));
            
this['card' + empty[act]].img_id act_img;
            
this['card' + empty[act]].front.container.loadMovie("imgs/img" act_img ".jpg");
            
this['card' + empty[act]].onRelease = function() {
                
this.rotateCard(00);
                
this.enabled false;
                
MovieClip.prototype.enabled false;
            };
            empty.
splice(act1);
        }
        
act_img++;
    }
}
MovieClip.prototype.rotateCard = function(vi) {
    
this.operazione == ? +0.1 : -0.1;
    
this.incremento == 100 10;
    
selcards.push(this._name);
    
this.onEnterFrame = function() {
        
this.incremento += this.operazione;
        
this._xscale = (100 Math.sin(this.incremento));
        if (
this._xscale 0) {
            
this.front._visible == false true;
        }
        if (
this._xscale >= 99) {
            
delete this.onEnterFrame;
            
selcards.length MovieClip.prototype.enabled true null;
            
== && selcards.length checkCards() : null;
        }
    };
};
function 
generateGameField(cardsdistancehdistance) {
    
Ypos card_h hdistance;
    
Xpos card_w distance;
    for (
0cardsc++) {
        
createCard(ccard_wcard_h);
        if (
row_card == && 0) {
            
Ypos += this['card' c]._height hdistance;
            
Xpos card_w distance;
        }
        
this['card' c]._x Xpos;
        
this['card' c]._y Ypos;
        
Xpos += this['card' c]._width distance;
    }
    
placeImages();
}
generateGameField(n_cardcard_wdistancecard_hdistance);

score 0;
this.createTextField('punti', -150038000);
punti.autoSize true;
punti.text 0;
function 
checkCards() {
    if (
this[selcards[0]].img_id == this[selcards[1]].img_id) {
        
score++;
        
punti.text score;
        eval(
selcards[0])._visible = eval(selcards[1])._visible false;
    } else {
        eval(
selcards[0]).rotateCard(11);
        eval(
selcards[1]).rotateCard(11);
        eval(
selcards[0]).enabled = eval(selcards[1]).enabled true;
    }
    
selcards = [];
    
MovieClip.prototype.enabled true;

Angehängte Dateien
Dateityp: zip memory.zip (24,9 KB, 3x aufgerufen)
Tobias1984 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 17:21 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele