I’ll start off by saying I’m using Flash 8, Actionscript 2.0, and exporting as FlashPlayer 6.
I’m trying to do this long landscape with a movie clip labeled, “mainMovie”, let’s say it’s approximately 3600 x 600, while the stage/document dimensions are 800 x 600 .
I have script on it so that moving the cursor to the left or right edge of the stage, the entire movie clip shifts left or right and through the rest of the landscape, similar to the 360 vr tours you see for some real estate sites online.
On the main stage, I have that movie clip called, “mainMovie”. Inside “mainMovie”, is another clip called, “singleStrip”, and inside that clip, I have other smaller movie clips through the landscape which are labeled and consist of random stuff, like shapes and items and stuff.
Everything works fine. The extra step that I am attempting is that I want the user to be able to scroll through the clip, “click” on an item, and then that item zooms into the front center stage and plays a small animation about that item. These items that are found throughout the landscape are movie clips themselves with script on them to be recognized as buttons.
My problem with that is even though the center of my stage would be x=400, y=300, since my mainMovie on the stage scrolls from left to right, when I put in code to tween the item to a center position, that position is only set to the inside of the movie clip and not the center of the stage. I need to center a movie clip within two other clips to the stage.
An example of the path of any of those items would be sort of like,
_root.mainMovie.singleStrip.book
… and the tween script I have inside the “singleStrip” movie clip, where all these items are reads as:
function tweenbook() {
easeType = mx.transitions.easing.Regular.easeOut;
var beginx = 74;
var beginy = 93;
var endx = 400;
var endy = 300;
var time = .75;
var mc = book;
var begin_xscale = 40;
var begin_yscale = 40;
var end_xscale = 100;
var end_yscale = 100;
bookTween = new mx.transitions.Tween(mc, “_x”, easeType, beginx, endx, time, true);
bookTween = new mx.transitions.Tween(mc, “_y”, easeType, beginy, endy, time, true);
bookTween = new mx.transitions.Tween(mc, “_xscale”, easeType, begin_xscale, end_xscale, time, true);
bookTween = new mx.transitions.Tween(mc, “_yscale”, easeType, begin_yscale, end_yscale, time, true);
}
This obviously moves the book to the center an x and y position for “singleStrip”, and not the stage. The line of code I want to alter is the “var endx” and “var endy”, and this is where I get confused with what I need to do, or whether it’s possible. I at one time, tried something like,
var endx = stage.width._x / 2;
var endy = stage.height._y / 2;
That didn’t work. It shifted it to a different position, not being the center of the stage.
At another point, I tried to fake it out, placing a movie clip of a red ball on the main timeline in the center of the stage, and changed my code to:
var endx = _root.centerBall._x;
var endy = _root.centerBall._y;
This didn’t work, either.
Can anyone help me or have any suggestions to try… ? I do have other code that affects the motion scroll of the mainMovie from left to right, but I don’t think this is the problem, I could be wrong.
Any help is GREATLY appreciated.
Thanks in advance.