Skip to main content
Inspiring
February 21, 2017
Question

Changing speed of certain movieclip.

  • February 21, 2017
  • 1 reply
  • 666 views

I have pause menu for a game.I use stage.frameRate for stop and resume the game.The game menu down on stage to when click the pause button.But when I click stop button it not work until I moving the mouse.So I use timer for fix that and menu(movieclip) work fine it's ok.But problem is other buttons in menu it not work until I moving the mouse because stageframe is still 0.01.

I've just spent the last a week for that.I tried boolean and removeeventlistener.But this is caused too many problems.

Can I change speed only for pause menu movieclip ? How can I fix that ? Thanks

//This timer control the frame rate when click pause button

var frameratetimer:Timer = new Timer(0050,0);

frameratetimer.addEventListener(TimerEvent.TIMER, pmenulev1);

function pmenulev1(evt:TimerEvent):void {      

stage.frameRate = 0.01; 

  frameratetimer.stop();

}

var asagi:Number=400;

var banasagi:Number=800;

var yukari:Number=-400

var banyukari:Number=-800

stopa.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent😞void
{

pausemenu
.y+=asagi;
ban
.y+=banasagi;
playa
.y+=asagi;

if (pausemenu.y>=pausemenu.height/0.0) {
  asagi
*=-2;
}  

if (ban.y>=ban.height/0.0) {
  banasagi
*=-2;
}  

if (playa.y>=playa.height/0.0) {
  asagi
*=-2;
}

  timer.stop(); //Normal game timer.
frameratetimer.start();

stop();
}

//Resume Button
playa
.addEventListener(MouseEvent.CLICK, onaClick);
function onaClick(e:MouseEvent😞void
{
timercheck
.stop();

  pausemenu
.y+=yukari;
  ban
.y+=banyukari;
  playa
.y+=yukari;

if (pausemenu.y>=pausemenu.height/0.0) {
  yukari
*=-2;
}

  
if (ban.y>=ban.height/0.0) {
  banyukari
*=-2;
}

  
if (playa.y>=playa.height/0.0) {
  yukari
*=-2;
}
stage
.frameRate = 24;
}

//THİS İS PAUSE MENU MOVİE CLİP

import ses;

import flash.media.Sound

import flash.media.SoundChannel;

mmenu.addEventListener(MouseEvent.CLICK, fca);

function fca(event:MouseEvent):void

{

  

    MovieClip(this.root).gotoAndPlay(1,"menu");

}

//ses//

seskes.visible = false ;

var muteClicked:Boolean = false;

var onsoundClicked:Boolean = false;

var soundIsOn=true;

var st:SoundTransform = new SoundTransform();

sesac.addEventListener(MouseEvent.CLICK, changeSound);

{

function changeSound(event:MouseEvent):void {

  if (soundIsOn) {

   currentScene.stage.frameRate = 24;

   sesac.visible = false;

   seskes.visible = true;

   st.volume=0;

   SoundMixer.soundTransform=st;

   soundIsOn=false;

  }

}

}

seskes.addEventListener(MouseEvent.CLICK, konClick);

function konClick(e:MouseEvent):void

    {

           seskes.visible = false;

   sesac.visible = true;

   st.volume=1;

   SoundMixer.soundTransform=st;

   soundIsOn=true;

    }

  

  

    stop();

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 21, 2017

you can't easily control the framerate of individual movieclips.

and to be sure you can't assign a stage framerate and override that for individual movieclips.  you should pause (ie, stop) the movieclips you want to stop and allow the reset to play/respond.