ActionScript 3.0 :: Completely Resetting A Flash Game?
Feb 7, 2011
I've programmed an entire game from scratch, without using class files, and there's no menu yet, and I'm not sure how to reset the game without using class files or resetting every single thing manually.
I'm making a Flash tower defense game with a friend; I'm doing all the code. I'd never used Flash or Actionscript before, so I started off directly programming the gameplay, to figure out if I'd be able to do it. I've done everything from scratch so I didn't know where to start or the "right way" of doing anything, so I figured out as I went along, which went much better than I expected.
So now I've got the gameplay almost completely programmed, the art assets are essentially finished and game looks great and runs (reasonably) well (and the occasional performance problems are due to graphics rather than code), etc. I didn't know how to use class files in AS3 when I started making the game, and when I read up on them and realized you can't import the class files into the project and must open and edit them separately, I was livid and decided not to use them; I was happy with how the coding was going anyway.
So now we've got a game where as soon as you run it, it goes straight to the field and the game starts; we haven't implemented a menu yet. We've reached the point of playtesting and it's becoming a huge nuisance having to quit the SWF and reopen or recompile it every time we want to restart the game, so it's time to program a "Reset" button. I thought this would be as simple as making the stage go to a different frame and back to the first frame, but that doesn't work, so now I'm utterly stuck. It looks like the easiest way to reset a game is to load the entire "game" as an object (or something to that effect, I forget exactly what I've read), then you can unload and reload the game object to reset it? It also looked like it would require class files which I'm hoping to avoid.
I don't think it's feasible to manually remove everything from the stage, reset all the variables, and delete all event listeners and references so everything is reset/garbage collected properly.
Thinking about it more, I'm also not sure how I'm going to get a menu to load before the game in its current state. Maybe I can move all of the gameplay to the second frame and make the menu on the first frame?So, is it possible to reset the game without involving class files?
The above application simply navigates through the five sentences in the DATA array (every time the Next button is pressed). For whatever reason, RichEditableText component doesn't completely reset its view (by clearing the previous text) before setting new content. From what I can gather, this faulty rendering is somehow based on the combination of line count and relative width. I also discovered that if I set the width property of the RichEditableText component to an absolute value (say, 100) as opposed to relative (percentage, 100%) the text is rendered correctly. As far as I can see, this behavior is unintended and is, in fact, a bug.
I am running an online flash multiplayer game. However, I have been facing a problem lately where some users cannot actually completely load all the resources required to run the game. The percentage that users get stuck at is different for different users (for instance, one could get stuck at 43% and some other at 91%). I don't think there is any problem with the files as such because the resources are completely loaded for the majority of the users and the game works just fine for them. Has anyone faced such a problem before?
I'm having trouble reseting a drag & drop game. It is a movie clip with two pages: start_pg and game_pg. On start_pg is a start button (start_btn) that goes to game_pg. On game_pg is button (end_btn) that goes back to start_pg. Both buttons share the same layer, so I made each invisible when not of its page. The game works fine, but when the end_btn is clicked, all movie clips that have been dropped, stay there.How can I go back to start_pg and reset all movie clips to their original starting point?
// start game pagestop(); end_btn.visible=false;start_btn.visible=true; start_btn.addEventListener(MouseEvent.CLICK, goGame); function goGame (Event:MouseEvent): void{ gotoAndStop("game_pg");}
I'm trying to develop a catching game, just for a bit of fun and learning experience. I've been bouncing between tutorials and I've finally come to a point where I can't get any further. After you catch three sandwhiches, you lose and it takes you to an end screen, however, I'm unable to stop the listeners from being called, and when the game restarts, the food falls, but you're no longer able to catch it or keep score.
I'm making a simple platform game in Flash CS5 and Actionscript 3.0. When the player loses all their lives, I want it to redirect the player to a "Game over" screen where they can select a "Try again" button to restart the game.
Set everything (player, background, etc) to visible = false Set "Game over" movie clip to visible = true (it is invisible during gameplay)
Have the button in the "Game over" movie clip hide the movie clip then re-show all the gameplay elements.Reset position of player to start, set score to 0, lives to 3, etc..It's probably not a very good way of doing this but if it works, then I'm happy. I just want the "Game over" screen to show briefly and if the player clicks the "try again" button, they can play from the start.
Now, the problem with my implementation of the above is that when I set all the gameplay elements to visible = true after having them set to false, the game has stopped.. keyboard input doesn't reactivate and the game elements are shown but aren't active. Is there something about the visible attribute I don't know? Does it mess with the "state" of an object? Here's some snippets of code from the Actionscript file...
if(lives >= 0) { //print number of lives }[code]..........
I have written a modal using jquery UI and it appears at the front of a flash movie thus the html inside the modal becomes corrupt, I tried to hide the movie right before modal gets triggered and reappears after closing the modal, works well but each .hide() and .show() the flash movie gets resetted while all I want is to hide (without removing the movie) and displaying it once it is triggered to .show that modal div.
I've got two Actionscript files linked with one .fla file. The file Document.as is suppose to support the keyboard controls and the mouse controls, whilst the Reset.as is suppose to control the reset of the card (this is an interactive birthday card). I've added this on the 'Reset.as' file, however, when the "reset" button is pressed, nothing happens! None of the images move away, or anything! Am I doing something wrong here? All the files have been given instance names! Here is the 'Reset.as' code;
First time poster and new to the board. I have been asked to solve a difficult problem and am seeking guidance in completing the task. Basically, to give you an overview, I need to build a custom tracker that counts how many clicks per month a particular link(s) is/are hit within a website I built. I used Flash (ActionScript 2.0)and XML to build the website along with pulling in external swf files as needed. I have an idea of how to create the MySQL table using myPHPAdmin. I know I want to build an actionScript class to pull into the core swf that holds a majority of the functionality, and to create a PHP file that will pass the info to the simple MySQL database AND send an email out on the last day of each month with the totals from the database. Then I need to reset the database to 0 for each link that we are tracking on the 1st of every month.
My goal is to make it as reusable as possible in case I am asked to follow any more links within the site for documentation. Does anyone have some good documentation, examples, or reference links to point me towards? I have an idea of what I want to do, but I'd also like some other people's input on how they would possible move forward in completing this task.
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 I destroy my objects that are on the stage. I usually just removeChild(this) and I remove event listeners of the object. is this all I need to do to completely remove the object ??
With brush_mc you can brush over a mask, wich turns the pixels to transparent in brush strokes.So visually it erases the mask and the masked movieclip appears. I want to trace, if the mask is completely turned transparent. Is it possible to check if the mask is turned completely transparant without bitmapdata?
// this creates a mask that hides the movieclip on top var mask_mc:MovieClip = new MovieClip(); addChild(mask_mc)
I'm having huge issues with Flash CS5 11.0.2.489 (even to see the version, I had to open the dialog box several times in order to see the version, WTFFF...). I'm working on Mac OS 10.6.6 64 bits. Sometimes Flash freezes (very often) and I have to reboot. Sometimes it goes down on its own.... And when I'm working on my Macboo pro, it just go down 10 or 20 times a day !!!! Sometimes, when I double click on a movieclip and come back to the scene, there is no movieclip left... They have all disappeared. Have to reboot.... And as this F*** software is a piece of ***, I try to save every 5 minutes, but saving takes a loooong time. And in a day, it can be a matter of 1 hour lost..... On the previous versions, I had no real problem.
Flash CS5 is just a pre-alpha version or what? The bug report site should have so much report that mines are surely not read. So I'm here to beg Adobe to do something quickly. This is just not a software made for production.
Is it possible to use JavaScript to detect whether a .swf file has loaded completely within a web page?Assume that the .swf file is pulled from a 3rd-party website and we don't have access to its source code.
I´m loading some MP3 from an external URL. I need to wait to completely load the mp3 and then start to play it. Do you know how can I check when mp3 loads completely? This is my code:
var s:Sound = new Sound(new URLRequest("url.com/file.mp3")); var channel:SoundChannel = new SoundChannel(); channel = s.play();
I'd like to completely erase an onPress = function() statement.delete movieclip.onPress... and it works because no actions happens when I press that movieclip. But the problem is there's still an on press statement but empty, and I can't make any onpress on the inside movieclips.BTW I still see the hand after using delete mc.onPress even if there are no actions assigned to that event.
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.
i have a swf file of width 1000 and height 700. i want to show the swf file in full screen of the browser it self (not like videos plying full screen). i tried like the following
1) get user screen width and height using java script using the functions available (screen.availHeight and screen.availWidth) the screen size is available by using the functions but not applying to the flash object
2) tried giving 100% for both height and width in object code that also not working
I'm using Uploadify to allow for multi file uploading in my web application. It has always worked across IE 7,8, 9, FF 3.6, Safari and Chrome. Today I discovered by accident that it was working in each browser yet not in Chrome. I'm currently on Chrome 10.0.648.82 beta. The issue there is that I can select files to upload, yet after that nothing happens. I put alerts in all Uploadify events and non get fired. Then I went to the official demo site: [URL]
...and discovered that it does not work for Chrome there anymore either. I am running Chrome as default as can be, so it updated to this version itself. I have all default settings intact and no popup-blockers, ad blockers or any other add-in installed. I tried to debug using HTTP Fiddler, only to conclude no HTTP request is made at all after selecting files to upload.
Is there any way to embed Flash completely in HTML, without reference to an external SWF file? I ask because I would like to send an HTML file as an email attachment that the recipient will open in a browser and fill out as a form. The last step is that they will copy the result to their clipboard, paste it into a new message, and email it back. I cannot reliably copy to the clipboard with JavaScript because of the security issues, but there are simple Flash apps to add that capability.
I know I could just display the response text (which will be Base64 encoded) to the recipient and have them copy/paste, but it would be nice to provide this small convenience to them. Also, so you are aware, the text is often too large to include in an email using mailto. Yes. This needs to be done via email. The users have slow, occasional satellite email access and no other data connection to the interwebs. To make things worse, I cannot make them install anything. It is a difficult situation.
completely remove the child of clip at 0 index? I read somewhere you should set to null to all the references to that clip, but I have no other reference in my code. The clip at 0 was added via a regular addChild().
Ok, so I have tried and tried to figure this out. Of course in the test environment everything works beautifully, but when I test my swf on my site, thats when the sh*t hits the fan.
The problem is my buffer bar wont show up until the video is completly loaded. In flash however, it loads across as the video is downloaded, like it's supposed to.
Go to my site to see what I am talking about. The loader bar appears uder the progress bar, exactly like on youtube. www.blankensteincreations.com