I’m considering a way to make tabs. I’m thinking tabs will be 100 pixels wide so I thought it would be something of the sort
var nextDepth:Number = getNextHighestDepth();
btnMinimize.onRelease = function(){
createEmptyMovieClip("container+nextDepth", this.getNextHighestDepth());
container+nextDepth._x = nextDepth+00, _y=0;
loadMovie("square.swf", "container+nextDepth");
}
I expected depth to be 0 and container0 to load at _x =0, _y=0 then of course container1 (the second tab) would go to _x=100, _y=0 but man oh man was this so not the case.
so I opened a new wtf.fla and did a bit of script shuffling to run these two traces
trace(container1.getDepth());
trace (container1._x)
And what I found was a depth of 1048577 ack @.@ ?wtf?
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/2/help.html?content=00000248.html lead me to believe the trace would give 0.
so I had to say
container1._x = nextDepth-1048543; //To put it at _x=35 as a test with success.
I’m hardly an intermediate scripter and this is a bit abstruse for me but if I don’t stretch my wings I will never fly. I’ll throw myself to the wolves, I don’t care. I love a good challenge.
This has raised many questions on how I am going to use this to place my tabs but my three primary questions are:
- Can some one explain this massive depth number to me or am I just doing it wrong?
- Is this massive depth number going to cause reliability problems with what I want to do?
- Am I out of line in my thinking this is going to do as I wish?
Oh and just for ****s and giggles. At 100 pixels each I can only house 15 tabs (1600 width stage) so what do I do after 15 tabs? Figured I’d cross that road later but if you got a clue I’d love to hear it.
Thanks for your attention.
P.S. if this is a dual post plz forgive me. I waited 30 minutes, logged on and off and cleared my browser cache but my initial post never showed up.
Here is my work in progress test script to give me/you an idea of how this will work out for me before I implement it into my primary.fla
It does have a ways to go yet to be tabs but I think the basic idea is present.
//to keep track whether the swf has been loaded or not
var loaded:Boolean = false;
//container where all the actions will take place
this.createEmptyMovieClip("container", this.getNextHighestDepth());
this.createEmptyMovieClip("container1", this.getNextHighestDepth());
//keep track of next highest depth number to abuse at will
var nextDepth:Number = getNextHighestDepth();
load_btn.onRelease = function() {
if (!loaded) {//when the variable loaded is false
container._x = nextDepth-1048553;
container._y = nextDepth-1048553;
loadMovie("square.swf", "container");
trace(container.getDepth());
loaded = true;
this.gotoAndStop("unload");//skip to another frame in the button to show a different label
} else {//when the variable loaded is true
container.unloadMovie(squareHolder);
loaded = false;
this.gotoAndStop("load");//skip to another frame in the button to show a different label
}
};
load_btn2.onRelease = function() {
if (!loaded) {//when the variable loaded is false
container1._x = nextDepth-1048543;
container1._y = nextDepth-1048543;
loadMovie("square2.swf", "container1");
trace(container1.getDepth());
trace (container1._x)
loaded = true;
this.gotoAndStop("unload");//skip to another frame in the button to show a different label
} else {//when the variable loaded is true
container1.unloadMovie(squareHolder);
loaded = false;
this.gotoAndStop("load");//skip to another frame in the button to show a different label
}
};