I am trying to create a fluid layout for my image slideshow. When I use AS3 the result is much better than AS2…images look more proportionate when instead with AS2 they look enlarged, as you would zoom in the slideshow.
I dont know AS3, followed a tutorial for the fluid layout. I have to use AS2 the rest of my website too.Can someone help me to figure why is AS2 causing the distortion in the images?
Here is the AS3 code I am using, “frame” is the name of the slideshow movieclip
var myStage:Stage = this.stage;
myStage.scaleMode = StageScaleMode.NO_SCALE;
myStage.align = StageAlign.TOP_LEFT;
function initialDisplay(event:Event):void {
var swfWidth:int = myStage.stageWidth;
var swfHeight:int = myStage.stageHeight;
var footerYPos:Number = swfHeight - footer.height;
var frameYPos:Number = swfHeight - frame.height;
var frameXPos:Number = swfWidth - frame.width;
frame.width = swfWidth;
frame.height = swfHeight;
frame.y = frameYPos / 2;
frame.x = frameXPos / 2;
menuBarBG.width = swfWidth;
footer.width = swfWidth;
footer.y = footerYPos;
}
addEventListener(Event.ENTER_FRAME, initialDisplay);
Following is the AS2 code instead…in this case I have a main movieclip named “mcStage” and inside I have my slideshow movie clip named “mcBackground”. Is it possible to obtain the same fluid layout of AS3 using AS2?
// 1: import the Delegate class to deal with event function scope
import mx.utils.Delegate;
// 2: set the Stage class params
Stage.scaleMode = "noScale";
Stage.align = "C"; // to centre the stage
// 3: Assign the dimensions of the document
// to the Movie object (same as FLA):
var Movie:Object = new Object();
Movie.width = 1100;
Movie.height = 556;
// 4: create function to position your MC at the top-left of the stage
function positionStageMC():Void {
/* note: because we are using Delegate, the scope of this function
is mcStage, and not "slistener"
*/
// position mcStage (this)
this._x = (Movie.width/2)-(Stage.width/2);
this._y = (Movie.height/2)-(Stage.height/2);
/* size mcStage
this._width = Stage.width;
this._height = Stage.height;*/
// position & size background
this.mcBackground._width = Stage.width - mcBackground.width;
this.mcBackground._height = Stage.height - mcBackground.height;
// position layout objects
// top-left (no need to move it)
//mcShape_TL._x = 0;
//mcShape_TL._y = 0;
// top-right
//mcShape_TR._x = Stage.width;
//mcShape_TR._y = 0;
// bottom-left
//mcShape_BL._x = 0;
//mcShape_BL._y = Stage.height;
// bottom-right
//mcShape_BR._x = Stage.width;
//mcShape_BR._y = Stage.height;
// centre
//mcCenter._x = Stage.width/2;
//mcCenter._y = Stage.height/2;
}
// 5: initialize mcStage position
positionStageMC();
// 6: create an onResize event which calls positionStageMC()
// when the stage is resized.
var slistener:Object = new Object();
slistener.onResize = Delegate.create(this, positionStageMC);
Stage.addListener(slistener);
Did not know if to post in AS3 or AS2…sorry if I misplaced the post…