ActionScript 2.0 :: Limit A Drag Function To A Single Direction?
Dec 6, 2010how to limite a drag function to a single direction? which means I only can drag the button to left, it won't be able to drag to right.
View 4 Replieshow to limite a drag function to a single direction? which means I only can drag the button to left, it won't be able to drag to right.
View 4 RepliesHow can i make an object draw progressive lines by limiting the length of the line and the controlling the direction in which it must be drawn??
View 2 RepliesI have some movie clips. i want to drag all clips when i drag single movie clip. Ex. I have movie clips "A1", "A2", "A3", "A4", "A5" . Randomly visible some of them. Suppose "A1", "A3", "A4" has visible. When i will drag "A1" movie clip all these "A3", "A4" also move with "A1".
View 6 Repliesis there a limit to the amount of things you can ask AS3 to do in a single frame? right now i have 10 buttons in a frame, each pulls a url for a link from an external xml. however, they only actually link if only 5 of them exisit in as3.
View 1 RepliesHow can I limit flash movie to work only on single domain. For eg what I need to do if I want flash swf to work only on [URL]and it should not work if -
1. opened/embedded from other [URL]
2. Downloaded
3. opened in embedded IE Activex Controls
I have had the following problem for a while and i cant find any solution on google.I have the following and what i want to do is only allow the object current_switch_selector to be dragged in a horizontal direction but when i use the following for example it doesnt work
var bounds_rect:Rectangle = new Rectangle(0, 0, 17, 10);
trace(bounds_rect);
current_switch_selector.startDrag(bounds_rect);
[code]....
Is it possible to rotate movieclip, while dragging, according to mouse direction and mouse x, y on that clip.
on the picture the 0, 0 of the mc containing red box is where the lines cross, the mouse point is indicated with cursor and around it is the circle where clip's x and y should be constrained and movieclip should rotate according to mouse movement direction for example: when mouse is moving straight down then the clip's x, y rotates up and stops when its 12 o'clock...
I have an application where a user uploads an image and then transforms it by clicking, dragging and using a resize bar. But my client has asked me to limit where the user can drag to, this is not a problem except I need the limits the opposite way around to what would be considered normal.
So where I have startDrag(false, new Rectangle...) that works just fine, but what I need is to let the user be able to drag outside of the boundaries and not have white space on the inside of the flash file.What I mean by this is say I have a 500px wide flash file and an image inside it which I'm carelessly dragging around. If the images right hand edge (if I drag left) hits 500px it stops dragging and does not allow them to pull it any further left.Below is the code I currently have for the drag events.
public function startImageDrag (e:MouseEvent):void {
mousePos['x'] = e.target.mouseX;
mousePos['y'] = e.target.mouseY;[code].....
I have an idea that I want to test out but need some information. Is it possible to limit the way you can drag a sprite with the startDrag()? For instance, say I have a square sprite that I only was to be able to drag vertical or only horizontal.
View 7 RepliesIm trying to think how i fix this problem. i have a map at the stage and its big, i need to click and move it. But when i get the final of the image, i continue move it and appears the stage.
How i lock the image when it get the final to dont appear the stage? the cod that im using is:
map.addEventListener(MouseEvent.MOUSE_DOWN, move)
map.addEventListener(MouseEvent.MOUSE_UP, drop)
function drag (e:Mouse Event)
{ e.target.stargDrag();
}
[Code]...
I need to limit dragging when user drags out of the Stage. [code]...
View 1 RepliesI am working on simple flash game in which there r 8 small circles out side of one big circle. i want to drag this 8 small circle one by one to the big circle.Basically 1 plate with their food items.Draging their food items to he plate. i hope this would give you a better idea.I have goggled it the same thing but could not get what i want,
View 1 RepliesHow can I use a single set of drag commands on a series of movieclips? mc1, mc2, mc3, for example.
View 4 RepliesI have a function that states when movieclip1 is dragged and hits a line then it stops the drag, however it seems to stop the entire drag function in the swf on the other movieclips even though they arent called in the function.[code]
View 1 RepliesI have one movieclip inside which I created few movieclips...I applied drag drop functionality to main movieclip with which all movieclips inside of it also get dragged along with it..and I want inside movieclips to act as buttons meaning on clicking perticular movieclip it should perform perticular event assigned to it... How to make movieclips into buttons and the main movieclip containing these buttons with drag drop functionality?
View 2 RepliesI want to create an interactive learning module that would use a simple drag and drop test. I've already browsed the net for guides and it led me to monkeyflash.com that gave me a very helpful guide. On the guide, there can only be one object be dragged to a target. But then, I wanted my test to have multiple objects (movie clips) be dropped on a single target (also a movie clip) only and stick to it. I'm thinking that I could place my draggable objects on an array, but I really had difficulty on executing this.
On the code below, a drag object can only be placed on one target only (i.e dragIn1 can only be dropped on targetdragIn1 but not on targetdragIn2). Yet, I want all dragAt objects be dragged on all targetAt, dragIn with targetIn, and dragOn with targetOn.
[Code]...
I've been trying to do a drag and drop game, the logic of the game is that I have 4 blocks grey1_mc, .
grey4_mc, and 8 targets target1_mc,target8_mc.Now, grey1_mc can be dropped only on targetgrey1_mc and targetgrey2_mc, similarly grey2_mc on targetgrey5_mc and targetgrey6_mc grey3_mc on targetgrey1_mc and targetgrey2_mc grey4_mc on targetgrey5_mc and targetgrey6_mc
when grey1_mc or any other greyBlock hits it assigned target it should be locked onto the target and should not be clickable. Also it should play a movieclip inside of it i.e., a Green Tick Mark. if grey1_mc hits any other target it should lock on to that target play a " Red Wrong Movie" and then snap back to its original position.
similar functionality is going to be used for the rest of the grey movieclips.the code that i've written is this...
var originalX:Number;
var originalY:Number;
var greyBox:Array = [grey1_mc, grey2_mc, grey3_mc, grey4_mc];
[code]...
I'm doing a project where I have a movieClip grey1_mc and I have 2 white boxes, which are also movieClips white1_mc and white2_mc. What I want to do is to add a Drag and Drop functionality such that, grey1_mc can lock onto white1_mc if droped on white1_mc, also grey1_mc can can lock onto white2_mc, if dropped on white2_mc. And the usual snapping back to original position if placed elsewhere on the stage.
This is just for one movieClip grey1_mc. I've got 4 such movieClips
[grey1_mc, grey2_mc, grey3_mc, grey4_mc,] and 8 targets
[white1_mc, white2_mc, white3_mc, white4_mc, white5_mc, white6_mc, white7_mc, white8_mc,] ,....
So, grey1_mc can hit white1_mc or white2_mc.
grey2_mc can hit white3_mc or white4_mc.
grey3_mc can hit white1_mc or white2_mc.
grey4_mc can hit white3_mc or white4_mc.
MovieClips white5_mc to movieClip8_mc are only to show a error message in the o/p window.
I'm pretty new to Flash and seem to be struggling with variable scope, events and where to put code within movieclips/main area etc. What I'm trying to do is produce a Flash movie that will allow the user to click on a tool from a selection, i.e. a circle, then click on another part of the screen to place the centre of the circle, with a second click to set the radius of the circle (an alternative would be a single click and drag to place the circle and drag it out to the desired radius.) Once the mouse if clicked a 2nd time, or the drag operation is completed, the circle will stay at the selected radius.
The code I'm using so far to test out the idea is below:
_root.onEnterFrame=function(){
_root["item1"].onMouseMove=function(){
d = Math.sqrt(Math.abs(_xmouse-this._x)*Math.abs(_xmouse-this._x)+Math.abs(_ymouse-this._y)*Math.abs(_ymouse-this._y));
if(d<370){
this._width = d*2;
this._height = d*2;
}else{
this._width = 87;
this._height = 87;
}}}
This uses a simple circle movieclip, and the above code is placed in Frame 1 of the background as opposed to the movieclip itself. It resizes the circle movieclip ok, but I want to be able to control the resize with the mouse or with a single click/drag.
I have a function ( basically its the click on a reset buttons ) that sets back quite a loooooot of variables and text boxes. But after ( I think 200 lines ) , actionscript simply stops with that particular function and doesnt even give me an error.So it looks like there is a lines per function limit or something like that.I also tried it with an external .as but its the same.Creating functions for all these commands didnt work either.The only thing I can do is move a few lines up so that they get processed earlier.... ( but the last few still don't work )I even tried to make a function with 300 lines of myTextField.text = "hello"and a line: myTextField.text = "how are you" at the endDidnt work... it stayed at hello.
View 1 RepliesIs there a limit for how many statements I should put in the same function? I have a function that takes care of all of the code for a movieclip and it's up in 16 "if statements" allready, should i split it up in more functions or not?
View 3 Repliesi have a scroller developed in as2. it basically scrolls continuously in a direction until the direction of the mouse is changed. the images of course loop in the continuous scroll. now the problem is that for 10-15 photos its ok. but when i feed it with 180 photos, it seems to show only 11. why would this be? any restriction on flash ??
View 1 Repliesi'm searching for a function that return the mouse movement as Cardinal Point.In other words i would like to have as returned value, if mouse is going from down to top, North, if mouse move from left to right, should return East ... and so on
View 3 RepliesI'm wondering if there is a limit as to how may if else you can put in a function. I have a form that never seems to fire the last if else on the first load. It will work once I've run through the form, and all of the times after that, but never on the first try. In other words, when I test the form for the first time, if # 5 never kicks in. But after the form has sent, I can run the form again and if # 5 will work like I want it to. I did add .tabIndex to the form because it wouldn't originally tab the way I wanted it to and I wondered if this might be part of the problem. I also tried moving the if else statements around, but that didn't seem to make any difference. Does it only read 4 if's at a time?
Here's the code:
// add evenlistener for submit buttonsubmit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
function ValidateAndSend(event:MouseEvent):void{
// if #1
if(company_txt.text ==""){
company_name_mc.gotoAndPlay("red");
[Code] .....
I have the standard dragWindow function in an app I am building:
private function dragWindow(evt:MouseEvent):void
{
stage.nativeWindow.startMove();
}
I want to limit the "scope" of this function such that it is not enabled within specified components, e.g. datagrids, scrollable lists, etc.
have a ball with the name of mc which can be moved using the keyboard .. when you press the left mouse button shoots the ball, this ball and the other flies in the face where the cursor was in the shot .. but if you move the cursor to another location and shoot a second time then the second ball is also flying in the direction of the cursor and the first ball change direction toward a second shot ..
ActionScript Code:
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.events.MouseEvent;
[Code]....
how to make that first ball did not change its direction and continued to fly in the direction of the shot?
I have problem with the setInterval function. I have a game application that sets a time limit of 3 minutes. From 3 minutes counting down by 1 second up to zero. The problem is, the counting of the timer is by 2 seconds and sometimes by 4 seconds. I tested the movie in my local computer and looks fine but when I upload it to a server and it is embeded in a website. And by the time the user clicks the link to play the game application and starts playing the problem about the timer occurs.
View 6 RepliesI have the following scenerio, a main.swf which loads swfs on top, code below
stop();
var Xpos:Number = 0;var Ypos:Number =0;var swf:MovieClip;var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest("swfs/home.swf");
[code].....
My problem is that I am trying to use the following functions on 10 different logo movieclips. Each logo movieclip has a popup up box (another mc) within its timeline with a description in. When I hover over the logo movieclip i want it to call the forward frames function and on hover out call the rewindframes function.
function forwardFrames() {
onEnterFrame = function () {
if (_currentframe != 15) {
nextFrame();
[code]....
I have 16 movieclips, each with different instances and linking to htmlsI owuld like to have it so that when you ROLL_OVER a movieclip, they shift position 1 along the x and 2 along y axis.I've given each MC a ROLL_OVER event listener and know I could call separate function for each but I'm sure there's an easier way.This is what I have already have
Mc1.addEventListener(MouseEvent.CLICK, go1);
Mc1.addEventListener(MouseEvent.MOUSE_OVER, nudge);
Mc2.addEventListener(MouseEvent.CLICK, go2);
[code]......