PDA

View Full Version : Help Please - Images Are Going Crazy



tomyknoker
04-02-2007, 12:54 AM
I have been working on this file for ages, I use this code


// Includes the tweening extensions.
#include "mc_tween2.as"

import mx.transitions.Tween;
import mx.transitions.easing.*;
fscommand("fullscreen", true);
Stage.scaleMode = "noScale";
Stage.align = "TL";

var stageL:Object = new Object();
stageL.onResize = function() {
new Tween(btns, "_x", Back.easeOut, btns._x, Stage.width/2-btns._width/2, 1, true);
new Tween(btns, "_y", Back.easeOut, btns._y, Stage.height-btns._height-30, 1, true);
};

Stage.addListener(stageL);
stageL.onResize()

var myClip = this.createEmptyMovieClip("mcl", this.getNextHighestDepth());
var myLoader = new MovieClipLoader();
var myListener = new Object();
var myTest = random(6) + ".jpg"; // Load 1 of 6 random images

/*Stage.align = "TL"; // Position the movie at top, center
Stage.scaleMode = "noScale"; // Prevent scaling (required!)

myListener.onResize = function (e:Object):Void {
var sw:Number = Stage.width;
var sh:Number = Stage.height;
mcl._width = sw;
mcl._height = sh;
trace("New width: " + Stage.width);
trace("New height: " + Stage.height);
};*/

myListener.onLoadInit = function (mcl) { // Create fade in function
trace("load init");
mcl._alpha=0; // Make mc 'mcl' _alpha 0
mcl.onEnterFrame=function(){ // Create new function
mcl._alpha +=15; // Speed 15

if(mcl._alpha >=100){
delete mcl.onEnterFrame;
}
}
};

Stage.addListener(myListener);
myLoader.addListener(myListener);
myLoader.loadClip(myTest,myClip);

This loads 1 of 6 random images, Inside ANOTHER movie clip called (first) on my stage I have this code



var myTest = "images/manly/manly" + 1 + ".jpg";
_root.myLoader.loadClip(myTest,_root.myClip);


It forces an image to load works perfectly up until now! I dupliacted 'first' and called it second... Dragged it onto the stage but when it loads the images they come into the file at 300% larger than they are meant to be... I'm at my wits end if anyone can offer advice I would be very appreciative!

BLiZZaRD
04-13-2007, 03:21 PM
In your first code you have "math" to get stage width and height with all the fullscreens and adjustments. This is done first, then sent to the MC. With the duplication of (first) you are doing it twice.

Either rewrite your first code to include _parent. or _root. so the math functions stay the same, or rewrite one for second instead of using first's twice :)