Be a Supporter!
exiting flash window Posted March 31st, 2009 in Game Development

I have been looking around and cannot find how to use code to close the window of the flash movie.

Anyone know how to do that?

Arrays Posted March 23rd, 2009 in Game Development

How do I remove a value from the middle of an array in AS3

(for example): myArray["a", "b", "c", "d", "e", "f"]

how would I remove only "d" from the array?

Response to: MovieClip positions Posted March 20th, 2009 in Game Development

oh, right, yah the registration point is the same for both of them

Response to: MovieClip positions Posted March 20th, 2009 in Game Development

The same thing happens when I change their x and y co-ordinates to 0 in the properties window. Or is that not what you meant?

Also, putting them on different layers doesn't change anything

Response to: MovieClip positions Posted March 20th, 2009 in Game Development

that is not how it's drawn on stage, no

also I'm using AS3 which uses MovieClip.x now

MovieClip positions Posted March 20th, 2009 in Game Development

Ok, this is an odd situation.

For all intents and purposes this is the only code I have:

shipGreen_mc.x = 360;
shipGreen_mc.y = 630;

shipRed_mc.x = 360;
shipRed_mc.y = 630;

(I have other code but the problem still happens even if I comment out all my code except for the code above)

As far as I can tell they should be in the exact same spot right?

but this is the result:

...what the hell?

MovieClip positions

Response to: Keyboard Shortcuts Posted March 19th, 2009 in Game Development

ahh excelent, thank you so much

Keyboard Shortcuts Posted March 19th, 2009 in Game Development

I'm programming some keyboard controls and for some reason when I run the program and use the keys on the keyboard, flash highlights the tools on the side as if I'm hitting the hotkeys.

This is happening after I start the movie playing and because of this I am unable to use any keys that are hotkeys.

Response to: Microphone Recording Posted March 17th, 2009 in Game Development

That is quite expensive :P but tell me anyway I feed on knowledge

Response to: Microphone Recording Posted March 17th, 2009 in Game Development

Yah, I looked at that stuff, doesn't it require network programming? Would you be able/willing to explain how it works?

Response to: Microphone Recording Posted March 17th, 2009 in Game Development

that would be good, unfortunately I don't know how to get the information that I need to save into the array.

Microphone Recording Posted March 17th, 2009 in Game Development

I'm trying to make an application where the user records their voice and then is able to play that recording back within the application.

I've been able to have the microphone pick up sound and I can play audio that already exists on my computer. However I can't find a way to actually save the audio from the microphone in order to play it back.

Any help is greatly appreciated


In my code I divide SoundChannel.position and Sound.length because that should give me a percentage of how far the audio has played. However, SoundChannel.position never reaches the same number as Sound.length but it comes close, sometimes 90 percent for short audio and 98 percent for longer audio.

Has anyone else had this problem? And if so how did you manage to fix it, or get around it (if you did)

Response to: 3.0 equivalents Posted March 14th, 2009 in Game Development

Awsome, that works

So then what about "MovieClip.attachAudio();" how do I do this in AS3?

3.0 equivalents Posted March 14th, 2009 in Game Development

I am just starting to code with Actionscript 3.0 after a long time of having coded in 2.0

I'm having trouble with this one line:

this.createEmptyMovieClip("audio_mc", this.getNextHighestDepth());

it is giving me this error:

TypeError: Error #1006: getNextHighestDepth is not a function.
	at Microphone_fla::MainTimeline/Microphone_fla::frame1()

I think this may be a problem with the "this." command because if I change "this.getNextHighestDepth()" to say 2 the error is the same except it replaces "getNextHighestDepth" with "createEmptyMovieClip"

did they just change the perameters of "this" for 3.0 or perhaps the two functions?

also, a function called MovieClip.attachAudio(); I can't find the 3.0 equivalent for, if there is one.

Frame by Frame animation Posted February 27th, 2009 in Game Development

In a frame by frame animation is there any point to making the moving objects in the scenes into symbols?

I know with static objects it saves space because the program doesn't have to redraw them every time (or something like that :P) But does that happen if I have to create a new symbol for each frame of movement, or can I just leave it not turned into a symbol?

Response to: Street Fighter Collab / Art Contest Posted January 11th, 2009 in NG News

OK two things

1. How strict are you about the 15~30 second time limit, mine looks like it might be a few seconds shorter than that.

2. Does the cleaned up picture need to be from the movie or can it perhaps be a picture of the artist in a cool pose?

Response to: global variables Posted November 30th, 2008 in Game Development

Nothing? Not even an "I don't understand what you're asking" post?

I really need an answer to this and if I'm not being clear please explain how I can be more clear

global variables Posted November 30th, 2008 in Game Development

I have two AI who I control using global variables. They need to be global because if I put them in the movie clip they keep defaulting to zero. For example:

this variable is instantiated in an empty frame
_root.hasHit = 0;

this statement is in the movie clip
if(_root.hasHit == 1){
bla bla bla
}

if I had the _root.hasHit = 0; in the movie clip then the if statement would never happen because hasHit would always go back to zero.

This code works, however if I have two identical AI people and one of them gets hit the other one thinks he got hit as well because hasHit becomes 1.

