Drag And Drop With Additional Drop Area
Hi there i have a little project on at the moment, an educational game for children, where items need to be dragged from one position to another, but with the possibility of being dragged to a seperate holding area first, before being dragged to their final resting area.
i have this code which deals with a straight 'a to b' drag and drop function:
Code: setProperty(_root.boing,_visible,false); function dragSetup(clip, targ) { clip.onPress = function() { startDrag(this); this.beingDragged=true; }; clip.onRelease = clip.onReleaseOutside=function () { stopDrag(); this.beingDragged=false; if (eval(this._droptarget) == targ) { this.onTarget = true; _root.targ.gotoAndStop(2); } else { this.onTarget = false; _root.targ.gotoAndStop(1); } }; //the variables below will store the clips starting position clip.myHomeX = clip._x; clip.myHomeY = clip._y; //the variables below will store the clips end position clip.myFinalX = targ._x; clip.myFinalY = targ._y; clip.onEnterFrame = function() { //all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged) // then move the MC back to its original starting point (with a smooth motion)" if (!this.beingDragged && !this.onTarget) { this._x -= (this._x-this.myHomeX)/5; this._y -= (this._y-this.myHomeY)/5; //if the circle is dropped on any part of the target it slides to the center of the target } else if (!this.beingDragged && this.onTarget) { this._x -= (this._x-this.myFinalX)/5; this._y -= (this._y-this.myFinalY)/5; setProperty(_root.boing,_visible,true); } }; }
dragSetup(circle_mc,targetCircle); dragSetup(circle2_mc,targetCircle2); dragSetup(circle3_mc,targetCircle3);
which i have then tried to adapt to 'a to b possibly via c':
Code: function dragSetup(clip, targ, drop) { clip.onPress = function() { startDrag(this); this.beingDragged = true; }; clip.onRelease = clip.onReleaseOutside=function () { stopDrag(); this.beingDragged = false; if (eval(this._droptarget) == targ) { this.onTarget = true; this.onDrop = false; _root.targ.gotoAndStop(2); } else if (eval(this._droptarget) == drop) { this.onDrop = true; this.onTarget = false; _root.targ.gotoAndStop(1); } else { this.onTarget = false; this.onDrop = false; _root.targ.gotoAndStop(1); } }; //the variables below will store the clips starting position clip.myHomeX = clip._x; clip.myHomeY = clip._y; //the variables below will store the clips end position clip.myFinalX = targ._x; clip.myFinalY = targ._y; //the variables below will store the clips end position clip.myDropX = drop._x; clip.myDropY = drop._y; clip.onEnterFrame = function() { //all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged) // then move the MC back to its original starting point (with a smooth motion)" if (!this.beingDragged && !this.onTarget && !this.onTarget) { this._x -= (this._x-this.myHomeX)/5; this._y -= (this._y-this.myHomeY)/5; trace("didn't drag anywhere"); //if the circle is dropped on any part of the target it slides to the center of the target } else if (!this.beingDragged && !this.onDrop && this.onTarget) { this._x -= (this._x-this.myFinalX)/5; this._y -= (this._y-this.myFinalY)/5; trace("correct!"); } else if (!this.beingDragged && !this.onTarget && this.onDrop) { this._x -= (this._x-this.myDropX)/5; this._y -= (this._y-this.myDropY)/5; trace("teacher drop area"); } }; } dragSetup(circle_mc, targetCircle, dropPlace); dragSetup(circle2_mc, targetCircle2, dropPlace); dragSetup(circle3_mc, targetCircle3, dropPlace);
any ideas where i'm going wrong? it looks right to me but only ever seems to work when you drag 'a to b'
thanks, dave.
FlashKit > Flash Help > Flash ActionScript
Posted on: 09-01-2006, 08:47 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Drag And Drop Into One Area
Hello,
If you look at the file I have attached(O.k. - scratch that file, I cannot attach because of the size.) "business and banking day" needs to be dropped into either "monday, tuesday, thursday, or friday" areas, unless the drop area is already full with another "business and banking day"
If the drop area is within one movie clip, can a mc outside of that mc have a hit test with it?
So esstienally, I am having trouble figuring out where to add the hit test, I think?
I appreciate any suggestions that you have!
I am using MX 2004 Pro
Thanks
Drag And Drop To Matching Area
I have am image that has been sliced and each slice has been made into a movie clip and put into an selectImage: array. I have matching movie clips also put into a (parell) matchImage:array. I am trying to drag each movieclip onto it's matching movieclip. If there is no match then the movieclip goes back to it's orignal x,y. Can someone point me in the right direction.
Thank you,
Attach Code
var selectImage:Array = [image1, image2, image3, image4, image5, image6, image7, image8, image9, image10, image11, image12, image13, image14, image15, image16, image17, image18, image19, image20, image21, image22, image23, image24, image25];
var matchImage:Array = [m_image1, m_image2, m_image3, m_image4, m_image5, m_image6, m_image7, m_image8, m_image9, m_image10, m_image11, m_image12, m_image13, m_image14, m_image15, m_image16, m_image17, m_image18, m_image19, m_image20, m_image21, m_image22, m_image23, m_image24, m_image25];
var index:int;
var origX = selectImage[index].currentTarget.x
var origY = selectImage[index].currentTarget.y
//matchImage = selectImage[matchImage[index]];
addListeners();
reset_btn.addEventListener(MouseEvent.CLICK, reset);
function removeListners():void{
for(index = 0; index < selectImage.length; index++){
selectImage[index].removeEventListener(MouseEvent.MOUSE_DOWN, startDragging);
selectImage[index].removeEventListener(MouseEvent.MOUSE_UP, stopDragging);
selectImage[index].currentTarget.buttonMode = false;
}
}
function addListeners():void{
for(index = 0; index < selectImage.length; index++){
selectImage[index].addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
selectImage[index].addEventListener(MouseEvent.MOUSE_UP, stopDragging);
}
}
function startDragging(evt:MouseEvent):void {
selectImage[index].currentTarget.startDrag();
trace(selectImage[index]+" Dragging");
}
function stopDragging(evt:MouseEvent):void {
selectImage[index].currentTarget.stopDrag();
//var index:int = 0;
if(evt.currentTarget.hitTestObject(evt.currentTarget.matchImage)){
selectImage[index].currentTarget.x = evt.currentTarget.matchImage.x;
selectImage[index].currentTarget.y = evt.currentTarget.matchImage.y;
removeListners();
correctSN();
}
else {
selectImage[index].currentTarget.x = evt.currentTarget.origX;
selectImage[index].currentTarget.y = evt.currentTarget.origY;
wrongSN()
}
}
function correctSN():void {
var myRequest:URLRequest=new URLRequest("audio/correctSN.mp3");
var mySound:Sound = new Sound();
mySound.load(myRequest);
mySound.play();
correct_txt.text = "YOU GOT IT!";
}
function wrongSN():void {
var myRequest:URLRequest=new URLRequest("audio/wrongSN.mp3");
var mySound:Sound = new Sound();
mySound.load(myRequest);
mySound.play();
wrong_txt.text = "SORRY NOT CORRECT!";
}
function reset(evt:MouseEvent):void {
selectImage[index].currentTarget.buttonMode = true;
addListeners();
wrong_txt.text = "";
correct_txt.text = "";
}
Drag Multiple Items In Drop Area
hi, i'm kinda stuck on a project. i need to drag and drop 9 different items into one area ... well that's actually already the first problem .
the second one is to load an external movie when dragged into the drop-area and to place the dragged item back on it's place when closing the external movie... damn i hope i can find some help
Drag And Drop Q - When Dropped In Certain Area Movie Clip Plays?
Ok I'm making a website that has a lot of penguins on an ice berg using Flash 5.
I've made the penguins so that you can drag and drop them using this code:
(each penguin is a movie clip named pen1, pen2, pen3 etc..)
Code:
//start with nothing dragging
onClipEvent (load) {
dragPen = 0;
}
//start drag
onClipEvent (mouseDown) {
//get current location
x = _root._xmouse;
y = _root._ymouse;
//find which, if any, part the cursor is over
for(i=1;i<=17;i++) {
if (_root["pen"+i].hitTest(x,y, true)) {
//set to drag this part, remember offset
dragPen = i;
offsetx = _root["Pen"+i]._x - x;
offsety = _root["Pen"+i]._y - y;
break;
}
}
}
//end drag
onClipEvent (mouseUp) {
dragPen = 0;
}
//if dragging, set new posistion
onClipEvent (enterFrame) {
if (dragPen > 0) {
_root["Pen"+dragPen]._x = _root._xmouse + offsetx;
_root["Pen"+dragPen]._y = _root._ymouse + offsety;
}
}
All this is in a separate actiona movie clip.
This is what I'm not sure about, how can I make it so that when the penguins are dropped in a certain area (in this case the sea) they will play the movie clip and then remove themselves from the movie.
I also need with this a penguin duplication button, that when pressed will place another penguin in the movie, bearing in mind that the penguin will need to be named pen(then a number not already on a penguin) for it to be draggable again.
I hope you understand the way I've done it and know what i'm to do, because I don't have a clue!
If it helps anyone to understand I'm using 'Gary Rozenweig's Flash 5 actionscript for Fuun and games' to get my code from
thanks in advance!
-Olly
Drag And Drop MC, Involves Polygonal Boundary, Drop Into Trash.
Hello. This is my desperate problem:
I am creating a circuit diagram designer.
There is basically instructions on the left, in a scrolling textbox (taken care of) and above that a rectangle with a bunch of components in it.
You need to be able to drag the circuit part from the side bar (a duplicate, so that the original remains in the same spot), and to a square on the grid on the stage of this program(Should snap to place...). Each clone should be able to be moved. Like so: You Press on a MC to drag it, the thing you are dragging to the stage is of course a clone. You release the mouse button, so it drops on the grid. It snaps into place. *Oops, you made a mistake. You press on it again, it is draged by your mouse to another square, and does not make a clone. *mind Changes... I dont want to use this one any more. You press on the MC, drag it to a bin which animates to show you the MC is being dragged over it. You release, the MC in question is deleted/removed...
You need to be able to rotate circuit parts by clicking on it so that it highlights, then pressing space bar.
It must also be possible to delete a duplicate by dragging it to the trash (an image/ MC), and last but not least, it is required to save the contents of the stage, or print them off.
Please note that to print it off, there are 2 input boxes outside the stage. One for the title, and one for the Users' Name. When they click on the print button, the two dynamic text fields must retrieve the values from the box outside of the programs' stage.
One Last detail: The cloned objects to be dragged around net to be in a six co-ordinate polygonal boundary, so that no-one can place any objects outside of the stage.
If anyone can help me, i would greatly appriciate it. I need to get this done asap. The graphics have been taken care of, it is just the coding to be done now. HELP, HELP PLEASE!
Thanks - Matt K
Drag&Drop Duplicate Movie With Drop Target
Hi There...
I'm creating a game where people can design their own cell phone by adding diamonds to it, a "Bling Phone" if you will. You will be able to add 4 types of diamonds to it, change the phones skin, add music to it, give it a name etc etc
I've got it to a stage where it when you click on a diamond(mc) on the stage it duplicates a hidden diamond(mc with a button inside) off stage and you can drag it around etc and then click save. Theres a script which grabs the instance name, x and y position of every diamond on the stage and stores it into a multi dimensional array which will be fed into a mysql database for retreival purposes at a later date.
Now my problem is i would like to be able to use the phone(mc) as a drop target but i'm not sure where to put the droptarget script. does it go on the original MC diamond or the duplicated mc diamond with the button inside it ?
Once a diamond has been dropped onto the phone i would also like it if the user then drags the diamond off the phone it gets deleted. I think i've got it half working but my variables which keep track how many diamonds are on stage dont appear to be updating.
I've attached the .fla file to this post if some is interested in taking a look and helping me out. The droptarget script is only on the blue diamond so far.
Any help would be much appreciated.
Thanks
Rob
Drag And Drop - Multiple MC's On To A Single Drop Target
Hi All
I am struggling with a drag and drop excercise.
I have 15 movie clips that need to be dragged over a single drop target in a specific order. i.e 1,2,3,4, when the correct movie clip is dragged to the drop target a movie within the drop target needs to advance a single frame to display the result of the correct movie clip being dragged over the drop target.
Would I be correct in thinking I need to use some kind of array to compare the clip that is being dragged to the frame position of the drop target?
I have the bones of this working and need advice / help on getting the clips to work in the specific order required. I can post my code if needed.
Thanks in advance.
btw - am using Flash MX 2004 Professional
Drag Abd Drop, Rollover When Drag Is Over Drop Target?
Hi, im using Flash MX 2004.
I am building a drag and drop, and I have a MC that can be dragged around the stage. The trouble im having is trying to make the drop location do something when i drag the MC over/off it.
I have the following code which works.
objectToDrag.onMouseMove = function() {
if ((objectToDrag.hitTest(dropper)) && (component._beingDragged == true)) {
dropper._alpha = 50;
temp++;
trace("working"+temp);
}
}
This will make the clip i am dragging the draggable MC over change alpha, but for the life of me I cant figure out how to get the alpha to change BACK, after the draggable MC is taken away from the 'dropper'.
Is there a better way that hitTest??
Cheerz,
Dwayne
[fmx] Drag And Drop With Multiple Drop Locations
Hi
I am trying to make a draggable object have two drop locations, but it will still only drop to one. Please if anyone can help me or notice my mistake it would be really appreciated.
on (release) {
if (_root.DragMotor._droptarget == "/Socket2") {
_root.DragMotor._x = _root.Socket1._x;
_root.DragMotor._y = _root.Socket1._y;
_root.CheckMotorDrop();
} else {
_root.MotorDropped = 0;
}
if (_root.DragMotor._droptarget == "/Socket1") {
_root.DragMotor._x = _root.Socket2._x;
_root.DragMotor._y = _root.Socket2._y;
_root.CheckMotorDrop();
} else {
_root.MotorDropped = 0;
}
function CheckMotorDrop () {
//set the speech bubble to give information
_root.txtSpeech = "You have added a motor to the circuit.";
setProperty(_root.DragMotor, _width, 55);
setProperty(_root.DragMotor, _height, 55);
_root.MotorPowered = 1;
_root.DragMotor.play();
_root.MotorDropped = 1;
}
Thanks for your time, Matt.
Drag And Drop - When Drop Targets Overlap
Hi,
Please see
http://www.paraminionstudios.com/dump/PleaseHelp.zip for the files I'm requestiong help on (upload tool is not working).
Drag and drop the power generator "icons" on the left of the screen into the designated areas in the 3d scene to "install" power generators along the side of the building.
I have 4 designated regions in a 3d rendered scene. there are 4 dragable power generator "icons" on the far left of the screen. When the generator icons are dragged and dropped upon one of the 4 targets, the target mc advances to frame 2 of the target mc, and the generator icon disappears (actually the generator icon mcs simply advance to frame 2 of the mc.. a blank kframe). Frame 2 of each of the targets contains a small graphic of a generator that fits the perspective of the 3d scene.
my problem here is that my target MCs overlap slightly. This is causing some issues. if you have already "installed" generator 1, and you then go to drag another icon just below target1, flash is getting confused because of the overlapping. Is it possible to change the instance name of the target after dropping a generator icon on the target so that the script doesn't get confused? the layer order doesn't seem to have any bearing on anything here as I had hoped.
The file is located (upload tool isn't working) at:
http://www.paraminionstudios.com/dump/PleaseHelp.zip
On "vacation", working for a client. never fun.
Drag And Drop : Drop Options
I have some simple drag and drop code here that works fine. But it is set to let each object go to only one "dropZone". I would like be able to have each object be able to go to any of the drop zoned named "dropZone1, dropZone2, dropZone3....". I wouls also like to have is so you can't put multiple object in one zone. Basically, if the zone is being used, the object will again revert back to it's original place. Actionscript is preety new to me so I have trouble with format. I have tried a bunch of stuff that seems like it would work, but I get wierd results. any help would be much appreciated, thanks.
onClipEvent (load) {
this.origX = this._x;
this.origY = this._y;
}
onClipEvent (mouseDown) {
if (this.hitTest(_parent._xmouse, _parent._ymouse)) {
this.startDrag();
}
}
onClipEvent (mouseUp) {
if (this.hitTest(_parent._xmouse, _parent._ymouse)) {
this.stopDrag();
// see if the dropZone conatins the center of this mc
if (_parent.dropZone1.hitTest(this._x,this._y,true)) {
// center it on the drop zone
this._x = _parent.dropZone1._x;
this._y = _parent.dropZone1._y;
} else {
// return it to its original location
this._x = this.origX;
this._y = this.origY;
}
}
}
Drag And Drop To Any Drop Target
Hi guys....I am trying to create some more generic code for a project im on....infact you guys have already helped me lots in getting it up and running!
I have basicly got it where all the dragObjects and assigned functions within a for loop and therefore been assigned to their own dropTargets...all working fine, however a situation is needed where if a user drops a clip onto anything rather than a hit area it doesnt just register as an incorrect drop.....at the moment a drag that misses a dropTarget will be the same as one that is dropped onto an incorrect drop target and thats just a bit unfair for them as it means they have used up one of only two chances!!!
basicly I need to know if its possible to obtain using the coding style that i already have been whether a drop is onto any of the drop targets before than going to chec if its the correct one or not....sorry for the long winded talk but seemed the only way i could explain!!!
the code i'm using is below
Code:
var Xpos:Number;
var Ypos:Number;
var objects:Number = 2;
for (i = 1; i <= objects; i++) {
// assigning the on press events to the dragObjects
this["dragObject"+i+"_mc"].onPress = function() {
this.startDrag(true);
// assigning the original X and Y of the dragged clips
Xpos = this._x;
Ypos = this._y;
}
// assinging the on release events to the dragObjects
this["dragObject"+i+"_mc"].onRelease = function() {
// finding the number of the dragObject to use in the submitAnswer function
objName = this._name
dragNumber = Number(objName.substr(10, 1));
submitAnswer(dragNumber);
}
}
// function to assertain whether the drop was a successful one - whether dropObecjt1 was dragged on dropTarget1 and so on
// the number is passed from the onRealease function
function submitAnswer(dragNumber:Number) {
this.stopDrag();
// if its dropped onto its correct target then turn the button off, place ontop of its target
if (this["dragObject"+dragNumber+"_mc"].hitTest(this["dragTarget"+dragNumber+"_mc"])) {
this["dragObject"+dragNumber+"_mc"].enabled = false;
this["dragObject"+dragNumber+"_mc"]._x = this["dragTarget"+dragNumber+"_mc"]._x+50;
this["dragObject"+dragNumber+"_mc"]._y = this["dragTarget"+dragNumber+"_mc"]._y+50;
trace ("knob jockey");
} else {
// if it is dropped onto a wrong target then chuck it back to where it started!
this["dragObject"+dragNumber+"_mc"]._x = Xpos;
this["dragObject"+dragNumber+"_mc"]._y = Ypos;
}
}
thanks for any help!!
Drag And Drop To Any Drop Target
Hi guys....I am trying to create some more generic code for a project im on....infact you guys have already helped me lots in getting it up and running!
I have basicly got it where all the dragObjects and assigned functions within a for loop and therefore been assigned to their own dropTargets...all working fine, however a situation is needed where if a user drops a clip onto anything rather than a hit area it doesnt just register as an incorrect drop.....at the moment a drag that misses a dropTarget will be the same as one that is dropped onto an incorrect drop target and thats just a bit unfair for them as it means they have used up one of only two chances!!!
basicly I need to know if its possible to obtain using the coding style that i already have been whether a drop is onto any of the drop targets before than going to chec if its the correct one or not....sorry for the long winded talk but seemed the only way i could explain!!!
the code i'm using is below
Code:
var Xpos:Number;
var Ypos:Number;
var objects:Number = 2;
for (i = 1; i <= objects; i++) {
// assigning the on press events to the dragObjects
this["dragObject"+i+"_mc"].onPress = function() {
this.startDrag(true);
// assigning the original X and Y of the dragged clips
Xpos = this._x;
Ypos = this._y;
}
// assinging the on release events to the dragObjects
this["dragObject"+i+"_mc"].onRelease = function() {
// finding the number of the dragObject to use in the submitAnswer function
objName = this._name
dragNumber = Number(objName.substr(10, 1));
submitAnswer(dragNumber);
}
}
// function to assertain whether the drop was a successful one - whether dropObecjt1 was dragged on dropTarget1 and so on
// the number is passed from the onRealease function
function submitAnswer(dragNumber:Number) {
this.stopDrag();
// if its dropped onto its correct target then turn the button off, place ontop of its target
if (this["dragObject"+dragNumber+"_mc"].hitTest(this["dragTarget"+dragNumber+"_mc"])) {
this["dragObject"+dragNumber+"_mc"].enabled = false;
this["dragObject"+dragNumber+"_mc"]._x = this["dragTarget"+dragNumber+"_mc"]._x+50;
this["dragObject"+dragNumber+"_mc"]._y = this["dragTarget"+dragNumber+"_mc"]._y+50;
trace ("knob jockey");
} else {
// if it is dropped onto a wrong target then chuck it back to where it started!
this["dragObject"+dragNumber+"_mc"]._x = Xpos;
this["dragObject"+dragNumber+"_mc"]._y = Ypos;
}
}
thanks for any help!!
Drop Target In "drag And Drop Game"
Im very much confused that how the code is wrong here..?on (press)
{
startDrag (this, false);
}
on (release)
{
stopDrag ();
if (_droptarget eq _root.cpu)
{
_root.score = int(_root.score + 1);
gotoAndStop(2);
}
else
{
_root.score = int(_root.score - 1);
gotoAndStop(2);
answer.gotoAndPlay("wrong");
} // end else if
}
Here im prepairing a game where i had palce this script inside a movie clip,having two option Correct amd Wrong,
I had created a box name keyboard
where an image of keyboard when placed it should show that its correct,and..if the movie clip calledkeyboardbutton is placed outside then it shoul show its wrong.
keyboardbutton is the instance name for that keyboard,
Actually its a game showing the Process of flow of operation in Computer..
Where i had also used the CPU and Monitor..please anyone help me out here...
here is a sample file for that:
(1)drag Drop In 3 (2)drag Dropin 3 ...print 3 Contents (1)+(2)
i want to do the following.
drag (dynamic text file link)1 of choice of x text file links
into an area where all text file links can then be printed..(the text file itself)
[1] [2] [3] [4] [5]...
(basket)
drag drop [1] then [2] then [3] then [4] into (basket)
then print textfiles related to [1] [2] [3] [4]
if sombody could point me to a good tutorial or help me on my way?
thanx
Hit Area For A Drop Down Menu Button
Hey folks
I have a button called "main" that when is pressed causes a menu consisting of three buttons ie "button1" , "button2" "button3"
to drop down (using masking)
and when the mouse rolls out of "main" ,
the menu goes back up
The problem is the when I press "main" and the menu appears , it goes back up as soon as i try to click or even move the cursor to any of the three buttons
(i.e button1 or button2 or button3 ) due to the fact that the mouse rolls out of "main"
I even inserted a hit area in the button "main"
that covers the area where the menu would be when dropped down but the problems persists even then
What should I do ?
Anakin
Drop Down Menu With Custom Hit Area
I'm having trouble including a drop down menu that is using a custom hit area.
Attached is my FLA.
I used a hitArea for the Documents button and it seems to affecting my ability to click on the other options once it's rolled over. If there is a better way, I'm up for suggestions. Thanks in advance.
Brian
Drage & Drop - Dynamic Area
Hi,
I was working on a website with a draggable menu, when I saw a post about full screen flash website. (See the third code) My menu used to have an area defined like this:
Code:
menu.onPress = function() {
startDrag(this,false, 0, 0, 700, 600)
}
Then after I tried to turn my initial website into a FullScreen flash website, I realised the draggable area had to be constantly updated. I tried this but in vain:
Code:
menu.onPress = function() {
startDrag(this,false, Stage.width, Stage.height, Stage.width-Stage.width, Stage.height-Stage.height)
}
Any idea of how this could be done?
The code was from the guys on this thread:
http://www.kirupa.com/forum/showthread.php?t=268747
and looked something like this
Code:
//stage properties
Stage.align = "TL";
Stage.scaleMode = "noScale";
//set initial positions
backoverlay._height = Stage.height;
backoverlay._width = Stage.width;
backoverlay._x = 0;
backoverlay._y = 0;
contentbox._x = Stage.width/2;
contentbox._y = Stage.height/2;
// end initial position setting
//creates a listener that checks to see if the browser window is resized
sizeListener = new Object();
sizeListener.onResize = function() {
// change movieclip properties when the window is resized.
backoverlay._height = Stage.height;
backoverlay._width = Stage.width;
contentbox._x = Stage.width/2;
contentbox_y = Stage.height/2;
};
Stage.addListener(sizeListener);
}
How To Make A Drag'n'drop Change Mid Drag?
Help! I already know the script to make a Movie Clip drag and droppable.
But how do I make it switch to a different Movie Clip in the middle of being dragged?
Please please help.
Strange Drop Down Menu Hit Area Problems
Hey I started revising a site and came accross a problem... The menu on the left hand side of the site ( www.mcsaia.com) after the intro page...
(its the one that have an orangish background)
The way it is set up right now is ver confusing...There are motion tweens before and after each page frame ( a real pain in the ***) that allow the dropdown menus. I started making a movie for the entire left menu and am having some problems with (i think) layering...
In the attached file is a small trial that I put together...check it out...
When you roll over "Who we are" all of the buttons below it shift down and then the submenu buttons slide in from the left.
***Now picture a small ""imaginary box"" around the "Who We Are" and the submenu buttons.
When your mouse is inside of that box I want the user to be able to roll over the "who we are" and submanu buttons (and have their rollover effects and links work)...Then when you rollout of "The imaginary box" the rest of the main buttons below the "who we are" (i.e. services,portfolio) will shift back up to their respective places.
It seems like this would be simple but I can't make it work right. It seems to be an issue with the "Hit area" but I can't put my finger on it. I've tryed putting movies inside of buttons and buttons inside of movies. I've tryed putting false buttons that only have a hit area and then putting "on(rollout){ _root.gotoandstop(1);}" but that doesn't work either.
If you have a little extra time try playing around with the attached file (or may be easier to start from scratch)...
Thanks (over and over and over),
Jason
Strange Drop Down Menu Hit Area Problems
Hey I started revising a site and came accross a problem... The menu on the left hand side of the site ( www.mcsaia.com) after the intro page...
(its the one that have an orangish background)
The way it is set up right now is ver confusing...There are motion tweens before and after each page frame ( a real pain in the ***) that allow the dropdown menus. I started making a movie for the entire left menu and am having some problems with (i think) layering...
In the attached file is a small trial that I put together...check it out...
When you roll over "Who we are" all of the buttons below it shift down and then the submenu buttons slide in from the left.
***Now picture a small ""imaginary box"" around the "Who We Are" and the submenu buttons.
When your mouse is inside of that box I want the user to be able to roll over the "who we are" and submanu buttons (and have their rollover effects and links work)...Then when you rollout of "The imaginary box" the rest of the main buttons below the "who we are" (i.e. services,portfolio) will shift back up to their respective places.
It seems like this would be simple but I can't make it work right. It seems to be an issue with the "Hit area" but I can't put my finger on it. I've tryed putting movies inside of buttons and buttons inside of movies. I've tryed putting false buttons that only have a hit area and then putting "on(rollout){ _root.gotoandstop(1);}" but that doesn't work either.
If you have a little extra time try playing around with the attached file (or may be easier to start from scratch)...
Thanks (over and over and over),
Jason
Strange Drop Down Menu Hit Area Problems
Hey I started revising a site and came accross a problem... The menu on the left hand side of the site ( www.mcsaia.com) after the intro page...
(its the one that have an orangish background)
The way it is set up right now is ver confusing...There are motion tweens before and after each page frame ( a real pain in the ***) that allow the dropdown menus. I started making a movie for the entire left menu and am having some problems with (i think) layering...
In the attached file is a small trial that I put together...check it out...
When you roll over "Who we are" all of the buttons below it shift down and then the submenu buttons slide in from the left.
***Now picture a small ""imaginary box"" around the "Who We Are" and the submenu buttons.
When your mouse is inside of that box I want the user to be able to roll over the "who we are" and submanu buttons (and have their rollover effects and links work)...Then when you rollout of "The imaginary box" the rest of the main buttons below the "who we are" (i.e. services,portfolio) will shift back up to their respective places.
It seems like this would be simple but I can't make it work right. It seems to be an issue with the "Hit area" but I can't put my finger on it. I've tryed putting movies inside of buttons and buttons inside of movies. I've tryed putting false buttons that only have a hit area and then putting "on(rollout){ _root.gotoandstop(1);}" but that doesn't work either.
If you have a little extra time try playing around with the attached file (or may be easier to start from scratch)...
Thanks (over and over and over),
Jason
Drop Down Menu Doesnt Display Over The Flash Area.
please see the link http://www.opal-stone.com in the top menu, click 'video' to open the video page. then move the mouse over the 'products' link in the top menu. you can see that the products drop down menu doesnt display properly due to the flash image on the video page. please help me to troubleshoot this problem. ask me for any clarifications. thank you for your valuable time and efforts.
Rephrased Title: HELP, PLEASE-button 'down' Then 'up' In Drop Menu Link Area
I'm sorry for repeating the post, I just thought that the title might have confused everyone!
Hi,
The drop down menu I'm referring to is located in the main movie. The menu is a movie clip with the buttons inside and I have each button as 'track as menu item' in the properties. The buttons are linked to external swfs that load into an empty movie clip on the main stage. Everything loads perfectly no problem. The problem is that I can't seem to figure out the right code to put on the sub-menu items/buttons in the drop down menu to show the 'down' state when the corresponding movie is loaded (i.e., about-main button, philosophy [menu item], philosophy movie loaded). Then get it to go back to the 'up' state when another button is pressed in the same drop area part of the menu? I hope I explained myself clear enough without confusing anyone!
I would appreciate any help - I think I'm going to lose my mind - this is driving me crazy!!
Thanks - Alleen
Drag And Drop
Ok folks I have a cd player on the main timeline its turned into a MC instance name player then inside player is a cd that is a button and a MC so
it can be dragged. Also inside player is a box instance name box . Also inside player is MC text instance name txt . What I want to happen is when
you drag the cd over the box it tells the text to play . I have tried to do this with great stress here is the code i have on the cd mc. I can make the cd
drag but I cant get the txt to play when it the cd is drooped into the box.can someone please help
on (press) {
startDrag ("../cd", true);
}
on (release) {
stopDrag ();
if (getProperty("../cd", _droptarget) eq "../box") {
tellTarget ("../txt") {
gotoAndStop (2);
}
}
}
Drag -n- Drop
hi all. i´m kinda new to actionscript. i want to make a floating interface that is draggable. It works so far. check it out: http://www.probus.f2s.com/interface.swf
but now i want an image under the interface that isn´t draggable(it will be visible throught the lens and it will probably contain a magnify-effect)
Is it possible to apply a drag-action to more than one movieclip, or could i apply the drag-action to the whole file by leaving the target-option empty, and simply exclude the image behind the lens?
I hope someone can help me with this.
Drag And Drop
Hello
My dilenma is this?
Im trying to have a drag and drop object lets say a
BOX = a
I wanna drag it to a circle = b
Which in turn will initiate a response = c
How do i do this in actionscript??
Thanks
Drag And Drop
How do you create some dynamic actionscripting in a game for eg.
You have a few ball symbols on the stage and a symbol of a bag. You can only put 5 balls into the bag before you get a meassage that the bag is full. You move the balls into the bag using the startdrag and droptarget actions, the balls can also be removed by dragging them out of the bag again.
I know how to write this code its simple.
But how do you tell flash when the bag is full? What will the code look like?????
Please advise
Drag & Drop...
a common effect im trying 2 achieve here is the DRAG & DROP effect, whereby i'll be using it to navigate through my site. Anyone can help on how it can be done? Thanx
DRAG AND DROP, HELP
Hi there,
I got 7 icons and 7 blank boxes in the movie. All the 7 icons got to be dropped to the right box and if the icon is dropped to the right box then a message "you are right" will appear and the particular box will be high-lighted (its like a signal to tell you that you have dropped the icon to the right box) but if you drop the icon in the wrong box then the icon will go back to the original spot (where the icon was) and a message "please try again" will appear (the box will not be high-lighted because its not the right answer).
I've managed to use the "hit test" action to do it but the message will appear indefinitely.
I will really appreciate it if anybody out there can help me on this.
Please help! Thanks in advance.
Drag And Drop
I try to make a drag and drop button but...
I make one and it works well.
My problem is with 2 buttons.
I drag button1 and all the buttons drag(move)...
I only want drag(move) button1 not all.
I want to drag the 2 buttons but not at the same time.
I want something like that, 8 folders that i can move one then the other and so on...
Best Regards
Drag And Drop Help
I have 3 buttons. I want to drag and drop only one in random order.
My problem is that when i try drag one all the other buttons drag to.
All buttons are in seperate layer(3 layers).
I think i have to put something in target(????).
I try the name i gave to the button but didnt work.
All buttons still drag and drop in the same time.
I only want one in each time.
(supose i learn with 3 then i can use in 12 )
Best Regards
Rui
Drag And Drop
I have 3 buttons. I want to drag and drop only one in random order.
My problem is that when i try drag one all the other buttons drag to.
All buttons are in seperate layer(3 layers).
I think i have to put something in target(????).
I try the name i gave to the button but didnt work.
All buttons still drag and drop in the same time.
I only want one in each time.
The cose i use is:
on (press) {
startDrag ("");
}
on (release) {
stopDrag ();
}
What do i put on the "" ?
I try the name of the button but didnt work.
I dont know how to name a instance on a button, because there is no option available.
Movie Clip - Behavior and "Name"(here i can name a instance)
Button - Behavior and "Option"(here i cant)
I try evan with a Movie clip but that way i have more problems, i only can drag the last layer and when i clik on any part of the scene he drags to.
Because the option Mouse Down and Mouse UP is for the entire scene.
With movie clip i can name a instance but didnt work to.
Hel me please, i'm complited LOST...
Best Regards
Rui
Ps: Sorry to put so many posts but i realy need this fix
Drag And Drop
Does anyone know if it's possible to drag and drop something from one mc to the next, put have it dropped within the mc in a specific frame. Or does it always just appear on top of that mc?
EG:
Drag a circle from MC1 to MC2 to a drop target called square1. MC2 consists of many frames, and the square1 is in frame 20. You drag the circle and it is dropped on the square1. When you move through MC2 the circle should disapper because it was dropped a few frames earlier and now you are in frame 40. Is this possible, or will the circle appear in every frame of that MC it were dropped into?
Let me know if this is unclear.....
L
Drag And Drop Help Please
I am having the worst time trying to make an object dragable in flash5. I have checked the tutes and all of them appear to be for flash4, or I am just really dumb and cant understand. So far the only thing I can figure out is this:
1. convert said object to symbol (button)
2. assign the action on mouse event (press)
3. assign action start drag
I know that those steps are only part of the process, but can someone please help me figure this out? I'm going bald from all the hair I've pulled out. Thanks.
Drag -n- Drop Help...
I have been trying to do the drag-n-drop tut..but for some reason..I can the ball (draggable object) to be shown. It is invisible. Cant see it anywhere. Here it my code:
1. New project. Made new MC>>>> Made ball (button) inside of this MC.
MC name: ballbutton
Instance name: ball
2.Gave button inside MC the actions of:
on (press) {
startDrag ("/ball", true);
}
on (release) {
stopDrag ();
}
3.Dragged movie to the stage.....all worked fine 'till here!
4.Made new MC "hole"...and made graphicimage of a "hole" inside of MC. Dragged that MC to the stage/
5.Went to "ballbutton" MC and added this code to the instance/button inside the MC:
on (release) {
if (GetProperty ("/Ball", _droptarget) eq "/Hole") {
setProperty ("/ball", _visible, "0");
}
}
6.Added a new layer (just for actions)
Frame 1: if (getProperty ("/ball", _visible )=0) {
nextScene ();
}
Frame 2: gotoAndPlay (1);
Can somebody tell me what I am missing...or where a good "EASY" tut on this would be? Thanbks -whispers-
Why Can't I Drag And Drop?
Isn't the way to get a button to a frame in a movie simply to drag it there from the library? well I can't do this. I can select it but it hops back to the library when I release the mouse. what gives?
Drag And Drop
I am work on the "Laser Effect" Tutorial and I can't pass the :
Drag a copy of the "line" symbol into the first frame of the TEMP layer and center it
Drag a copy of the "ball" symbol into the first frame of the LASER CONTACT layer
How do I drag a object into a frame.
DRAG AND DROP
hey, i really need to know how to drag and drop something in a movie, without dragging the ENTIRE SCREEN! if you know how to do it, please help me, its not that hard, im probably just being a dumbass! this is my code right now :
on (press) {
startDrag ("");
}
on (release) {
stopDrag ();
}
PLEASE HELP!
(ps. this is totoally irrelevant but do you know how to actionscript keyboard into your game or interactive movie?)
DRAG A & DROP
NEED HELP!!
What is a simple way to Drag & Drop buttons from one
stupid thing to the next stupid thing??
Drag And Drop
If you have made a movie clip and are able to drag it, how do you make it go to a specific place when you release it? And how do you make it go back to the starting position if the place where you released it is the wrong one?
Drag And Drop
I would like to know how you specify an area where you can drop a movie clip and how you make it go back to the original position if it's dropped outside that area. (I have Flash 4).
Drag & Drop
I am trying to make a project in which users drag shapes back to their original spots (after they have been rearanged in an animation.) I am using Flash 5 and would appreciate any help with getting the objects to drag and drop correctly. If someone could maybe show me and example of something similar it would be a great help. Thanks.
- Gogeta
Thanks On The Drag Drop
Thanks to everyone who gave me hand and pointers in the right direction the ( its a drag and drop with return to orginal postion if note a certain area and reaets another clip to orginal x and y)
on (press) {
_root.movieclip02._x = 670;
_root.movieclip02._y = 284;
startDrag (_root.movieclip01);
}
on (release) {
stopDrag ();
if (this.movieclip01== (parent.drop_areaMC)) {
_root.movieclip01._x = 670;
_root.movieclip01._y = 359;
tellTarget ("_root.anim_clip") {
gotoAndPlay (2);
}
} else {
setProperty ("", _y, OrgY);
setProperty ("", _x, OrgX);
}
}
Thanks On The Drag And Drop
Thanks to everyone who gave me hand and pointers in the right direction the ( its a drag and drop with return to orginal postion if note a certain area and reaets another clip to orginal x and y)
on (press) {
_root.movieclip02._x = 670;
_root.movieclip02._y = 284;
startDrag (_root.movieclip01);
}
on (release) {
stopDrag ();
if (this.movieclip01== (parent.drop_areaMC)) {
_root.movieclip01._x = 670;
_root.movieclip01._y = 359;
tellTarget ("_root.anim_clip") {
gotoAndPlay (2);
}
} else {
setProperty ("", _y, OrgY);
setProperty ("", _x, OrgX);
}
}
DRAG En DROP
ok guys
i have one square and five circles
you can drag the circles
now what i want to do is;
when you drag circle 1 to the squar and drops it in the square, movie 1 starts playing
when you drag circle 2 right in the square movie2 starts playing
.............
how should i make this?
how can i make the box sensitive for the circles? and
how does it knows wich circle is dropped?
thx guys
Drag And Drop O Fun...
So i made a little drag and drop interactive thingy, you drag parts of a face onto the face, you know what im talking about. But the problem is, there were a lot of clips, so i put it in a clip, that when an arrow is clicked back or forth a couple more face pieces are displayed. But now the draging or dropping wont work, but it works fine when not put into a clip!
help!
Drag And Drop
Hey, if I have a bunch of draggable movie clips, how do I bring the clip I'm dragging to the top? (Rather, on top of the other MCs.)
Drag And Drop
what does the .pop() do ?
if (_droptarget.split("_", 2).pop() eq "1")
p.s.
I am looking for a good example of a drag and drop interaction I can use. If you know of any I would appreciate it.
|