I have several MC shapes (shape1, shape2, etc.) on the stage at specific coords. When you click on shape1 I want it to (through AS, no timeline tweening) ease over to another specific set of coords. Same with shape2, but to start/stop at different coords.
After clicking and AFTER the ease over to the second set of coords I want a pop-up browser window to come up.
So the chain of events are: 1) click shape 2)shape moves to new coords 3) window pops up… that easy? So far no problems except 2 things;
first here’s the script I put in the MC of the shape:
onClipEvent(load){
//here are the starting coords of the shape
_x=625;
_y=32;
speed=10;
}
on(press){
//here’s where I want the shape to go
targetx=400;
targety=300;
//and here’s where I want it to wait until it gets
//there to open up the pop up window
//I’m assuming I need an “if” statement but I don’t
//know what to say
if(?something about when the MC reaches specific
coords (400,300)?){
address = http://www.google.com;
target_winName = “google”;
width = 600;
height = 600;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 1;
resizable = 0;
openWinCentre(address, target_winName, width, height, toolbar, location,
directories, status, menubar, scrollbars, resizable);
}
}
onClipEvent(enterFrame){
//here’s the code for the easing of the shape
_x+=(targetx-_x)/speed;
_y+=(targety-_y)/speed;
}
Now then, the two problems I’m having is when the movie loads, the shapes do begin at their designated beginning coords (625,32 in this example); but they IMMEDIATELY ease on over to 0,0 the split second the movie loads before you can click anything. Then, when you click the shape, it moves beautifully down to the target coords no problem.
How do I prevent the shape from heading over to 0, 0 when the movie loads? I want to keep them still, exactly where I set them until I click them.
The second problem is getting the pop up window to NOT occur UNTIL the shape has reached it’s target coords. I would assume I needed an “if” thrown in, but I’m having a helluva time figuring out how to word it correctly. I want to say “on(press) if this shape arrives at exactly 400, 300 then and only then do I want this pop up window to come up…” Follow me?
As I said, this code is nested in the instance of the shape itself. And before you ask, I do have the appropriate code in frame one of the main timeline (the getURL script stuff). The window opens no problem in the example above, it just occurs the moment I click the shape when I want it to wait until the shape reaches it’s destination.
Sorry so long winded… Anybody with any flashes of brilliance?
Thanks in advance!