ActionScript 3.0 :: Possible To Click And Drag Line To Change Its Length?
May 23, 2011I am totally new to Flash. I want to be able to draw a line and then be able to click on it and drag to change its length.
View 2 RepliesI am totally new to Flash. I want to be able to draw a line and then be able to click on it and drag to change its length.
View 2 RepliesI have just started using Flash and I tried to make a game where you click and drag to draw a line. If that line hits the enemy, the number in a text box to the right should go down. When I slash at the enemy, and it hits him, he gets damaged, but sometimes, when I don't hit him, he still gets hurt. Download the attatched file and try it out.
View 1 RepliesI'm trying to produce a game that on mouse down a dotted line (or just a line) gets dragged out following the mouse until it is realized then it disappears.
View 1 RepliesI want to attach some script to a button that will increase the length of a line (movieclip) by x amount each time.I have tried using this :
on (press){
this.line._xscale=this.line._xscale+5
}
[code].....
I am still working on my pulley sim. I have two wieghts hanging from a pulley. When the user drags one down, the other move up accordingly. I am trying to figure out how make the line that represents the rope grow and shrink as the weights move. I have drawn the line like this:
var lineW:MovieClip = new MovieClip();addChild(lineW);lineW.graphics.lineStyle(1);lineW.graphics.moveTo(178,127);lineW.graphics.lineTo(weight_mc.x,weight_mc.y);
But I don't know how to change the length. I tried redrawing the line in the Enter_Frame function that moves the weights but it only adds to the line without shortening it.
I was woundering is it possible to measure the length of lines that are drawn with scripts such as these? The ones where you can draw with the mouse? [URL]
View 2 RepliesI am wanting to position a large close-quote graphic relative to the end of the last line of text in a text field. Is there a way to use textWidth to find the width in pixels of just the last line of a textField?
View 1 RepliesI have learned from a video tutorial (Flash CS5 in the Family 23: Banner Ad Part 1)to use the F5 key to set the length of a time line of a particular image.When using the F5 key on the MAC keyboard, it will only allow for the audio to be worked with.I've tried Apple+F5, Option+F5, Ctrl+F5 etc.What am I missing?
View 1 RepliesI have a line which is stage.stageWidth long.Now i need in enter frame to shorten this line (like an reverse preloader, but its not a preloader) so that in given time value its length becomes 0.so from stage.stageWidth to 0 in given time.
View 8 RepliesI want to have an image and when I click on the image ,one can hold down the mouse and drag a copy to where ever on the stage and when one lets go, one can drag another and another with each copy still being able to be dragged after released.this is what i have but its pretty simple and doesn't work....
stage.addEventListener(MouseEvent.MOUSE_DOWN,makeA Box);
var i:Number = 1; //i will be the total number of boxes
var newBox:myMC = new myMC();[code]....
Does anyone know a way, to return the length, preferably in pixels, of a specific line in a multiline textfield. In this case, I need to know the length of the last line.
View 1 RepliesI have an input text box and need to control the line length max char 20 for each line using AS3.
View 2 Repliesi have a slideshow with a delay of for example 3 seconds, and a preloader which is a line with a 100px final length.i start preloading next image.now if the time until next image loads is longer than slideshow delay, i will show next image as soon as it loads.if the time until next image loads is shorter that than slideshow delay, i want to wait additional time until delay and then show the image.the problem is how do i represent smooth line width grow (being enter frame or tween) by calculating/comparing 2 values together (delay and loader percent, which goes from 0 - 100) ?if my line growth represent just a slideshow delay, then when it gets to an end, if next image still hasnt loaded, then it wont look good if line has come to an end, but i still have to wait.
View 4 RepliesI've managed to follow some drawing tutorias which work fine (mouse down draws a line everywhere you move mouse like MS paint).I would like to adapt this now if I can so that when a user clicks down, a straight line will follow their mouse until they click again and this releases the straight line. This should leave one line on the screen, then they are free to move their mouse and repeat the action again.
View 6 RepliesI'm using the following code to delay my movie a set time for each frame:
[Code]...
This works fine but I want to be able to change the length of the delay for each frame. I've tried alsorts but my as3 knowledge is limited
I know you can restrain an mc in a rectangle when using startDrag, but is there a way to have the mc only go horizontal or vertical without going off diagonally? Sort of like a slider that can only move in a straight line in four directions (like a cross).
View 4 Repliesi make a drag and drop function .i want draw a line from drag to drop.i have done this with AS2.0 but i couldn't did in AS3...
var score:Number = 0;
var startX:Number;
var startY:Number;[code]....
I was wondering if there was anyway to put a line between two or more dragable objects... The only example I can think of is [URL]
View 8 RepliesI have the following code which create a small drag and drop interaction, with a connecting line being drawn between the two elements. I want to add a Submit button to the mix to allow the user to complete the interaction and then find out which ones where correct and which ones were wrong. Removing the lines from the incorrect ones and leaving the correct ones in place. I've tried setting up a function to switch some variables to true when the interaction has been completed succesfully but am coming upstuck...
Actionscript Code:
var score:Number = 0;var startX:Number;var startY:Number;var startLineX:Number;var startLineY:Number;//set up variables for true/falsevar circleMccomp:Boolean = false;var squareMccomp:Boolean = false;var errowMccomp:Boolean = false;var polygonMccomp:Boolean =
[code]....
anyone can u explain how to drag a movieclip on a diagonal path..?
View 2 RepliesI have a component where I expose the property 'questions' with the following code:
private var _questions:ArrayCollection;
private var questionsChanged:Boolean;
[Bindable("questionsChanged")]
[Code]....
In this component, I use commitProperties() to implement my logic.
I use Cairngorm and the 'questions' is in the model and hence it's defined as a source for data binding.
When the 'questions' ArrayCollection's size changes elsewhere in the application, it is not invoking the setter method in the component that is destination for the data binding.
I would like to drag an object in one line. I already know how to do this in a horizontal or vertical line
Here's how I do this
private var handle:Sprite;
private function init():void
{
handle = new Sprite();
[Code].....
But I want do drag my object in a line that isn't horizontal or vertical.
For example, I would like to drag the object from the top left corner to the bottom right corner, in one straight line.
I tried to rotate the bounds rectangle, but it seems that you can not rotate a Rectangle.
How do I drag an object in a non-vertical (or non-horizontal) line?
Let's say I have array foo and a positive integer y, where foo.length > y.I want to remove elements from foo so that foo.length becomes y (or very close to it).Also, I need to preserve the first and last element of foo. The indices of the removed elements must be spaced apart as equally as possible. Foo can be sliced, or it can be used to create a new array.
Example: if foo = [a,b,c,d,e,f,g,1,2,3,4,5] and y = 6, then trimmedfoo could be [a,c,e,g,2,4,5] or maybe [a,c,e,2,4,5], but not [a,c,e,g,2,4] because the last element of foo is missing.
how to do this
function foo(x:*, ...args):* {
}
function bar(x:*, ...args):* {[code].....
how to expand args ? when I call bar(1,2,3), I wish it call foo(1,2,3), but it call foo(1,[2,3])
Is there any way to determine if a (anonymous) function has defined the ...(rest) parameter in ActionScript 3? I know there's the function.length property, but it only counts the explicitly defined arguments.
View 2 Replies1. i am trying to drag and drop movie clips with a short video clips in it(inside movie cilp), on to another square target "tv" with buttons play stop etc.
2. on this square "tv" i want to be able to view the clip i just drag to the "tv" to (manipulate the clip with play stop on so on) and the same thing with the other clips
3. after that i want to drag the movie clips or another movie clip of the same to a time line with other movie clips and be able to play the time line with the editing movie clips as a new entire editable video clip
I am trying to get the length of arrays within an array, here is my example (MX 2004):
[Code]...
I get an output of of 3. the number of variables within the first array, this is not what I had expedted.
am hoping someone here might have some source in the little bag o' trix that will put me on the right road to achieving the following. i am trying to work out the best way of creating a movie that has buttons that when clicked will zoom into and centre a certain area of a larger movieclip?
and then a way of dragging the zoomed into movieclip around the stage area? or panning using x/y positions of the mouse. (and without asking for the moon on a stick - if the user clicks on a empty part of the zoomed mc - it zooms back out to it's original size position?)
any have any fla files or know of any good tut's or threads that can will give me a leg up to get it working? fingers crossed has done this before or know a good place to start?
I'd love to know how to make click and drag two different things. As it believes the drag function is also a click. Also I'd love to know how to set it so that ALL movieclips stop when they reach say -10px from each side?
View 2 RepliesI have a movieClip on stage.I wanted to make it so that you can click on stage and drag and if you drag up and right value increases and if you drag down and right value decreases.So that I can resize the movieclip (scaleX & scaleY) based on that dragging.
View 2 Replies