ActionScript 3.0 :: Any Way To Make StartDrag Function Work Better?

Jan 13, 2010

When you are dragging a movieClip on the stage, it generally works fine. But if you are performing some calculation or hitTest while you dragging, the location of the cursor and the movieClip starts to go unsynched. For example, in the following code, I am running an ENTER_FRAME handler while you drag a box, and this onEnterFrame_Box method contains a bogus for loop to slow down the process. The drag & drop works snappy if you comment out that for loop... But if you bump up that 100 to something like 200, Flash Player runs quite slow, and the location of the box won't match where your mouse cursor is...

ActionScript Code:
var box:Sprite = new Sprite();
box.graphics.clear();
box.graphics.beginFill(0xCCCCCC, 1);
box.graphics.lineStyle(1, 0x999999);
box.graphics.drawRect(0, 0, 100, 100);
[Code] .....

View 2 Replies


Similar Posts:


Flash :: Canvas Moved On StartDrag() Without Calling Set X / Y Or Move() - How Does StartDrag() Exactly Work In As3 / Flex

Feb 11, 2011

i have an .as class that extends mx.containers.Canvas (it's a draggable border of a resizable component), it becomes draggable on MOUSE_DOWN and stops being draggable on MOUSE_UP, MOUSE_OUT and ROLL_OUT. before calling startDrag() i create a Rectangle to define the drag area, i also have a _dragging: Boolean variable to control if it's draggable at the moment. the problem is that when i click this border it jumps to a negative coordinate without calling startDrag or switching _dragging to true.

i've overriden get x, set x, get y, set y and move() methods in order to solve it but the only thing i got was the fact that position changes without calling coords setters or move(), but at the moment it's changed a getter is called and returns new (negative) value so my question is what happens on startDrag() and how to filter unwanted incoming coords values?

View 3 Replies

Actionscript 3.0 :: Get RollOver To Work With StartDrag?

May 9, 2009

I have 10 objects on the stage, 5 of those should be draggable objects and have a target object to be dragged to named the same as the object, only adding "target_" first. So "objectA" should be dragged and dropped at "target_objectA". And the target objects have a rollover function inside that simply highlights the objects on rollover. But since the rollover functions does'nt work when the mouse is dragging something, I had to set the "mouseEnabled" to false. But then again, flash will not recognize my mouse_up to run the "dropObject" function I've created, which drops the object at the position the mouse is at that time.

I just cant figure out what to do, and I need to keep the functions so that all dragobjects can run them, because later on I'm going to add alot more. How can I get the rollover, startdrag and stopdrag to work all together?

Code: Select all//Imports and Stops
import caurina.transitions.*;
stop();
//Variables

[Code].....

View 1 Replies

ActionScript 3.0 :: StartDrag Doesn't Work With RotaionX Or Y?

Jun 8, 2009

I'm facing a strange problem, I'm using CS4 and AS3 and I got a text scroller that uses startDrag,I wrap all this in a function that handles a sort of 3D roationX with rotation and rotationY,why is the startDrag not working when rotationX or Y are used ?

View 4 Replies

ActionScript 2.0 :: Cant Make Function Work

Jun 1, 2004

I was reading Kirupa Chinnathambi's function tutorial and I was trying to make my own function, but it's not working! Here it is:[code]

View 9 Replies

ActionScript 3.0 :: Using Rectangle In StartDrag Makes StopDrag Not Work

Nov 9, 2009

I have a pretty simple function here where I want to start dragging a video scrubber along the x axis within bounds, and drop it when they let go. The code works perfectly if I don't specify a bounding rectangle (except it doesn't restrict to x-axis). What's up with that? Here's my non-working code:

