Zurück   Flashforum > Flash > Flash Fortgeschritten > Flash 8

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 05-08-2009, 11:34   #1 (permalink)
<°)))><
 
Benutzerbild von Goldesel
 
Registriert seit: Apr 2008
Beiträge: 38
Papervision3D AS2 - Externes Bild als Textur

Guten Tag.

Ich brauche mal ein wenig Hilfe. Ich als Gelegenheitsflasher bin mit meinem Latein etwas am Ende. Und zwar experimentier ich gerade ein wenig mit Papervision3D in AS2 rum. Hab mit Hilfe einiger beigelegter Beispiele grundlegendes schon hinbekommen, unter anderem auch Texturen(Bitmaps & Movieclips) aus der Bibliothek zu laden. Momentan scheitere ich jedoch daran mithilfe eines MovieClipLoaders externe Bilder als Textur zu verwenden. Der Loader klappt wunderbar und läd die Bilder über ein Array das aus einer XML gefüttert wird auch problemlos, nur leider steh ich hier vor der Frage wie ich diese Bilder als Textur verwenden kann. Hier mein Code soweit:
PHP-Code:
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;
import gs.*;
import gs.easing.*;

stop();

// _______________________________________________________________________
// MovieClipLoader mclContent;

var mclContent:MovieClipLoader = new MovieClipLoader();

var 
oListener:Object = new Object();
oListener.onLoadStart = function(target_mc) {
    
//trace(target_mc+": Laden gestartet!");
};
oListener.onLoadProgress = function(target_mcloadedBytestotalBytes) {
    
//var iPercentageLoaded:Number = Math.round((loadedBytes/totalBytes)*100);
    //trace("Lade: "+iPercentageLoaded+"% von "+Math.round(totalBytes/1000)+"kb");
};

oListener.onLoadComplete = function(target_mc) {
    
//trace(target_mc+" fertig geladen (onLoadComplete)");
};

oListener.onLoadInit = function(target_mc) {
    
//trace(target_mc+" fertig geladen (onLoadInit)");
};

oListener.onLoadError = function(target_mcerrorCode) {
    
//trace(target_mc+" konnte nicht geladen werden: "+errorCode);
};
mclContent.addListener(oListener);
//mclContent.loadClip("start.swf",container_mc);

// XML mit Bilderpfaden wird eingelesen und in Array geladen
var x:XML = new XML();
x.ignoreWhite true;

var 
fotoArray:Array = new Array();

x.onLoad = function(success) {
    for (
i=0i<this.firstChild.childNodes.lengthi++) {
        
fotoArray.push(this.firstChild.childNodes[i].attributes.url);
        
//trace(fotoArray);
    
}
    
Main();
};

x.load("bilder.xml");

// _______________________________________________________________________

//                                                                  vars3D
var container:MovieClip;
var 
scene:MovieScene3D;
var 
camera:Camera3D;

// _______________________________________________________________________

//                                                                    Main
function Main() {

    
init3D();
    
this.onEnterFrame loop3D;

}
//Main();
// _______________________________________________________________________

//                                                                  Init3D
function init3D() {

    
// Create container movieclip and center it
    
container this.createEmptyMovieClip("container"this.getNextHighestDepth());
    
container._x Stage.width/2;
    
container._y Stage.height/2;

    
// Create MovieScene for hotspot mode
    // This scene renders each object in a separate movie clip, so you can add events to them easily.
    // This movie clip is called container.

    
scene = new MovieScene3D(container);

    
// Create camera
    
camera = new Camera3D();

    
// Create material
    //var material:BitmapAssetMaterial = new BitmapAssetMaterial("meinBild");
    //material.oneSide = false;// Make it double sided


    //###########################################################################
    //
    //    Problempart Start
    //
    //###########################################################################

    //m = this.createEmptyMovieClip("t10", this.getNextHighestDepth());
    
var meinMovie:MovieClip = new MovieClip();

    
mclContent.loadClip(fotoArray[0],meinMovie);

    var 
movieAssetMaterial:MovieAssetMaterial;

    
//MovieAssetMaterial, doubleSided draws the color on both sides of the geometry normals
    //movieAssetMaterial = new MovieAssetMaterial(Linkage ID, Transparent);
    
movieAssetMaterial = new MovieAssetMaterial("meinBild"false);
    
//movieAssetMaterial.animated = true;
    
movieAssetMaterial.oneSide false;

    
//###########################################################################
    //
    //    Problempart Ende
    //
    //###########################################################################
    
    // Create Planes x50
    
var radius:Number 360;

    for (var 
i:Number 0i<1i++) {
        var 
plane:Plane = new Plane(movieAssetMaterial1);

        
// Randomize position
        //plane.x = Math.random() * radius - radius/2;
        //plane.y = Math.random() * radius - radius/2;
        //plane.z = Math.random() * radius - radius/2;

        // Randomize rotation
        //plane.rotationX = Math.random() * 360;
        //plane.rotationY = Math.random() * 360;
        //plane.rotationZ = Math.random() * 360;

        // Randomize position
        
plane.0;
        
plane.0;
        
plane.0;

        
// Randomize rotation
        
plane.rotationX 0;
        
plane.rotationY 0;
        
plane.rotationZ 0;

        
// Include in scene
        
scene.push(plane);

        var 
container:MovieClip plane.container;
        
container._alpha 100;
        
container.onRollOver = function() {
            
//this._alpha = 100;
            //this.displayObject3D.scaleX = this.displayObject3D.scaleY = 1.5;
        
};

        
container.onRollOut container.onReleaseOutside=function () {
            
//this._alpha = 50;
            //this.displayObject3D.scaleX = this.displayObject3D.scaleY = 1;
        
};
        
container.onPress = function() {
            
//plane.rotationY += 20;
            
TweenLite.to(plane,6,{rotationY:plane.rotationY+360ease:Elastic.easeOutoverwrite:1});
            
//this.displayObject3D.visible = false; 
        
};
    }
}



// _______________________________________________________________________

//                                                                    Loop

function loop3D() {
    
// Some easing for the camera
    //camera.x -= (camera.x+container._xmouse)/8;
    //camera.y -= (camera.y+container._ymouse)/8;

    // Render
    
scene.renderCamera(camera);

Habe die Problemstelle per Kommentar mal markiert. Was da steht sind die Ruinen meiner Ansätze, also nicht unbedingt daran aufhängen. Vielen Dank im Voraus.

Gruß, Goldesel
Goldesel 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 19:21 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele