ActionScript 3.0 :: How To Add Memory To Flash Game Or Movie
Mar 9, 2011
I may be tackling a huge subject here but I was wondering how to make it so that if someone uses one of my flash projects and they close it that it would remember where they left off. For example there are many Flash Games out there with levels, and instead of having to repeat each level over and over, the game remembers the level you left off at.
I'm very new to flash,and have been digging through google and this site for information on how to piece together an AS2 shooter game.Its going well enough, but I'm having slowdown issues the longer the games runs, and I was hoping someone here could point me in the right direction.To paste an enemy movie clip on the screen, i'm using this:
Code: var spawn =_root.attachMovie("monster1","monster1"+_root.getNextHighestDepth(),_root.getNextHighestDepth())[code]........
I need them stored in an array so that the player's shots can test weather or not they've hit any monster on the bullet's enter frame function, then call that monster's movie clip's take damage function. I'm using a for loop to do this:
Code: for(var i in _root.player.foes){ if (this.hitTest(_root.player.foes[i])){ _root.player.foes[i].takedamage();} }
I think the problem with the slowdown is that each time I place an enemy on the screen the array gets bigger and bigger. The slowdown only happens while the player is shooting, and I suspect the ever longer for loop with the hit testing is causing it.
I'm already removing the monster's movie clips as they get killed or exit the screen, I guess what I need is a way to reduce the size of the array at the same time, or at least tell the for loop not to do a hit test unless the monster is still alive.
I'm trying to create a random sequence memory game, where user has to watch over a certain sequence appears on the screen before they can input (by pushing buttons) according to the sequence appear before.I've found simon sayz code and make a modification on it.It worked flawlessly, but there is one problem with it.The code creates the sequence in this manner, e.g:
1 1 1 2 1 1 2 3 1 1 2 3 4 1 1 2 3 4 5 etc,..
while the game I'm intended to develop doesn't need that kind of increment logic, they just need to display 5 different element for starter and then the user should follow the sequence displayed on it.
I am trying to create a memory game, where about five or six (doesn't matter how much) different colours com up and flash for a second and disappear in a random order.
Then the user has to try to match them again buy clicking on the colours that they have infront of them in the same sequence as the lights went.
Is there a way to make this game so it will tell you when you are wrong or right, and also is it possible to make the flashing colours random each time you play it?
I made a memory game with a tutorial. My knowledge of AS3 is not that good so I have to following question.There is a function like Math.Random to random generate number and put them on stage. I made a memory game and the cards are on the same place every time I play the "movie".I want them to shuffle every time I restart the game. How can I write a good random function in AS3?
i am making a game with scrolling background. I am using a tiled background.inactionscript I was going to hide background objects off the screen but this cause memory to still be taken up by the hidden images so what do i do?the scrolling background isnt repeating so i could have 4-5 screens of image tiles off screen and made invisible until required.
This person created this game:http:[url]....i was wondering if i wanted to match two different colours, how could i do this? for example, instead of matching two reds, if i wanted to match a red and green, how is this done?
The prblem that i have is that when i click the 'Bone Memory' game it load up fine. I can play the game and the 'Play Again' button work as well.The problem occurs when i use the 'Main Menu' button. It goes to the main screen, which is fine, but the 'duplicate' cards that were created for the game appear on this main screen when they shouldn't. This in turn causes problems with playing the game when the 'Bone Memory' button is selected for the second time. The cards are all in the wrong places.I am attching the file with the code. The main screen and game were created seperatly and i have tried to combine the in the file attched.
This is my first attempt at a game in AS3.I'm currently experiencing a problem which I'm sure is a result of my poor understanding of programming concepts.My problem is this, every time I call the function to rebuild my level, the game progressively slows down.I've tried to clear everything, but somehow something is still causing the slow down. I'll attach a zip with all of the files, and also I will add the main code to this.The attempted clearing happens in a function called cleanup() and the level setting up in setupLevel().[code]
I want to load an SWF object from a Memory Stream or a byte array instead of a file on disk.AxShockwaveFlash class provides methods and properties to load an SWF providing its path to disk as a string but I haven't seen another way of doing it. There is an InlineData property but generally the class is undocumented and I don't know what this property does. Can it be done at all?
I have a flash movie instance name "headArea" I want to load a external swf and swop the movie inside the headArea - replacing the head.I have the following code:
clickIt.addEventListener(MouseEvent.MOUSE_DOWN, swopHead); function swopHead(event:MouseEvent):void { var loadit = new Loader();
i have an evil memory leak that i would like to fix. at the end of the game a bunch of sprites "explode" and fly around. once they leave the stage, i stop their enterframe loop and remove them like so:
I wrote an application in flash AS3, and when I trace from flash the total memory usage of the total application is only about 9MB, But at the same time Task Manager Shows the memory usage as 110MB. Around 100MB difference.Flash Trace Method System.totalMemory difference of the Trace from the Beginning of the application to end of the application.
when I publish my movie I get a message that says:"error creating flash movie. there was not enough memory available".I tried increasing the paiging files size and the registry size in windows but that didn't work.
I'm working under XP with Flash 8. The fla file is about 85 MB and has 60 frames with panorama photo's. Everything went great for months, untill a couple of days ago. I got the following message while publishing to a projector (or a swf): "Error creating Flash movie. There was not enought memory available." But there is enough free memory. I cleared 6GB. There is enough internal memory (2GB) and I have messed around with the virtual memory. But the message keeps popping up. On the internet I read that it could be a corrupt images. So I put everything in a new fla with mixed results. Sometimes it works and even makes a projector, sometimes (more) it doesn't. Sometimes copying frames to a new file works, but then Flash crashes, I'm becoming crazy here. How can you spot with image or file is corrupt? All photo's in the library look normal. So how do you recognize a corrupt image and how do I get rid of the error?
I'm creating a game, here is a screenshot: I'm trying to implement a scene system in an easy way (I'm a beginner). In this tutorial the author adds scenes as movie clip. So I tried making a movie clip with action script export name the same as my main .as file. When I add it to the scene manually, dragging and dropping from the library, it works. But when I try adding it from a new starting .as file, I get a #1009 error. Adding a test movie clip with the same code works.
I'm trying to create a little adventure/flash movie game.. where you click around on things and something happens, but the main idea is a little quest where you trade items with few NPC's around the game to get to the end..
As an inventory I have plain drawn inventory, and invisable items/movie_clips on it, that only go visible once the NPC's did action of giving you them and making it visible in your inventory spot (I know, stupid but I'm a noob).. The reason for this is cause I wanted the Quest Items to be as Drag/Drop items while giving to NPC's, not just press/dissapear routine thing..
What I'm having problem with is, saving quest items the Character got from the NPC's.. (in other words they dissapear once the character goes back to the FIRST scene/frame of the game) What I'm looking for is a code that can check if in previous scene/frame were those movie clips visible or invisable, and apply that to the next scene.. so that the items/movie_clips wouldn't dissaear when switching between scenes/frames..
here is an example of what I'm doing, but with out the nessasery code for checking, so it doesn't work properly from the second frame and when you go back to the first one again: here is a link for the flash on deviantArt:the codes that I'm using are multiply drag&drop that I found:[URL] Code in frame for multiply drag&drop:
stop(); _root.blue_mc._visible=false; //makes blue ball invisable at start _root.green_mc._visible=false; //make green ball invisable at start
I have a bit trouble with LoaderMax memory occupy, i have a queue, and i am keep loading images depend on user's action. if they click load more and it keep load, but i would like to clean the memory which been occupied by the previous queue (i have remove all the children been added by the loading previously). is there a way i can do it? the behavior like this.
I have an FPS monitor running and notice that I am getting choppiness here and there, bringing my game from 40 to 27 fps and back and forth at certain stages. I have an idea of where it is happening, but do not know for sure. I looked up quite a few memory monitors but haven't found anything decent yet. Is there a memory monitor that allows you to see the memory leaked and find its location? If not, how about just he memory leaked?
I've seen a lot about removing movie clips and I finally want to settle this. What is the proper way to remove a Movie Clip from memory? Right now what I'm doing is: Code: removeEventListener(Event.ENTER_FRAME, step); this.parent.removeChild(this); This is for an instance with 2 private variables and 2 methods (one of which is step). I saw some things about using something = null; and delete something; as well.
I need to create a hundred instances of a movie clip.Is it better to add functions for these movie clips in the movie clip class or in a separate class?For example I have move(), setPosition(), setRotation() functions, would this create these functions a hundred of time and take memory place or just reference the functions?
I am having a bit trouble removing a movieclip properly from memory.In the onComplete event I use this to add the swf content to my clip
[code]....
The removeChild is double here just for savty But the trace command from the clip I loaded continues to put somthing in my output window. So it still keeps running and it isn't even stoping.
I'm making an isometric game and I need to know which takes less memory for scrolling, making everything invisible that you can't see? Like if(!this.base.hitTest(worldHitter))this._visible = false; Or would it be better to remove the movieclips unseen and then reattach them when i should see them?
I'm creating a game at the moment for my university course and it involves the player character jumping on top of boxs twice to break them as opposed to just once.What would be the most efficient/simple way of writing this in Actionscript 3.
I am thinking of developing of a game like this: [URL]... Do you have any idea - by which game engine I may develop this type of games? I am not sure whether I have to use any 3d physics engine? I think JiglibFlash may be useful, but I am not sure.
how to make a game tutorial as farmville game tutorial to teach the user to play the game. i have recently involve in make that kind of game tutorial for its user by actionscript 3
When game page loading , the flash game itself does not appear ( just white area as the holder of the flash game) untill the game almost finish downloading, then it appears .. This long waiting with just white area makes visitors leave, thinking there was nothing there.
well i made a game and in the game there is music at the first frame and when u lose to goes back to first fram and more music plays so they are overlapping.
I want to play a short movie clip at the begining of this flash game. I'm not sure what is the best way to go about doing this. I was thinking to create the clip on its own seperate layers and then just move my action script keyframe that contains all the code for the game after all the frames needed for the clip to play. Or do i need to make it a seperate .fla and just import it, i'm not sure how to do it.