We have a main.fla - much of the content positioning part does nothing yet :
import mx.transitions.Tween;
import mx.transitions.easing.*;
stop();
// loader
var myMCL:MovieClipLoader = new MovieClipLoader();
/// tween all loads
var myListener:Object = new Object();
myMCL.addListener(myListener);
myListener.onLoadInit = function(target:MovieClip):Void {
tweenImage(target);
};
function tweenImage(target:MovieClip):Void {
var myTween:Tween = new Tween(target, "_alpha", mx.transitions.easing.Regular.easeIn, 0, 100, 0.5, true);
//execute when tween complete
myTween.onMotionFinished = function():Void {
};
}
// unless we specifically don't want tweens
var noTweenMCL:MovieClipLoader = new MovieClipLoader();
/* dynamically position content - based on a tutorial from Justin Windle (http://blog.soulwire.co.uk/tag/flash) */
// Setup the Stage properties
Stage.scaleMode = "noScale";
Stage.align = "TL";
// Variables (in pixels)
var navHeight:Number = 435;
var navWidth:Number = 222;
var contactHeight:Number = 0;
var contactWidth:Number = 0;
var descHeight:Number = 117;
var descWidth:Number = 222;
// Variables (in percent)
var headHeight:Number = 11;
var galHeight:Number = 60;
var thumbsHeight:Number = 6;
// Prototype function to position MovieClips
MovieClip.prototype.pos = function (r, s, w, h)
{
this._x = r;
this._y = s;
this._width = w;
this._height = h;
};
// positioning function
function setStage ()
{
var sw:Number = Stage.width;
var sh:Number = Stage.height;
// Calculate dynamic dimensions
var Ny:Number = sh / 100 * headHeight;
var Dy:Number = Ny + navHeight;
var Gw:Number = sw - navWidth - contactWidth;
var Gh:Number = sh / 100 * galHeight;
var Cx:Number = navWidth + Gw;
var Ty:Number = 0.8 * sh;
var Th:Number = sh / 100 * thumbsHeight;
var Hh:Number = sh / 100 * headHeight;
//apply sizes & positions
nav_mc.pos (0, Hh, navWidth, navHeight);
gal_mc.pos (navWidth, Hh, Gw, Gh);
contact_mc.pos (Cx, Hh, contactWidth, contactHeight);
desc_mc.pos (0, Dy, descWidth, descHeight);
thumbs_mc.pos (navWidth, Ty, Gw, Th);
}
// text "frames" do not resize and image "frames" should fill up all remaining browser space
var stageListener:Object = new Object ();
Stage.addListener (stageListener);
stageListener.onResize = setStage;
setStage ();
//load navigation menu and make clips for the other sections to come
_root.createEmptyMovieClip("nav_mc",1);
myMCL.loadClip("nav.swf","nav_mc");
_root.createEmptyMovieClip("thumbs_mc",2);
_root.createEmptyMovieClip("gal_mc",3);
_root.createEmptyMovieClip("contact_mc",4);
_root.createEmptyMovieClip("desc_mc",5);
ok, then we have nav.fla that only contains one (for now) menu button (named button1_btn) on the stage, and the following code on the timeline:
this.button1_btn.onPress = function() {
_level0.myMCL.loadClip("button1thumbs.swf","thumbs_mc");
_level0.setStage();
};
button1thumbs.fla doesn’t have any actions in it (yet) as i cannot get it to load in the space defined by “thumbs_mc”.
For the life of me I just can’t figure out a syntax to make button1thumbs.swf load into that movie clip, and I’ve tried all I can think of, but it’s probably something dumb on my part. Any suggestions?