Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-18-2005, 06:54 PM   #1
ilollar
Registered User
 
Join Date: Mar 2005
Posts: 39
Default Problem with looping MCs

Hi all,
I've got a problem with a MC I have in a game I'm making. Basically, it's a "flying in space" game, so the camera is looking down. The character, Dave, is floating in space and when the user presses an arrow button, he flies in that direction. I have a MC for Dave floating in space, and a seperate MC for Dave flying. Thanks to user Gibberish, I've created a holder MC that switches to the "inflight" MC when a key is down, and then back to the "static" MC when the button is released. My movement scripts are applied to the holder MC, named just dave. The problem I'm having is that my inflight MC, which contains two frames, is not looping. When the key is pressed, it loops for about a second, and then it just stops. The static MC loops fine, but the inflight does not.

Here's my script:
ActionScript Code:
dave._x = 400; // dave's X axis starting point dave._y = 300;// dav'es Y axis starting point speed = 4; // speed dave moves at StageWidth = Stage.width; // width of stage -- old value was 800 StageHeight = Stage.height; // width of stage -- oldvalue was 600 // --------------------------------------------------- // ------- SET LISTENERS // --------------------------------------------------- watchMouse = new Object(); watchMouse.onMouseMove = function() {         trace("The mouse X position is "+_xmouse);         trace("The mouse Y position is "+_ymouse); }; // ----- Key Listener watchKeyboard = new Object(); // on keyDown watchKeyboard.onKeyDown = function () {         loadInFlight(); // load flying dave         dave.onEnterFrame = moveStuff; //run as onEnterFrame }// End onKeyDown Function // on keyUp watchKeyboard.onKeyUp = function () {         loadStatic(); //load static dave         dave.onEnterFrame = null; // stop onEnterFrame }// End onKeyUp Function Key.addListener(watchKeyboard); // ----- End Key Listener // --------------------------------------------------- // ------- END LISTENERS // --------------------------------------------------- // --------------------------------------------------- // ------- SET FUNCTIONS // --------------------------------------------------- moveStuff = function() {         if (Key.isDown(Key.LEFT)) {                 this._x -= speed;                 this._rotation = 90;         }         if (Key.isDown(Key.RIGHT)) {                 this._x += speed;                 this._rotation = -90;         }         if (Key.isDown(Key.UP)) {                 this._y -= speed;                 this._rotation = 180;         }         if (Key.isDown(Key.DOWN)) {                 this._y += speed;                 this._rotation = 0;         }         if (this._x>StageWidth+(this._width/2)) {                 this._x = 0-(this._width/2);         }         if (this._x<0-(this._width/2)) {                 this._x = StageWidth+(this._width/2);         }         if (this._y>StageHeight+(this._height/2)) {                 this._y = 0-(this._height/2);         }         if (this._y<0-(this._height/2)) {                 this._y = StageHeight+(this._height/2);         } } //run this function to load Static Dave loadStatic = function(){     dave.attachMovie("static","daveAction",0); //attach the static dave } loadStatic(); // this runs once at start of movie to load dave //run this function to load inFlight Dave loadInFlight = function(){     dave.attachMovie("inFlight","daveAction",0); // load flying dave } // --------------------------------------------------- // ------- END FUNCTIONS // ---------------------------------------------------

Anyone have any ideas why this is happening?
Thanks!!!
ilollar is offline   Reply With Quote
Old 04-18-2005, 09:15 PM   #2
ilollar
Registered User
 
Join Date: Mar 2005
Posts: 39
Default

You can view the swf here:
http://testarea.50megs.com/

Thanks!
ilollar is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:21 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.