0

I'm making a game in actionscript using the FlashDevelop tool and the FlashPunk game engine. I have a designer making movie clips for me to put into this game using Flash CS3.

My problem is that when I add these movie clips into my game they are playing much quicker than they should. Is there a specific frame rate clips need to be made in within CS3 or any other export options set to enable them to play at the correct speed or is this something that I need to deal with in my code. If it is the latter does anyone have any advice?

EDIT

Another problem that I'm having is that the command movieClip.stop() doesn't work. Is there anything special that needs doing while exporting or the programming side?

EDIT

Here is how I'm loading in my swfs:

public var movieClip:MovieClip = new MovieClip();
private var myLoader:Loader;

public function MyMovieClip(location:String)
{
    myLoader = new Loader();
    var myRequest:URLRequest = new URLRequest(location);
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
    myLoader.load(myRequest);
}

private function onCompleteHandler(loadEvent:Event):void
{
    movieClip = loadEvent.currentTarget.content;
    FP.stage.addChild(movieClip);
}

The movie clip starts automatically and I try and stop the clip with:

movieClip.stop();

EDIT

I've decided to scrap movie clips and replace them with spritesheets as these will fit the role just as well and I know what I'm doing with them. Thanks for all the help though.

John Lilley
  • 159
  • 1
  • 3
  • 13
  • 1
    Could you give us more information about your workflow? In particular, how exactly are you using FlashDevelop and Flash CS3 in tandem? There are a variety of ways to go about that, so the specific methodology you are using matters. Just off the top of my head two approaches I can think of are 1) use FlashDevelop for writing code but compile the game in Flash, or 2) compile the animations as swfs from Flash and load those in your FlashDevelop project. Those are just the first two approaches I thought of and they are very different. – jhocking May 24 '11 at 15:20
  • I'm using the second approach you mentioned. All my code is written in and compiled in FlashDevelop. All I'm using cs3 for is to compile my swfs.(I am not doing this myself though.) – John Lilley May 24 '11 at 15:26
  • ok that was my original assumption. Can you post code for how you are loading and playing the external movie clips? I'm guessing the problem lays elsewhere but you may as well post that code. – jhocking May 24 '11 at 15:49
  • I've edited my post with the requested code. – John Lilley May 25 '11 at 08:30

2 Answers2

2

Check what framerate Flash is set to, and what framerate FlashDevelop is set to. The former can be found in the properties window when nothing is selected, and the latter is under Project>Properties. The framerate in Flash defaults to 12 while FlashDevelop defaults to 30, so if you don't manually set the framerates any animations will play much faster in FlashDevelop.

jhocking
  • 5,527
  • 1
  • 24
  • 38
  • Thanks for the help. I've tried setting them both to 30fps but it still seems to play twice the speed in flashdevelop. If i set it to 60fps in cs3 they are about the same speed. This seems a little odd. Another question that has cropped up is that my movieclip.stop() method doesn't do anything. This also seems a little odd as there doesnt appear to be anything else in the class to stop the clip. – John Lilley May 24 '11 at 15:12
  • In retrospect my answer made certain assumptions about your workflow, so I'll ask for clarification in a comment to your question. – jhocking May 24 '11 at 15:19
0

I recoment to do nextFrame manually:

var timer:Timer = new Timer(500, 60); //calling onTick function every 0,5 sec for 1 minute
timer.addEventListener(TimerEvent.TIMER, onTick); 
...
public function onTick(e: Event) {
  movieClip.nextFrame();
}

look in livedocs for more details

Eugeny89
  • 3,797
  • 7
  • 51
  • 98
  • interesting idea, but i think getting messed up framerates aligned at the source *probably* a better idea. Gonna mental note this tho. – Bosworth99 May 24 '11 at 15:59