Flash AS3 how to reset drag and drop game? - actionscript-3

I am working on a Drag and Drop game in AS3.
How to reset its positions when a new game starts?
I am not good at English T T

well its highly depended on how you're game is developed but an easy way is to have an array on the document class that contains all the positions and initialize the position when beginning a new game

Related

Flash Game objects won't go away

I have a flash movie with a interactive game in the middle. The game is a simple drag and drop with a target.
Now to my problem:
When the user plays the game the drag and drop symbols stays in the target spot on the next frame to the end of the movie.
I would like them to disappear after the game is over.
I am a noobie to actionscript 3.0 - is the a code i can implement on the frames after the game to make sure that the objects wont showup.
Thanks..
Frame navigation does not affect objects that were created by code (or even objects that were created by frames but modified by code). So you need to manually remove them via removeChild().

animation does not start in actionscript 3.0 (flash cc)

I'm very new to using flash and actionscript 3.
I've created an animation in my timeline which works when I test the scene & play. However, when I get to testing the movie, a lot of the scenes fail to start the animation.
I've put some basic code into my actionscript which are the basic gotoandstop buttons to allow me to go to another scene.
Hope someone can help!
Id say that using the built in 'scenes' at all in Flash are a bad idea(ever). You can do this much easier by creating each of your animations in their own MovieClips and placing those clips on their own frames on the main timeline, then simply using gotoAndStop() on your buttons to navigate between the frames you have your animation MovieClips on. - Good Luck!

How to put code onto objects in as3

I am trying to create a kind of simple game where you move a player around and dodge some enemies. I was wondering if it was possible to add code onto a object in as3.
I want to be able to put code onto an object and not on the main timeline, so when it is on the stage, it will carry out the codes.
Sorry if this is confusing, I don't know how to explain it.
Each MovieClip object has its own timeline. Create a layer for code in your object's timeline and add actionscript in the usual way to it -- using the Actionscript panel.
You can start with a simple 'trace' statement to see that it works.
Please do not put code on the timeline.
Read a tutorial about Object-Oriented Programming in AS3. Learn about Document Classes and how to attach a class to a library object.
Here's a link to one of the first tutorials that popped up when I googled "Flash oop tutorial": http://code.tutsplus.com/tutorials/as3-101-oop-introduction-basix--active-5789

ActionScript 3 Best place to bind events

I am writing a small Flash game using air for android and have encountered a slight issue.
The game has 3 screens (excluding the game screen) which are main menu, load game & create new game. On the load game and create new game screens I want to add a button which take the user back to the main menu.
I know how to add event listeners to buttons but I am wondering where do I bind the event listener for back to main menu, binding in the constructor of my main class produces an error at run time and binding after going to the frame is knocking out the other buttons when back at the main screen.
At present the app is across multiple frames (probably a better structure to this instead of loading a single frame with each menu), I am new to actionscript so I am not entirely certain on best practices for this sort of thing.
Thanks.
I recommend you to use only one frame in your Fla, then use a Document Class. In that main Class, you should place all your display objects using ActionScript.
I hope you know how to instantiate Class as library clips.

AS3.0 Replay the whole movie (*SWF file)

I made a small game in Actionscript 3.0 and flash.
When the player wins the game or is 'game over' the player should have a option to replay the game.
So my question is: Is there a way to replay the whole movie with Actionscript? I know, i could reset the timeline back to 0, and re-instantiate all the classes, movieclips, var's ect... but i was wondering if anyone knows a easier solution.
Simply do this:
import flash.net.*;
//...
navigateToURL(new URLRequest(stage.loaderInfo.url), "_level0");
You can remove the swfObject and add it again. Look here. This is the swfObject reference.
Reload the page, where you've embedded the swf into, may be the easiest way.
The programmers way would be to encapsulate your whole application into a single class (extending Sprite or MovieClip) which will be attached to the stage. For restarting the game you could simply remove that instance from the stage and add a newly created onto the stage.
Or make a loader swf, that loads your game. Then if the game should be restarted, discard (unload) the instance and load it again.
Its hard to tell you what you can do, if we don't know, how your project is structured.