Hello all,
I recently posted an issue I was having in regards to a continuous panning image, with nested buttons triggering a zoom and scale, then subsequent return. It has driven me to the brink of madness…
The site has tentatively gone live, with the as-is version of this flash in place. Since then, I have a more refined version, and am nearly ready to hand over to them. Here’s my issue: the continuous scroll, turned on through setting a variable to true in the root, is refusing to change to false (i.e. stop scrolling) when a button is clicked. Aside from massaging some of the dest_x’s and dest_y’s, I think it will be running well…except for this issue. Here’s the main script:
onClipEvent (enterFrame) {
trace("zoomstate: "+_root.zoomstate);
_root.scrollmc = true;
if (_root.zoomstate == "zoomin") { //zoom the movie clip in
trace("loop: zooming in");
//Change x-position
_root.change_x = _root.panimage._x+_root.dest_x;
_root.panimage._x = _root.change_x/2;
//Change y-position
_root.change_y = _root.panimage._y+_root.dest_y;
_root.panimage._y = _root.change_y/2;
//Change scale
_root.change_scale = _root.panimage._yscale+100;
_root.panimage._yscale = _root.change_scale/2;
_root.panimage._xscale = _root.change_scale/2;
//Output x/y position
trace("xpos = "+_root.panimage._x);
trace("ypos = "+_root.panimage._y);
if ((_root.panimage._x/_root.dest_x)>0.99) { //If close enough to dest_x, escape loop
_root.panimage._x = _root.dest_x;
_root.panimage._y = _root.dest_y;
_root.panimage._yscale = 100;
_root.panimage._xscale = 100;
_root.zoomstate = "zoomedin";
trace("zoomstate: "+_root.zoomstate);
trace("currentscene: "+_root.currentscene);
_root.overlay.gotoAndPlay(_root.currentscene);
}
} else if (_root.zoomstate == "zoomout") { //zoom the movie clip out
trace("loop: zooming out");
//Change x-position
_root.dest_x = _root.orig_x;
_root.change_x = _root.panimage._x+_root.dest_x;
_root.panimage._x = _root.change_x/2;
//Change y-position
_root.dest_y = _root.orig_y;
_root.change_y = _root.panimage._y+_root.dest_y;
_root.panimage._y = _root.change_y/2;
//Change scale
_root.change_scale = _root.panimage._yscale+50;
_root.panimage._yscale = _root.change_scale/2;
_root.panimage._xscale = _root.change_scale/2;
if ((_root.panimage._x/_root.dest_x)>0.99) { //If close enough to dest_x, escape loop
_root.panimage._x = _root.dest_x;
_root.panimage._y = _root.dest_y;
_root.panimage._yscale = 50;
_root.panimage._xscale = 50;
_root.zoomstate = "zoomedout";
trace("zoomstate: "+_root.zoomstate);
//turn scrolling back on
}
}
//controll scrolling
trace("scroll= " + _root.scrollmc);
if (_root.scrollmc == true) {
//start scrolling
_root.panimage._x = _root.panimage._x+1;
//when mouse moves left, navigation panel moves right
if ((_xmouse>30) && (_xmouse<238) && (_ymouse>-255) && (_ymouse<-75)) {
_root.panimage._x = _root.panimage._x+3;
}
//when mouse moves right, navigation panel moves left
if ((_xmouse>398) && (_xmouse<616) && (_ymouse>-255) && (_ymouse<-75)) {
_root.panimage._x = _root.panimage._x-6;
}
//when navigation panel reaches it's maximum x-value it resets itself
if (_root.panimage._x>0) {
_root.panimage._x = -1486;
}
if (_root.panimage._x<-1540) {
_root.panimage._x = -52;
}
}
}
And here’s a sample of one of the button scripts:
on(press, release) {
_root.scrollmc = false;
_root.dest_x = 300;
_root.orig_x = _root.panimage._x;
_root.dest_y = -40;
_root.orig_y = _root.panimage._y;
_root.zoomstate = “zoomin”;
_root.currentscene = “phone-start”;
}
I’m also afraid that the escape conditional on the ‘zoom out’ state is jacked up:
if ((_root.panimage._x/_root.dest_x)>0.99) { //If close enough to dest_x, escape loop
but my major issue is how to stop the scroll during scale/shift, then restart it when scaled back out. Any help from any experts would be so incredibly welcome, andI would be forever grateful. Krilnon was originally helping me with this; Krilnon - if you’d like, take a look and tell me your ideas. The live version is at:
That is the older, now-live version. Here’s an internal link to the new version, so you can see both the progress and the errors:
http://dev2.capstrat.com/clients/doj
I’m panicked for time - this is making me crazy. Thanks again!