|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ActionScript 3 - GotoAndStop(); not running along with ENTER_FRAME?
heya, theres probably a simple fix for this, but i dont get it.
the code is a mess and I guarantee some nooby items there, but it should all work, basically my button will do all its told in the function it runs, EXCEPT the jump to the next stage frame label? I think this is something to do with the enter_frame's i have going? any ideas? Code:
select1.addEventListener(MouseEvent.CLICK , nStage2);
stage.addEventListener(Event.ENTER_FRAME , movement2);
stage.addEventListener(Event.ENTER_FRAME , movementb2);
function movementb2(event:Event):void
{
panpoint.distance = 115 - panpoint.mouseX
}
function movement2(event:Event):void
{
if (cityL1.x > 575) {
cityL1.x = 575;
} else if (cityL1.x <310) {
cityL1.x = 310;
}
if (cityL2.x > 575) {
cityL2.x = 575;
} else if (cityL2.x <310) {
cityL2.x = 310;
}
if (cityL3.x > 875) {
cityL3.x = 875;
} else if (cityL3.x <510) {
cityL3.x = 510;
}
var mod2a = cityL1.scaleX/105;
cityL1.x+=(panpoint.distance/10)*mod2a;
var mod2b = cityL2.scaleX/85;
cityL2.x+=(panpoint.distance/10)*mod2b;
var mod2c = cityL3.scaleX/65;
cityL3.x+=(panpoint.distance/5)*mod2c;
}
function nStage2(event:MouseEvent):void
{
stage.removeEventListener(Event.ENTER_FRAME , movement2);
stage.removeEventListener(Event.ENTER_FRAME , movementb2);
cityL1.mouseEnabled = false;
cityL2.mouseEnabled = false;
cityL3.mouseEnabled = false;
panpoint.mouseEnabled = false;
gotoAndStop("stage2");
trace ("clicked");
}
stop();
|
|
#2
|
|||
|
|||
|
Heya, the first argument of gotoAndStop() has to be either a frame label or a frame number. The second argument is the stage name to jump to (which is optional). Try:
this.gotoAndStop(1, "stage2"); |
|
#3
|
|||
|
|||
|
Ta for the reply.
I know what your saying, however I have the frame labelled 'stage2' I tried changing it to 'secondscene' and nothing still. Also I just tried this.gotoAndStop(2); and gotoAndStop(2); as its the 2 frame really that im targetting here, but it just doesnt do that part of the function. :S Thanks so far. |
|
#4
|
|||
|
|||
|
hmmm so is the nStage2 function written inside the MovieClip you want to move the playhead on? I just assumed it was...
|
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > ActionScript 3 - GotoAndStop(); not running along with ENTER_FRAME? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|