Mouse Drag/multi Parent
At one point in my movie, a pig from the pig pen and drops it in the barn.
all the pigs are dynamicaly created with attachmovieclip
when the user drags it to the barn it needs to become of child of the barn MClip for reasons i don't want to bore you with
so what I did was have it so, the Pig on(Press) attaches the same Pig MClip from the library to the barn, and then removes the orgininal Pig which was attached to the Pen.
This is working well and is seemless to user EXCEPT
in order to release the pig I need to click the mouse twice in order for the on(release) to work.
I'm trying to get rid of the need to do this "double click"
seems the new clip doesn't know or is not in a state of being pressed when it is created within a Pressed state.
any ideas?
Thanks
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX
Posted on: 12-01-2002, 10:08 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Drag & Drop - Multi Targets That Swop?
Is it possible to have two draggables for two targets?
Where drag-A can be dropped on target-A or target-B, but if it does, then drag-B can only be dropped onto the other target (where drag-A is not).
The reason for this is a sequence of 15 draggables and targets for a process that need to be completed in the correct order. The code is fine for that, but the process has some steps that can be done in two ways, hence the choice.
In other words, the user can get a correct answer for the whole process if they decide to make some steps one way or the other.
I'm intermediate level in flash scripting but don't know the simplest way to do this. I've research the flash sites but nothing comes close. Maybe the instance names have to be changed dynamically via if/else? Maybe on drop of drag-A onto target-B asomehow changes the logic.
Problems With Drag Of Multi-layered Movie Clip
I am relatively new to Actionscript 3.0 and Flash CS3 for that matter, and am trying a new project. I have looked through this forum, but haven't found a similar post (maybe searched wrong).
I have an issue where I have an instance of a movie clip and the movie clip has multiple layers so that I can dynamically change the color of one part of the movie clip.
I can copy the movie clip which works fine, but when I try to drag the new instance, one layer moves while the other doesn't, and then if I drag the layer that was left behind, it moves both layers (the first moved one now in its new position moves along relative to the second dragged part). I would like to have this new instance act as a whole movie clip to drag around.
It may be hard for me to explain properly so I included the .fla (which shows the movie clip I am trying to drag) and the code.
Code:
var colorTransform:ColorTransform = newCircle.transform.colorTransform;
var addedCircle_mc:MovieClip;
function colorChange(event:MouseEvent){
colorTransform.color = 0x00ff00;
newCircle.insideBack.transform.colorTransform = colorTransform;
}
color_btn.addEventListener(MouseEvent.CLICK, colorChange);
copy_btn.addEventListener(MouseEvent.CLICK, duplicateClickHandler);
function duplicateClickHandler(event:MouseEvent){
addedCircle_mc = new Circle();
addedCircle_mc.height = newCircle.height;
addedCircle_mc.width = newCircle.width;
addedCircle_mc.insideBack.transform = newCircle.insideBack.transform;
addedCircle_mc.transform = newCircle.transform;
addChild(addedCircle_mc);
addedCircle_mc.x += 125;
addedCircle_mc.addEventListener(MouseEvent.MOUSE_DOWN,myObjDrag);
addedCircle_mc.addEventListener(MouseEvent.MOUSE_UP,myObjStop);
addedCircle_mc.addEventListener(MouseEvent.ROLL_OUT,myObjStop);
}
function myObjDrag(event:Event){
event.target.startDrag(false);
event.target.parent.addChild(event.target);
}
function myObjStop(event:Event){
event.target.stopDrag();
}
Any help to get this movie clip "whole again" would be greatly appreciated.
MC That Can Resize/drag...constrained To Parent
I'm trying to create a MC that can be resized and dragged and stays constrained to the bounds of a parent movie.
I've gotten parts of it to work and have tried both StartDrag() and a variety of different _xmouse/_ymouse techniques. But so far, I've only been about %75 successful with EVERYTHING working.
It would help a great deal if someone could point me to an example I could break apart. I haven't found one yet that shows how to constrain with drag AND resize.
Thanks,
Kory
Drag N Snap + Parent --> Child Dragging
Hey all!
I'm working on a lil project to learn a bit about dragging and snapping items on a stage. At the moment i can drag an item movieclip around and snap it to the base movieclip.
However, i can't figure out how to drag the parent (base movieclip) which will also drag the item clip when it's inside.
Here's my code:
ActionScript Code:
function fnUpdate(){ updateAfterEvent();}item.onPress = function(){ this.x = this._x; this.y = this._y; this.startDrag(true); this.onMouseMove = fnUpdate;};item.onRelease = meow.onReleaseOutside = function(){ this.stopDrag(); delete this.onMouseMove; if(eval(this._droptarget) == base) { this._x = base._x; this._y = base._y; }else{ this._x = this.x; this._y = this.y; }};base.onPress = function(){ this.startDrag();};base.onRelease = function(){ this.stopDrag();};
Thanks again
Multi Pointer / Mouse
How to use two mouse in Flash application (multi user)?
I am having two mouse connected to my system Both has to work independently, is it possible in Flash, without using any Third Party wrapper Applications.
Edited: 02/20/2008 at 09:21:22 PM by kamsky
Preventing Multi Mouse Click
hey all...
I have designed a shooting game. targets appear and evaluated on whether the player shoot (this happens when you click on the target) or miss them (if you can not click on the target). Targets disappear in 5 frames both when hitted and when missed. The problem is, if you catch one target and click continuously, that evaluates a hit for each time. I want to prevent this and limit the player being able to click only once for a ceratain miliseconds (lets say for 1 sacond). I think this can be done with setting an interval, but im quite new in scripting. any help would be appreciated...
Dynamically REMOVING Children From Parent Containers? MovieClip(this.parent.parent...
EDIT: actually, this isn't really dynamic... it should be really simple!
I can get a nested swf to add a movie to the root timeline, but in order to replace it with a new movie, AS3 first requires that I clear the old one. I can't figure it out!
This does not work, though it is the exact same format I use to add a movie to the root successfully:
Code:
MovieClip(this.parent.parent.parent).removeChild(MovieClip(this.parent.parent.parent).loadMovie)
Any idea why this doesn't work?
Changing Mouse Cursor On Mouse Over/out Without Drag Movie?
Hello,
I have a movie clip/button that activates some actions but I don't want the mouse pointer show the link icon (hand) and instead show the normal arrow icon. Is this possible with a fast mouse.smth actionscript or is a complex startdrag/stopdrag of movieclips the only way out? Thanks in advance.
Mouse Drag Wirth Invisible Mouse?
I'm kind of new with the actions,
but I can make a movie clip drag to the mouse--with the startDrag action.
what i cant do is make the mouse-arrow disappear.
could you write the actionscript for that??
thanx
Mouse Events Not Passed From Parent To Child
I've run into a problem and I'm wondering if someone may be a better solution.
I have a parent movieclip that is a pop-up window. It is made visible by mousing over an external movieclip and removed when the user mouses out of it's boundry with an onRollOut event. In the pop-up are several child movieclips that also have onRollOver and onRollOut events coded. The problem is that the mouse events attached to the child movieclips are not firing. Seems as if having the onRollOut event attached to the parent is blocking any mouse events from being passed to the child clips.
The workaround I'm using right now is to test the _xmouse and _ymouse against the xMin/xMax yMin/yMax of a boundry object of the parent to simulate an onRollOut event which allows the mouse events to pass through to the child clips. Seems like these should be able to pass through somehow.
Anyone have a better solution for situation?
chance
Draw Lines By Mouse Drag And Erase Same Lines By Mouse Click.
Put the following script on frame ..
var i=0;
var sxcord;
var sycord;
var excord;
var eycord;
onMouseDown=function(){
i++;
sxcord=_xmouse;
sycord=_ymouse;
createEmptyMovieClip("temp_mc", 20);
onMouseMove=function()
{
temp_mc.clear();
temp_mc.lineStyle(1, 0xff0000);
temp_mc.moveTo(sxcord, sycord);
temp_mc.lineTo(_xmouse, _ymouse);
temp_mc.lineStyle(6, 65280);
temp_mc.lineTo(_xmouse + 0.500000, _ymouse);
temp_mc.moveTo(sxcord, sycord);
temp_mc.lineTo(sxcord + 0.500000, sycord);
}
}
onMouseUp=function(){
temp_mc.clear();
onMouseMove=null;
excord=_xmouse;
eycord=_ymouse;
createEmptyMovieClip("line"+i, i)
with (eval("line"+i)){
lineStyle (1, 0x0093DD, 100); // this is the colour of the final line.
moveTo (sxcord, sycord);
lineTo (excord, eycord);
endFill();}
eval("line"+i).onPress=function(){
trace(this._name)
removeMovieClip(this._name)
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++ +=
Enjoy !!!
Multi Loaded Vars To Multi MC's...Banging My Head Against The Wall
OK I'm banging my head against the wall because this is probably too simple, and I've been working on too many things lately *L*
OK so I've loaded a bunch of vars... let's say var1, var2, var3...var6 from a txt file.
Now I want to send each var to a MC whit similar names - but1, but2, but3...but6
code:
varsFile.onLoad = function(success:Boolean) {
trace("loaded");
for (i=0;i<=6; i++) {
buttonClip.but[i].htmlText = varsFile.var[i];
}
};
I've tried a bunch of different syntaxes, but can't seem to get it to work... HELP!!!!!! LOL
Thanks!!!!
Creating Multi-buttons To Open Multi-jpegs
I am a newbie to action-script and flash. I have Flash 6.
I am using a template built in flash and there is a sub page that has numerous
buttons with roll-over effects that were pre-built. BUT they don't point to anything yet.
I want the viewer to be able to click on a button and have each one open a different Jpg in a window next to the rows of labeled buttons.
I imagine this is pretty simple...Perhaps you know of a specific tutorial within this flash help site that addresses this?
Or if there are a few things that you can communicate to help me...that would be awesome!
Thank you!
Mouse And Drag
In my movie I have a movie clip that is being dragged to replace the cursor. The only problem is that when my mouse is outside the movie I the cursor clip just stays where ever my mouse left the Flash movie. I know theres gotta be a way to do this with _xmouse and _ymouse and such but I'm not a real good scripter so if someone could wip it up I'd be thankfull.
Why Cant I See My Drag From My Mouse..?
Hey guys..
I have never had this problem before, but now when I drag to make a text box, grapich box, circle, or anything that uses the mouse and including a hold and drag operation, I cannot see what Im doing. Before it previewed where I had put the graphic.
this is too tough to explain, because it is so simple a thing.
any ideas?
thanks
dan
Mouse Drag?
I have eyes that are following my mouse- they have parameters that they move in. The problem is that I have a bunch of buttons on the page and when the mouse is dragging the eyes it does not acknowledge the buttons.
Mouse Drag Over
I have 64 x 60 boxes at 8px x 8px. I want to mouseover to change colors, this is easy because I am already done with it. But once clicked I would like it to change color and stay changed, no biggie, this is done too. I would like to hold down the left mouse button and drag my mouse over the other boxes to change colors as well, kind of like when selecting multiple files in a folder with your mouse in windows. I would then like to be able to hold down the control button and select different boxes as well. Any help would be greatly appreciated.
Mouse/Drag Over
I have another member currently helping me with this issue but he is very busy doing something else and I need to get this thing done.
I want to have individual boxes and every one has to be able to mouse over to change color, also mouse drag with an overlay to permanently change color kind of like the image I have attached. Any help would be more than welcomed.
Click Here
Mouse Drag
Look at the attachment, i'm trying to make the "thing" follow the curser, i followed the tutorial EXACLY, and it looks just like the sites .fla. Some one please tell me what i did wrong!!!
Specifying The FLV In A Multi-channel Multi-title Player
Hello,
I have Flash 8 Pro that I use to publish an Earth Sciences Agency version 5.1 multi-channel multi-title FLV player on my website. The FLV player is populated using an XML playlist. I'm going through the account setup process at Truveo, which is a search engine dedicated to video, that uses an RSS feed to enter your videos into their search engine. I've set up the RSS feed and it validates.
However, a listing of one of my videos in the search results only points to my site as a whole, rather than to the specific FLV file on a specific channel in the FLV player. I suspect that there is some need in the RSS file to specify the FLV video and also fire an event, plus some type of event listener in my SWF to respond with the correct FLV.
In other words, when the search engine(s) return one of my videos in a search list, and provides a hyperlink to my site, how do I make it open the FLV player at that specific video, rather than just open my site as a whole?
Can anyone point me to a tutorial for how to set that up? Is it even possible?
Thanks,
Tom Wood
Edited: 07/13/2008 at 09:35:46 AM by tomwood2
Delayed Mouse Drag: Help
Hi everyone, i have a question:
how do I make an MC follow the mouse with a slight delay, let's say half a second?
And listen, please don't gimme formulas and syntaxes, or in case you do, just explain what each does, because i'm a graphist and not a programmer at all.
Thanks a lot!
(*)
Mask With Mouse-drag
Damn it just won't work
I want to make some buttons,
but it just won't work, i have made this: http://www.rt-security.com/sam/pdf.fla
I know it is something with arrangement but i really want both numbers to get "unmasked"
I hope someone can help me
-sam-
How Do I Turn Off My Mouse Drag?
I posted earlier about making a line follow my mouse. I got that to work. Only problem is it's in a scene, there are other scenes in this, and the effect stays!! How can I only get it to work in the one scene?
Thanks much!
Michael
Mouse Drag Along Path
Does anyone know how to drag a movie clip along a path??? So that the movieclip is locked onto the path and is controlled by the mouse???please help? I dont even know how to start...
Drag With Mouse Movement
Hi Flashers
I have a flash nav bar which is 543 pixels wide. When I move my mouse I want a square called ghost to move with the mouse horizonatally.. . on the clip called ghost i have this code
onClipEvent (load) {
_root.counter = _root.counter+1;
speed = _root.counter;
}
onClipEvent (enterFrame) {
_root.movePanel(this._name, speed);
}
and on the first frame of the movie have this code
counter = 3;
for (loopCount=2; loopCount<10; loopCount++) {
}
function movePanel(whichClip, baseRate) {
if (_root[whichClip]._x>_root._xmouse) {
difference = _root[whichClip]._x-_root._xmouse;
rate = difference/baseRate;
_root[whichClip]._x = _root[whichClip]._x-rate;
}
if (_root[whichClip]._x<_root._xmouse) {
difference = _root._xmouse-_root[whichClip]._x;
rate = difference/baseRate;
_root[whichClip]._x = _root[whichClip]._x+rate;
}
}
This all works fine but if i move my mouse horizontally off the movie area the ghost shape also moves off the screen, can i set a parameter of some coordinate locks horizontally to stop the ghost clip from moving off the page?
Many thanks
TASvinO
Get Mouse Location During Drag, How?
Hi,
I've made an mc draggable like this:
Code:
on (press) {
startDrag("");
}
on (release) {
stopDrag();
}
on (releaseOutside) {
stopDrag();
}
but i want a function to be firred every time the mouse is moved during drag, for example, to trace the x and y of the mc. How can i achieve this?
a pseudocode example would be:
Code:
on (mousemove) {
if (dragging) {
trace _root._xmouse;
}
}
Thanks!
How Can I Drag My Button With Mouse
i make an object and change it into button and on button hit option i past sound .. it is working. i want the circle(object) move with my mouse e.g. a hunting game.. fire option handle with the circle(object)
Odd Mouse Drag Behavior
I have a drop down menu and when you mouseover the menu options a little bubble pops up and describes what the button you're over does. Everything works fine except if the user clicks and drags on one of the buttons the hint bubble gets permanently fixed the the last menu button in the list. I don't know how this is happening. I don't have code linking the two that way. There's technically no reason for the user to click and drag on the menu that way, but if it happens I don't want them complaining that it's not working. So I'd like to fix it. I know this is kind of hard to visualize, so if it helps I can send you the fla and/or the swf and you can take a look at it.
Mouse Drag Only Left And Right
I am using the following code to drag my movie clip "cursor".
Mouse.hide();
startDrag("cursor", true);
It works fine but I only want the drag function to move in the x axis. ie left and Right only, not upwards/downwards.
How do I prevent movement on the y axis ?
Obviously when the user moves diagonally left, then the cursor should move left only.
Any help much appreciated.
Mouse Click And Drag
Hello friends,
I have a question. I have an object that I would like user’s to be able to click on and move. As the object is moved it will generate numbers.
The part I need help with is how to make the object movable by users. Kind of a mouse click and drag operation. The object is only going to move along the X axis.
If anyone has an idea how I can do this, I would be very grateful for the assistance. Many thanks in advance for your help and your time.
Confined Mouse Drag
O.k. - lets say I want to create a confined mouse drag...
I know for the drag - I could use this on my object:
this.startDrag ( );
How would I confine it?
This will be used in a menu box - and I don't want the drag to occur outside the box...
?
Thanks
Mouse Drag To Contol MC
hi guys.
i have a series of pictures in a MC and when played rotate the image....
I am trying to make it so that the mouse positionon screen determins the rate at which the Mc is played.
for example the further the mouse is to the right of the screen the movie clip moves through each frame quicker and to the left of screen plays previous frames quicker.
this could be done with rollover buttons, lets say...
have an invisible buttonon left of screen and when mouse is (rollover) goes to prevframe and the same for right side of screen but change to play next frame.
here is an example of a similar thing but with a click and drag...(i think)
www.motherlondon.com
kindest regards...
How To Keep Show Pic Of A Mouse Drag?
does anyone know how to make a mouse drag but I want to able to show up each area of the pic and keep this area while dragging it. So at the end it will show up the whole picture.
I appreciate any helps, kinda urgent
I have to integrate on a project
Keep Showing A Pic Of Mouse Drag
does anyone know how to make a mouse drag but I want to able to show up each area of the pic and keep this area while dragging it. So at the end it will show up the whole picture.
I appreciate any helps, kinda urgent
I have to integrate on a project
Drag Mouse Listener
On this atatched movie each 'postit' is torn from the original clip which is on the main stage.
The clip copies fine, however the mouse only detects if it has rolled over the newest copied clip. I think it is something to do with the Mouse.addListener() only being assigned to the newest clip but I have never used this before so I am still a bit stuck!
Thanks!
Mouse Position On Drag
Hey guys,
I have a movie clip thats being dragged when clicked on.
I want to know what the best way to figure out if while im dragging i move over other movie clips on the screen and fire certain events based on which movie clip the mouse is above.
Im thinking to use the mouse coordinates but is there a better way?
On Mouse Over, Mouse Drag
I am working in Flash 5, and would like to have my mouse drag an object only when it (the mouse) is moving over a particular button. When the mouse is out of the range of the button, I would like this object to automatically disappear from the screen.
I hope that this is clear. Please let me know if it is not.
Thanks so much for your help,
Gabrielle
How Do I Creat Mouse Drag With Delay ?
I need to do a mouse drag, but with delay - I mean that when I move the mouse the MC will follow, but wil do it a bit slowly with delay, and will change it's speed as it gets near the mouse location. This is shon in lots of sites.
HOW DO I DO THAT ??!
Thanks.
Mask With Mouse-drag With Pictures :S HELP ME
I want to make a mask of my moped which desolves the retouché'd parts when u move your mouse over the pic...
My source: http://www.rt-security.com/sam/pic.fla
Someone help me, i really need this one...
-sam-
Masking With Mouse Controlled Drag.
Does anyone know how to do a mouse controlled mask. i saw a tutorial on this site , but it was poorly written. some guys have sent me files, but they are not controlled with the mouse. please all help is appreciated. thanks todd
Hide Mouse And Start Drag
Heres my problem. I've got three different movieclips that serve as cursors. When i do the hide mouse and start drag they all work. But how would i change the cursor by clicking a button? any ideas?
thanks
Mouse Focus Question: Which One To Drag
Here's the scenario: The 2 of hearts lies atop the ace of hearts. I go to click on the 2, to move it around, but instead I start dragging the ace, which is underneath, but was created first.
Try it yourself, I'll attach the .fla. Just drag the ace under the 2, then click on the two near the top, and you'll start dragging the ace instead.
What I want is for the top card to be dragged, not the bottom card. I really think it has to do with the order of creation (ie, the lower the depth, the first to be grabbed).
Anyone know of a way to solve this?
Thanks,
Drag Box Jumping Around With Mouse Movement
I finally got my drag boxes to tween on+off the stage with action script. One thing is still not working. When I try to drag the boxes around on the stage the boxes jump around like crazy. Has anyone else experienced this? Is there a solution?
The example is online:
http://www.mollybeall.com/home.html
Drag Mouse Reveal Mask
Hello,
I am hoping someone has tried to accomplish this one!
I am trying to create a mimic of a scratch and win ticket for playing demo purposes, in Flash MX
I have a 'scratched' version of the ticket as a background image, then created a mask of the scratch area, to be scratched by the user.
Where I am stumped, is how to create the dragging mouse "eraser" effect to reveal the unscratched version of the ticket, when the user "scratches" the scratch area.
Does anyone know some links to some tutorials for this? I have searched for this, and haven't had good results.
Deadline is nearing....please help.
Thanks!
Mouse Drag Problem (Flash 5)
I am not sure what is wrong here.
When you drag the splitterbar all the way to the left, it should stop at the edge of movie; it does when I run it inside Flash 5, but it doesn't when displayed in a web page.
See example here...
http://www.ourwebzone.com/test/splitterbar.html
On my PC, in Flash 5 it works fine, but in an html page it doesn't work at all.
Anyone know why?
Frank
[MX] Mouse Drag According To Screen Size
Hi, I'm trying to do a liquid flash layout for the first time. The site is basically one huge image that extends beyond the browser. When you move the mouse, the image moves in the opposite direction so that if you move your mouse to the top left, the whole image would move to the bottom left allowing you to see the top part. Originally I was just trying with bg._x = 400-_xmouse, but the problem I have is I have to use the Stage.width to replace the stage size. How do I adjust the movement so that the movement adjusts to the ratio of the image to the browser size? so no matter at what resolution, if you move the mouse to the very top left, the movement of the image would end so you can see the top left of it. Any ideas? I'll probably be adding a deceleration effect to it too. Thanks!
[F8] Mouse Drag With Left Button
I have 64 x 60 boxes at 8px x 8px. I want to mouseover to change colors, this is easy because I am already done with it. But once clicked I would like it to change color and stay changed, no biggie, this is done too. I would like to hold down the left mouse button and drag my mouse over the other boxes to change colors as well, kind of like when selecting multiple files in a folder with your mouse in windows. I would then like to be able to hold down the control button and select different boxes as well. Any help would be greatly appreciated.
Drag Mouse To Increase Size
I am using the following code to drop circles on a movie clip named "mcMap":
Code:
var i:Number = 0;
mcMap.onPress = function(){
i++;
_root.attachMovie("CircleSymbol",
"mcCircle" + i,
i,
{_x: _xmouse, _y: _ymouse});
};
The circles are instances of a movie clip with a linkage name of "CircleSymbol".
After dropping the circles I would like the user to be able to drag the mouse back and forth while continuing to hold down the mouse key. This in turn would cause the size of the circle to increase and decrease until the user releases the mouse button.
Does anyone know how to go about this? I'll mess with some ideas using _xscale and _yscale related to mouse position but am not quite sure how to go about it. Any help would be appreciate.
|