Thanks Jason!

It turns out that when I use loadMovieNum on the target Movie Clip, it embeds without a problem - but this function is really a 500 pound gorilla IMO. Everything on the stage gets deleted, and I'm back to the same blank screen that I would have had if I didn't even use a preloader to begin with! No listeners can be attached, even if the objects that displayed their return values (like dynamic text) could sit on the stage without being wiped out. Then again, when I stick with loadMovie, I can position the clip and add listeners, but once again, the button functionality is lost.

I still have this thing live with a grey screen...

Every tutorial I try to dig up has me putting frames in front of the content of the target movie clip, so using that approach just isn't working. Per my last email, the image distortion is unbelievable (and as yet unexplained) whenever I move the coordinating code off of the first frame. For the bold, here it is. It all sits in one blank frame essentially coordinating library contents.

// create a scene movieclip to contain all 3D elements
// and center it on the screen.
this.createEmptyMovieClip("theScene", 0);
theScene._x = 400;
theScene._y = 300;
theScene.depth = 0; // variable to control depth placement

// define s function to set the target of the cameraView
// when you select the star (onPress)
selectStar = function(){
        cameraView.target.x = this.x;
        cameraView.target.y = this.y;
        cameraView.target.z = this.z;
}

//Specifies camera positions for the menu interface
selectFacesOne = function(){
        cameraView.target.x = _level0.theScene.box1.x;
        cameraView.target.y = _level0.theScene.box1.y;
        cameraView.target.z = _level0.theScene.box1.z;
        _level0.theScene.box1.gotoAndPlay(2);
}
selectFacesTwo = function(){
        cameraView.target.x = _level0.theScene.box2.x;
        cameraView.target.y = _level0.theScene.box2.y;
        cameraView.target.z = _level0.theScene.box2.z;
        _level0.theScene.box2.gotoAndPlay(2);
}
selectAbout = function(){
        cameraView.target.x = _level0.theScene.box3.x;
        cameraView.target.y = _level0.theScene.box3.y;
        cameraView.target.z = _level0.theScene.box3.z;
        _level0.theScene.box3.gotoAndPlay(2);
}
selectContact = function(){
        cameraView.target.x = _level0.theScene.box4.x;
        cameraView.target.y = _level0.theScene.box4.y;
        cameraView.target.z = _level0.theScene.box4.z;
        _level0.theScene.box4.gotoAndPlay(2);
}


// this is the function for displaying the star onscreen
//old displayStar
displayStar = function(cameraView, focalLength){
        var x = this.x - cameraView.x;
        var y = this.y - cameraView.y;
        var z = this.z - cameraView.z;
        if (z < 0){
                this.z += 5000;
                this.x = 1000 - Math.random()*1000;
                this.y = 1000 - Math.random()*1000;
                x = this.x - cameraView.x;
                y = this.y - cameraView.y;
                z = this.z - cameraView.z;
        }
        var scaleRatio = focalLength/(focalLength + z);
        this._x = x * scaleRatio;
        this._y = y * scaleRatio;
        this._xscale = this._yscale = 100 * scaleRatio;
        this.swapDepths(Math.round(-z));
};

// define array to hold the objects in the scene
objectsInScene = new Array();

// loop through and create 20 stars randomly in the scene
for (i=1; i<=15; i++){
        var j = i;
        if (j > 4){
                j = j - 4
                if (j > 4){
                        j = j - 4
                }       
                        if (j > 4){
                                j = j - 4
                        }       
                                if (j > 4){
                                        j = j - 4
                                }       
        }       
        attachedObj = theScene.attachMovie("box"+j, "box"+i, theScene.depth++);
        attachedObj.x = 1000 - Math.random()*2000;
        attachedObj.y = 1000 - Math.random()*2000;
        attachedObj.z = i*400;
//      attachedObj.onPress = selectStar;
        attachedObj.display = displayStar;
        objectsInScene.push(attachedObj);
}


for (k=1; k<=4; k++){
attachedButton = theScene.attachMovie("wtf"+k, "wtf"+k, theScene.depth++);
        attachedButton._x = -330;
        attachedButton._y = (30*k);
//      attachedButton.onPress = selectStar;
//      attachedButton.display = displayStar;
}

//Specifies generated instances of the buttons and the specific
//camera targets for it.

_root.theScene.wtf1.onPress = selectFacesOne;
_root.theScene.wtf2.onPress = selectFacesTwo;
_root.theScene.wtf3.onPress = selectAbout;
_root.theScene.wtf4.onPress = selectContact;

        
// now make a camera object to serve as the users view or camera
// position within the cockpit of the car
cameraView = new Object();
cameraView.x = 0;
cameraView.y = 0;
cameraView.z = 0;
// set a target object in the cameraView to represent the positions
// the camera is easing to in its movement
cameraView.target = new Object();
cameraView.target.x = 0;
cameraView.target.y = 0;
cameraView.target.z = 0;

// define focal length
focalLength = 400;

// function controlling the camera ease and all displaying
// for objects in the objectsInScene array
easeToTarget = function(){
        // ease each camera point to its target point
        cameraView.x += (cameraView.target.x - cameraView.x)/5;
        cameraView.y += (cameraView.target.y - cameraView.y)/5;
        cameraView.z += (cameraView.target.z - cameraView.z)/5;
        
        // run the display function for each object in objectsInScene array
        for (var i=0; i<objectsInScene.length; i++){
                objectsInScene[i].display(cameraView, focalLength);
        }
        
        
};

theScene.onEnterFrame = easeToTarget;

--------------------

Message: 4
Date: Wed, 07 Jun 2006 14:46:52 -0400
From: "Merrill, Jason" <[EMAIL PROTECTED]>
Subject: RE: [Flashcoders] Dynamically loading an SWF into a movie
        clip
To: Flashcoders mailing list <[email protected]>


Yes - Flash 8 only. You can't do it with attachMovie unless it's inside
a MovieClip symbol as far as I know.  In Flash 8, you can do this:

import flash.display.BitmapData;

var myGraphic:String = "MyGraphicLinkageID";
var myBitmapData:BitmapData = BitmapData.loadBitmap(myGraphic);
var mc:MovieClip = this.createEmptyMovieClip("myImage",
this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());

Jason Merrill
Bank of America
Learning Technology Solutions

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to