I want to know if it's possible to distinguish multiple AI without having to create a new hasHit variable for every AI person. If not, perhaps you could suggest a better way to do what I'm trying to do.

Response to: Movie Clip's name, not instance Posted November 12th, 2008 in Game Development

Anyone know exactly what that is? cuz ["GridBox"+i] didn't work

Response to: Movie Clip's name, not instance Posted November 12th, 2008 in Game Development

can you do a for loop for the actual instance name, like GridBoxi replacing the number with i?

Also to make it more clear:

I'm trying to colide with all the instances of GridBox but I can only affect the GridBox one instance at a time and with 88 of them that becomes very tedious

Movie Clip's name, not instance Posted November 12th, 2008 in Game Development

I am using a very large amount of the same movie clip and all their instances are named differently.

ie. GridBox is the movie clip name, GridBox1 through GridBox88 are the instance names

I want to use only the movie clip name at one point without needing the distinction of the instance names but the program so far is only recognizing the instance names


I am making a game that duplicates movie clips and to do that I use the function:

getNextHighestDepth();

and whenever I create a chunk of duplicated movie clips that highest depth keeps getting higher. However I need the depth to return to zero every once in a while

Is this possible and if so how do I do it.

(essentially I want it to be getNextHighestDepth(); = 0 but obviously I can't do that since it's a function)

Response to: Code not working second time called Posted November 1st, 2008 in Game Development

I understand what you meant, but you're incorrect.

Duplicated movie clips from Scene 1 are showing up in Scene 3 and they shouldn't be. When I run the unloading code it does delete the movie clips in scene 3 the first time but the second time I enter the scene (without closing the program) the movie clips stay in scene 3.

Response to: Code not working second time called Posted November 1st, 2008 in Game Development

But that's my problem, Scene 1 IS affecting Scene 3 and I don't want it to :P


I have code that duplicates a movie clip called lime_mc (and other things but I only care about the duplication). That code looks like this:

for (i = 0; i < howManyLimes; i++){
//generates a time for the lime to dissapear
_root.limeTime = Math.floor(Math.random() * 450000) + 1;

//assigns each duplicated movie clip with a new number
_root.assigNum = _root.assigNum + 1;

//records how many limes there are
_root.numberOfLimes++;

//tells program where to put the movie clip
k = Math.floor(Math.random() * 70) + _root.limeDisplay_mc._x - 33;
j = Math.floor(Math.random() * 22) + 102;

//duplicates the movie clip
duplicateMovieClip (_root.lime_mc, "lime_mc" + _root.assigNum, root.getNextHighestDepth());

//uses the recorded number of limes elsewhere in the program
_root.limeInfo_mc.limeAmount_txt.text = _root.numberOfLimes;

//records the time that a lime has been in existence
_root.timeArray[_root.assigNum] = getTimer() + _root.limeTime;

//places the movie clip where it should go
setProperty ("lime_mc", _x, k);
setProperty ("lime_mc", _y, j);
}

This code runs once whenever the scene (Scene 1) begins. Then I have code in a different scene (Scene 3)that causes these duplicated movie clips to go away when that new scene is entered.
This is that code:

for (j=0; j<_root.numberOfLimes+3; j++) {

//removes lemon number j movie clip
unloadMovie(_root["lime_mc"+j]);

}

Now, the unloading code works perfectly the first time it is activated. However if I enter Scene 1 (which brings back the limes with the first chunk of code) then enter scene 3 again the unloading does nothing and the movie clips remain on the stage.

The for loop is definately entered and all the variables in unloadMovie are defined.
I am at a complete loss and I hope someone knows what's going on.

Response to: Going back to a stop(); Posted October 29th, 2008 in Game Development

Guh, Alright, for those who care: I finally solved this problem.

I still used the count concept in this if statement in the movie clip:

onClipEvent(enterFrame){
if(this.hitTest(_root.player_mc)){
_level0.count++;
}
}

but notice that there's no gotoAndPlay. I had to move that to an empty frame on another layer in an if statement that looks like this:

if(_root.count != 0){
gotoAndPlay("Scene 3", 1);
}

and voila, it goes to that scene.

Response to: Going back to a stop(); Posted October 29th, 2008 in Game Development

I understand what you're saying, and you're right it SHOULD work. Unfortunately it just keeps going as if it didn't even see the goToAndPlay. But I know it did because I did a trace in the if statement.

I believe that the way you have it is how I had my code originally (except for the _root. in front of the goToAndPlay) but just changing that still did not work.

Response to: Going back to a stop(); Posted October 29th, 2008 in Game Development

Nope, nothing changed

Going back to a stop(); Posted October 29th, 2008 in Game Development

My game so far is one frame long and I do this by putting a stop(); on a layer called actions with nothing but code in the layer. That part looks like this:

if(_level0.count == 0){
stop();
}

I also have in the game a symbol which I want to make that stop not occur, within that symbol is code that looks like this:

onClipEvent(enterFrame)
{

if(this.hitTest(_root.player_mc))
{
_level0.count++;
gotoAndPlay("Scene 3",1);
}
}

This code would work if the program ever managed to get back to the first bit of code and not make it stop thus not allowing the program to go to the next scene.

I would like to know how to either make the program trace to that stop code or have some other way to get around it.