ActionScript 3.0 :: Dynamic Text In Simple Drag & Drop Game?
Aug 24, 2010
So Im working on a very simple drag and drop flash game using AS3. Everything is complete but I'm having an issue with the dynamic text. For some reason when you drop the item onto its target and accompanying dynamic text is all effed up.. for example when it should say "Try Again!" it says "r ain!".. I've been banging my head for the last few hours with no luck..And here is my code:
I'm doing a simple drag and drop number game for kids. Once the user places all the numbers and presses the go button (btn_go) how do I get a another button appearing after the user has click the go button?
I have a drag and drop game where each movie clip is a word that the player has to arrange on screen in a certain order of importance - there is no snapping mechanism and the user can place the words anywhere desired.
Later in the game, I need this list of words to appear in the order that the player previously organized within a different scene.
This is an example code of how I set up the drag and drop game:
//Array to hold all the puzzle movie clip instances. var burgerArr:Array = new Array (burger_mc, burger2_mc, burger3_mc, burger4_mc, burger5_mc, burger6_mc, burger7_mc);
So I'm trying to make a game where you have to complete a text with words (or expressions) from a stock. The text would be full of holes and to fill those holes you'd have to drag and then drop words contained in a stock. A bit like this:
[Code]...
Now I know this is possible, I have seen it (in flash) already... but I have absolutely no clue how to go about coding it myself. What I find particularly difficult is having a drop zone in a middle of a text. How do you use the hitTestObject function with just text??
I need to have drag and drop functionality on a dynamic text box. I searched and from my understanding Flash does not allow startDrag() and stopDrag() on a text box. Am I correct in saying that I have to somehow embed the text box onto a movieclip and drag the movieclip? If so, how can I embed a text box on a MC in this manner?
I want to make a jigsaw puzzle wherein a text box tells the user/player if the designated piece is in a correct/incorrect place. If it's incorrect, the piece would return to it's place from where it was dragged from.
So I'm doing this project and as an animator I'm not familiar with the whole action script side of flash.Okay so far I've managed to create the whole Drag and Drop feature and it works well, the thing is I want to make it so when you drag in object in the correct spot and new text appears, and I need like six different object with six different text. but I have no idea how to integrated it in my code or where I should start!
I have been making a memory game, where words are shown to the user. Once they have memorised the words they go to the next screen where the words that they have memorised are shown. They then have to drag each word into a "correct" place and a "wrong" place. I now want to edit it so that I can use two arrays one for correct words and one for wrong words. I want to generate random words from each of these arrays. I have sort of worked out how this is possible to do but using dynamic text, but am I correct in thinking that the whole dragging the words thing is not possible with dynamic text. (I may be wrong though, I am quite new to flash).
I have 20 squares, each one has a different number(1, 2, 3, etc.) The number is in a dynamic text box which is centered above the square( the square is a Sprite object called "MySquare".) I would like to make the squares drag and droppable. When I test the movie, the arrow cursor becomes a vertical line when over the number. I can click on the edge of the square but then the cursor automatically goes to the center and the compiler returns the error: property StopDrag not found on flash.text.textField.
Here is ActionScript Code: var startX:Number; var startY:Number; var m1:MySquare = new MySquare(); m1.theText.text="1"; addChild(m1); [Code] .....
I'm really new to AS3 and could use some help. I have a movieClip with a drag and drop functionality that's working fine but then inside this movieClip is a dynamic text field and it won't let me click over the text field to start dragging and if I click off to the side I can drag but the movieClip is automatically centered and then I can't drop because now the text field is under the mouse and it keeps saying:
ReferenceError: Error #1069: Property stopDrag not found on flash.text.TextField and there is no default value. at MethodInfo-10()
Why is AS3 so finicky? I'm clicking on the MC for the love of $(*%@ not the text field. Errr..
I want to implement drag&drop possibilities in my application. Here is my source code:I added images to the container, and now want to be able to move them from element PieceContainer to element board (defined in the another class). I tried to define mouse move handler as it was shown here: http[url].... but it doesn't do anything... Actually I don't understand how should I define drap initiator, and drop handler
public class PieceContainer extends Canvas { //private var image:Image = new Image();[code]..........
But actually have 2 problems:First: Items are draggable, but when i add them to board they stays on in the PiecesContainer.Second: I want items to be copied, rather then just moved (but when they are on board they should be movable, not copied)
I am developing a simple drag and drop game..except my draggable items are in a movie clip and my targets are also in a movie clip. My draggable objects work fine, they drag and snap back into place when the mouse is let go, but... they dont snap to their targets.They do snap to their targets when they are directly on the timeline, but inside another movie clip it doesnt work and i can't figure out why.[code]
I have a very simple question, but I can not find solutions to it. I need to add multiple images that can be moved with the mouse. This components NumericStapper must be in the group with the image and move together.[URL]
[URL]In this sample the words (candid, camera) are split into letters and the user is supposed to put a word together based on those letters.The way I need this to work is like this:For example the word is: flashbynight The user should be given these options: flash, night, by I need to provide the user with words and not individual letters.
So what I nedd is simple - how to create a drag and dropable circle with flex 4 and AS3 and using Box2d make it fly some more in the direction of drag and than stop?
This is the accompanying thread for the tutorial "Drag and Drop game with ActionScript 3". Here you can post comments, questions and suggestions related to the tutorial. If it's not completely related to the tutorial, start a new thread. The tutorial will be available soon. You may subscribe to this thread (in the "Thread Tools" dropdown menu) in order to receive a notification when the tutorial goes live.
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 adapt the memory game in chapter 3 of the book "ActionScript 3.0 Game Programming University" for my own uses. I want to get all of the cards to flip and drag.I am able to flip the first card and drag it, but when I flip the second card over, I can't drag it. I have two files, MatchingGameMe.fla and MatchingGameMe.as. All of the actionscript is in MatchingGameMe.as. Here is the code. Does anyone see how I can modify it so that all the cards drag?
I'm trying to adapt the memory game in chapter 3 of the book "ActionScript 3.0 Game Programming University" for my own uses. I want to get all of the cards to flip and drag. I am able to flip the first card and drag it, but when I flip the second card over, I can't drag it. I have two files, MatchingGameMe.fla and MatchingGameMe.as. All of the actionscript is in MatchingGameMe.as. Here is the code. Does anyone see how I can modify it so that all the cards drag?[code]
I am trying to make a drag and drog game that also has hit detection. Everything is working except the end of the code where I am trying to make something happen once all four functions are true.
Here is my code: import flash.events.MouseEvent;palm.stop()sun.stop()birds.stop()turtle.stop(); palm.buttonMode=truesun.buttonMode=truebirds.buttonMode=trueturtle.buttonMode=true birds.addEventListener(MouseEvent.MOUSE_DOWN,startDragging);birds.addEventListener(MouseEvent.MOUSE_UP,stopDragging); palm.addEventListener(MouseEvent.MOUSE_DOWN,startDragging); [Code] .....
I am tryin to create a drag and drop game for children, i am using Flash actionscript 1.0 but on CS3.
The game is about dragging images such as a apple to the letter A and a ball to the letter B etc.
I am having problems making the image lock to the letter if it is correct. If the image is dragged to the incorrect letter it should go back to its orignal place.
At the moment the image can be dragged but it does not lock to the correct target instead it goes back to its original place even when it is dragged to the correct target.
I am having been building a drag n drop flash game where you need to drag pictures of organisms into their position on a food web. The code was working when it was a simple food chain with each animals only have one position on the chain. I have no decided to make it a more complex and have things such as plants, having a couple of different positions in the chain. I have decided to try this using an array for each of the sets of pictures. At the moment the pictures can be picked up and moved around the screen, but not placed on any of the targets that I have put on the screen. My other problem is that the following error keeps coming up whenever I go to the frame.TypeError: Error #1010: A term is undefined and has no properties. at foodweb_fla::MainTimeline/activateDraggables() at foodweb_fla::MainTimeline/frame6()I have been trying for a couple of days now to work out whats going on withoutmuch luck due to my very average flash skills. The coding that I have done so far is below:
[CODE] stop(); var startX2:Number;var startY2:Number;var counter2:Number=0;
I am designing a simple classify drag and drop game, but I got several objects and targets, for example square shape object can only go to square shape target, however when I have 2 or more square, then the square2 and square3 can not go to square target!
Code: var objectoriginalX:Number; var objectoriginalY:Number; var counter:Number = 0; triangle_mc.buttonMode = true; triangle_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject); [Code] .....
I am tryin to create a drag and drop game for children, i am using Flash actionscript 1.0 but on CS3.
The game is about dragging images such as a apple to the letter A and a ball to the letter B etc.
I am having problems making the image lock to the letter if it is correct. If the image is dragged to the incorrect letter it should go back to its orignal place.
At the moment the image can be dragged but it does not lock to the correct target instead it goes back to its original place even when it is dragged to the correct target.
I am having been building a drag n drop flash game where you need to drag pictures of organisms into their position on a food web. The code was working when it was a simple food chain with each animals only have one position on the chain. I have no decided to make it a more complex and have things such as plants, having a couple of different positions in the chain. I have decided to try this using an array for each of the sets of pictures. At the moment the pictures can be picked up and moved around the screen, but not placed on any of the targets that I have put on the screen. My other problem is that the following error keeps coming up whenever I go to the frame.
TypeError: Error #1010: A term is undefined and has no properties. at foodweb_fla::MainTimeline/activateDraggables() at foodweb_fla::MainTimeline/frame6()
I have been trying for a couple of days now to work out whats going on withoutmuch luck due to my very average flash skills. The coding that I have done so far is below:
Code:
stop(); var startX2:Number; var startY2:Number; var counter2:Number=0;
i cannot snap the object into its origin. I've made two AS for this one, a DragDrop as and a DragGame as.[code]I just don't know where to put the code that could make the objects snap to its origin.