Code:
videoConsole.scrubber.addEventListener(MouseEvent.MOUSE_DOWN, dragScrubber);
videoConsole.scrubber.addEventListener(MouseEvent.MOUSE_UP, releaseScrubber);
private function dragScrubber(e:MouseEvent):void{

[code]....

View 1 Replies

ActionScript 2.0 :: Make E To HitTest F To Get Something Else Function But They Won't Work?

Sep 6, 2011

Lets say that I got movieclips A,B,C,D in my scene and E,F which only come into scene when A hitTest B and C hitTest D.I was able to make the A+B and C+D hitTest functioning properly. But when E,F came into the scene, I tried to make E to hitTest F to get something else function but they won't work.# note that there is some short animation before E & F come into scene.I am pretty sure all the instance names are named properly.

View 5 Replies

Professional :: Make The OnMouseDown Function Also Work Within The MovieClips?

Jun 15, 2010

Is there a way to make the onMouseDown function also work within the MovieClips area in this code example?  It seems like the two functions are conflicting.
 
attachMovie("nutrition","nutrition",4,{_x:715, _y:370});
nutrition.gotoAndPlay();
nutrition.onPress = function():Void{

[Code].....

View 2 Replies

ActionScript 2.0 :: Listener In Order To Make OnRelease Function Work?

May 20, 2007

Do I have to use a listener in order to make the onRelease function work? Right now it doesn't and I think it's because the png isn't loaded before the onRelease function is invoked.[code]

View 3 Replies

ActionScript 1/2 :: StartDrag Function On 2 Movieclips

Dec 14, 2009

Is there a way how the startDrag function can be used on 2 different movie clips on one stage?
 
I have my own photo slideshow player (photos + music) and I need 2 dragable movieclips (buttons). First one is on the timeline and second one on the volume slider. How to achieve that I could use the startDrag function on both of them in the same time?
 
Or is there any trick how to do it? A regular youtube player has 2 dragable buttons (volume, timeline) also...

View 3 Replies

How To Make A Infinit StartDrag

Mar 25, 2009

How to make a infinit startDrag So something like :Code: Select allstartDrag(this, false, 0, 0, infinit, infinit); Only this code acts like this:Code: Select allstartDrag(this, false, 0, 0, 0, 0); And also I'd like this startDrag to work with negativ cordinates.

View 2 Replies

ActionScript 3.0 :: Cannot Get The Index Number From A StartDrag Function?

Jun 13, 2011

//*//*//*//*//**//**/**//**//**//**//**//**//**//**//**//**//**//
var t:Array=new Array();t=[d1,d2,d3,d4,d5];
var d:Array=new Array();d=[t1,t2,t3,t4,t5];

[code].....

View 6 Replies

ActionScript 1/2 :: Use The StartDrag Function On A Movieclip On Movement?

Aug 10, 2011

A friend need's to create a flash banner like this site. i write this action to a movie clip, but the clip have to be on movement.

[Code]...

Is there a way to use the startDrag function on a movieclip on movement?

View 1 Replies

ActionScript 2.0 :: Use The StartDrag-function To Drag A Movieclip

Mar 11, 2004

i want to use the simple startDrag-function to drag a movieclip. when the option to lock the movieclip is set to false, there's no problem but when i set this option to true, so the movieclip should follow the mouse locked to the center, my movieclip just disappears. i used this code:

[Code]...

View 5 Replies

Actionscript 3 :: Flash - StartDrag() Within StartDrag() On Child MovieClip

May 19, 2011

as you can see, I have a container MC which I have added to the stage. I set its drag constraints using a Rectangle(). I then add the 'cat' child movieclip to the container, and I want this to be dragable too. However, as soon as I click on my cat when testing the MC. It shoots to point x=0 y=0 on the stage and doesn't move.

The container MC can be moved without any trouble.

If I remove the rectangle bounds from the containers startdrag() function. both MC's can be dragged without any issue.

//panning ability
my_x = 800 - myImage.width;
my_y = 480 - myImage.height;

[Code]....

View 3 Replies

ActionScript 3.0 :: Scrollbar Base On StartDrag And StopDrag Function?

May 17, 2011

I know how to do the component UI scroll bar. But what I want to do is have my own custom scroll bar, and all the others tutorial looks confusing. I was just messing around with startdrag function and I notice that whenever you don't specify what you want to drag, it just drag everything. Ex: redBox_mc.startDrag(); will drag only the red box startDrag(); will drag everything. Using this I think I can make a UI scroll bar. The only problem is that everything go in the opposite direction. Is there any way I can fix this?

View 1 Replies

ActionScript 3.0 :: Possible To Use StartDrag Function / Giving Selected MC Elastic Movement

Jun 25, 2010

I was wondering if it's possible to use the startDrag function AND giving the selected MC an elastic movement. Or if I 'm supposed to use an onEnterframe function instead.My project needs me to use startDrag only, but I can give a smooth elastic MC movement with this function.

View 2 Replies

ActionScript 2.0 :: Make A Graphic Visible When "complete" Cuepoint Is Detected, But Function Doesn't Work?

May 24, 2007

I'm using Flash 8 (in case you need know what version I'm using).There's three flvs I have assigned a cuepoint, "complete". The goal is to make a graphic visible when "complete" cuepoint is detected, but this function seem doesn't work, any feedback on function?:

Code:
var nc:NetConnection = new NetConnection();
nc.connect(null);[code]....

View 1 Replies

Actionscript 3 :: "Error #1006: StartDrag Is Not A Function"?

Feb 24, 2012

I was writing code for dragging mechanism which invokes to wait for small period of time before starting the drag operation.But I am getting this error message in the mouseDownHandler() function.

TypeError: Error #1006: startDrag is not a function.
at Function/<anonymous>()[C:lahblah_8216oboflex2srcuimapWorldMap.as:105]
at Function/http://adobe.com/AS3/2006/builtin::apply()

[code].....

View 1 Replies

ActionScript 3.0 :: Width Doesn't Work - How To Make It Work

Apr 21, 2010

I have a button object that I need to scale to align with the variable width of an array of images.However, when I set the width in code, the button does not actually become that width. Tracing out the width gives me the correct value, but on screen.. it's off.

I've proved it to myself by scaling the same button object manually in the properties pane and visually comparing. Both of the buttons below have a width of 410.

Code:
navigatorDown_btn.width = 410;
navigatorDown_btn.x = (stage.stageWidth/2)-(navigatorDown_btn.width/2);
trace(navigatorDown_btn.width); // output: 410

View 4 Replies

ActionScript 3.0 :: Declaring A Variable In A Function: Either The Function Or The EventListener - Doesn't Work

Nov 27, 2009

I have a set of Cue Points in an FLV I'm playing. It's an interactive quiz, so the idea is that flash will change a variable, theAnswer, to a different letter depending on which question it is. The answer to question 1 is B, question 2 is D, etc. Either the cue point event listener isn't working, or else it is working and Flash isn't declaring the variables. 1120: Access of undefined property theAnswer. I literally can't find a single problem with my code. I have an almost identical Event Listener further down which works.

[Code]...

View 4 Replies

Actionscript 3 :: Function From A MouseEvent Activated Function Will It Not Work Properly?

Jan 3, 2012

I am working with AS3 to build a very simple mp3 player on my site. So far the play and pause button work fine, but when I try to move the slider then click the pause button, it doesn't pause, and then clicking the play button again causes it to play a new file.I'm assuming that for some reason when I call the playMp3 function from my MouseEvent, it's within an object or something and not at the root, so it's like loading a new sound file, but I don't know how to fix that.URL...

View 2 Replies

ActionScript 3.0 :: Make A Sprite Button With Graphics And Can't Make It Work?

Aug 22, 2011

* I have a flash project called contact

* The document class is ContactClass

I am trying to make a sprite button with graphics and can't make it work. I have successfully added text fields so I know the path is correct. I suspected my code was correct and confirmed it should be, after reading several tutorials showing the process for creating sprite buttons with graphics. Anyway, I imported nearly every class on Earth, but certainly everything which needs to be. Stage is gray and 800x600.The graphics code by itself with appear, but not when linked to the sprite. Also, the sprite won't appear no matter what. Another interesting piece of the puzzle: nothing will trace, not even objects such as textfields which actually appear and function on the stage when I text the code.

public class ContactClass extends Sprite {
public function ContactClass() {
var home_btn:Sprite = new Sprite();[code]....

View 3 Replies

ActionScript 3.0 :: Make Function In To A Static Function And Call It From Other Classes

Sep 23, 2009

this is the function i want to turn in to a static function. just dont know how to make it a static function and call it from other classes. i think this would have its own file.

[Code]....

View 2 Replies

ActionScript 3.0 :: Make A Function Stop A Function?

Jul 1, 2010

ActionScript Code:
myFunct();
function myFunct()
{

[Code].....

Any way to get this to work without using much more code? This is for a function that checks to see if a user is still logged into a website. I need the check to happen every time the user causes certain functions to run, like create topic, submit new post, etc. I could put the code, which is only a two-liner if/else statement in every function, but it would be nice to just call a single function. But that function would have to be able to cause the function that's calling it to return to get it to cease.

View 5 Replies

ActionScript 3.0 :: Use A Function From A Doc Class To Call A Function To Work On In Another Class?

Dec 15, 2009

how do use a function from a doc class.... to call a function to work on in

[Code]...

View 2 Replies

ActionScript 3.0 :: Way Else IF Function Should Work?

Dec 30, 2010

I've written the function below which is called when a button is clicked. I want to change the character image being displayed and change the number_txt variable each time the button is clicked.This works in the first instance (if char 1 is visible it hides it, makes char 2 visible and changes the variable as required). But having done this it wont work the other way (hide char 2, make char 1 visible, change the variable as required)I can only assume I'm missing something in the way the Else IF function should work? If there is a better way of scrolling through 4 or 5 'character' images and updating the variable each time.[code]

View 2 Replies

ActionScript 3.0 :: SetFocus Function Does Not Work

Nov 21, 2008

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="[URL]"
xmlns:ns1="com.something.*"
creationComplete="init();">
<mx:HBox>
<ns1:MyButton label="ok" click="ok_()" id="OKBtn"/>
[Code] .....

View 2 Replies

ActionScript 3.0 :: Can't Get Function DOUBLE_CLICK To Work

Feb 12, 2011

this is my code..RollOver and Out works great, but I can't seem to get function DOUBLE_CLICK to work.

home_mc.doubleClickEnabled=true;
home_mc.useHandCursor = true;
home_mc.buttonMode = true;
this.home_mc.addEventListener(MouseEvent.DOUBLE_CLICK, click_home_mc);

[code]...

View 3 Replies

ActionScript 3.0 :: Button Function Seems To Work Only Once

Feb 19, 2011

When I tell Flash to go back frames the buttons cease to work, in other words, the button only works once. I've tried tracing it to find the problem and when I tell it to go back frames it won't run the function.  I'm using actionscript 3 on Flash CS4.[code]

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved