_Droptarget Help
I'm currently making a guessing game where you have to put the correct tie on a character. You have 5 ties to choose from and a couple of pictures will give you a hint what tie is the correct one. I have made the ties draggable and made a target for them but my problem is I want to change frame when the correct tie has been dragged over to the target. How do I do that? Right now all that happens is that the tie sticks to the target. Here's the code I use for the draggable MC:
on (press) { startDrag (getProperty(_x, _y)); } on (release) { stopDrag (); if (_droptarget eq "/!Target!") { nextFrame (); } else { setProperty ("", _y, OrgY); setProperty ("", _x, OrgX); } }
Man it's giving me a headache! Any help would be much apriciated! : )
Kind regards
- Sune Jensen
FlashKit > Flash Help > Flash ActionScript
Posted on: 01-06-2002, 09:52 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
_droptarget
At the moment I have 2 mc's. I want to have a situation where if you drop one on top of the other they both disappear. I have used a simple _droptarget script for both of them using the target as each other (see below)
on (press) {
startDrag ("/no1");
}
on (release, releaseOutside) {
stopDrag ();
if (getProperty("/no1", _droptarget) eq "/no1a") {
setProperty ("/no1a", _visible, "0");
setProperty ("/no1", _visible, "0");
}
}
unfortunately the code only seems to work for one of them ie you can drop one on top of the other and they disappear, but if you try the other way around they dont.
Any suggestions? Thanks.
_dropTarget Help?
Does anyone out there know how i could convert the reference returned from
x = eval(myMovieClip._dropTarget);
into a string which can be manipulated, and then the new string being reverted back to a refernce?
when I try to do string manipulations (such as x.indexOf(string);, etc)to the returned value, I consistantly get a return of nAn. Any ideas?
HITdrumHARD
_droptarget
hi.
ive created some draggable menus, but now it would be great if i could get them to snap into a location.
i am using the standard button, in movieclip for the draggable items.
i am trying to implement this script on my main timeline, but it is failing:
on (press) {
startDrag ("..:company");
}
on (release) {
stopDrag ();
if (..:company._droptarget == "_root.companyTarget") {
trace ("well done");
}
}
if anyone has any insight as to how i can make this work, i would totally appreciate it. thanks,
jennifer
Need Some Help With _droptarget
ok guys this has really been bugging me and id appreciated if someone could help me out here is my code
on (press) {
if ((_root.quiz.drag1._droptarget == "/box1") && (_root.quiz.drag2._droptarget == "/box2") && (_root.quiz.drag3._droptarget == "/box3") && (_root.quiz.drag4._droptarget == "/box4")) {
if (right == 1) {
right = 0;
score += 1;
}
}
}
basically i have instance drag 1,2,3,4 inside a quiz movie clip and id like it to calculate the score if drag1-4 is dropped into box 1-4. i dropped it over the box right but it still doesnt add the score. any ideas?
_droptarget
how do you check if a mouse is over a specific mc with _droptarget...I know I've done it before I just can't anymore
Possible _droptarget Bug
I just discovered an unexpected behavior for _droptarget in Flash 6 player that is different than flash 5 player.
The problem occurs when you have have a button containing a text box within a movie clip. Flash considers the drop target to be the instance of the textbox not the mc.
To reproduce the problem, use the code below with two different mcs.
Code:
on(press){
trace("pressing: " + _name);
startDrag(this);
}
on(release){
stopDrag();
trace("dropped onto: " + _droptarget);
}
If you have two simple mcs only containing buttons you will get correct output similar to the following:
"pressing: mc2"
"dropped onto: /mc1".
if you add a text box to the button and give the button an instance name "button" you get the following output:
"pressing: mc2"
"dropped onto: /mc1/button/instance1
So it actually considers the textbox as a movie clip and returns it in _droptarget instead of just the target path to the movie clip.
If you remove the text box the output reverts to the correct value, which is movie clip's target path. Flash 5 does not interpret buttons and textboxes as part of the _droptarget value, probably because it does not support instance names for these movie objects.
anyone else run into this problem?
_droptarget
i am try to use a movie clip to run a photo gallery.
by dragging the object over a thumbnail image it will then show the large image in a holder on the side. i got some limited results using _droptarget but i would also like to pull the images dynamycally using a .txt file.
th_1.loadMovie("images/faces/"+image1, 0);
if (getProperty("lens", _droptarget) eq "th_1") {
controller.loadMovie("images/faces/slides/SL_1.jpg", 0);
}
on (press) {
startDrag(_root.lens, false, 40, 42, 310, 305);
}
on (release, releaseOutside) {
stopDrag();
}
_droptarget And Such
Please enlighten me. I am working on a checkers game, and my current problem is as follows:
I can easily see where the piece is going to land by getting the _droptarget, since all of my fields (a1-h8) are mc's. However, i dont know how to figure out where the piece is currently sitting, like its starting location. Is there anything like a _droptarget for a piece that didnt move yet.
Again, im just trying to get the name of the mc where my piece is sitting on before a move.
Thanks for your help.
EDIT
im using Flash MX 2004
_droptarget
Hi guys,
I am just wanting to know how to do, hopefully something simple.
I have a logo which I can drag around the screen. When I drop this logo over a particular area I call a fuction to run. This works perfect except the fact it doesnt work, if that makes sence.
When I drop the logo over an area the function runs for the home page but I am loading an external swf file into a container and the external swf has set "drop zones". The function runs but for the whole loaded swf not just the "drop zones".
Below is the code I am using:
onRelease = function() {
stopDrag();
if (_root.mov_logo._droptarget == "/mov_home_drop") {
trace("Logo")
unloadMovie ("_root.mov_content_holder");
loadMovie("slideshow.swf","_root.mov_content_holder");
loadMovie("frank_says.swf","_root.mov_frank_animation_holder");
}else
if (_root.mov_logo._droptarget == "slideshow.swf", main.sequences.sequence1.mov_mp3_1){
trace("MP3 1");
}
}
Can someone please help me fix this?
_droptarget & Eq
I have problem i didn't use flash when it was in version 4 and i stumbled on this code and would like to know what does this "eq" mean and how could i write this line in flash 5-6-7 style
if (_droptarget eq "/bad6") {}
and should i use hitTest instead of droptarget.
Sharing A _droptarget
am i correct in assuming that several drag and drop MC can share a single droptarget? because i think you can, but it doesn't seem to be working with my script:
on (press) {
startDrag ("");
}
on (release) {
stopDrag ();
if (_droptarget eq "/targetarea01") {
gotoAndPlay (6);
} else {
setProperty (_root.posterMC, _x, 61.0);
setProperty (_root.posterMC, _y, 26.0);
}
}
what am i doing wrong?
Help Help Emergency _droptarget
We have made a .fla with drop targets and can not figure out why it does not work. we made several identical flashes that do work. can anyone help us figure this out.
the numbers in the gray area at the top should stick to the correct green box below
ours don't stick
the button (numbers that are draggable) is in a MC named drag1 inside a MC named DT1
the target is also in DT1
the file is at http://www.webinservice.com/testregion/match.fla
_dropTarget And _target
As a test i made two squares.
www.dns.ca/squares.swf
I'm just wondering how the HIT works. Does at least 50% of the _dropTarget need to cover the _target or does it have to do with something else?
Code on blueButton
Code:
on (press) {
startDrag("",true);
}
on (release) {
stopDrag();
if (_root.blueSquare._dropTarget == _root.greenSquare._target) {
_root.myText = "HIT";
}
else {
_root.myText = "Miss";
}
}
_droptarget In A DraggablePane
I am building an application where users can drag items from one draggable pane to another. It works fine until I drag the pane that has the target movies in it. Once the pane is dragged, however, and then try to drag an item from the other pane, the movie does not recognize when the smaller item is over its target, using _droptarget. Anyone know how to make this work?
Dynamic _droptarget
Can you reference a drop target with a variable that relates to an instance in the scene...
eg:
(in textfile this gets set)
question_id=U1T2S1Q3&drag1_U1T2S1Q3=drop1
(on root this gets set)
drag1target = this["drag1_"+this.question_id];
(in MC this gets set)
if (getProperty("/drag1", _droptarget) eq "/drag1target") {
cheers
_droptarget Issues
I have a problem with a simple piece of drag and drop interactivity, I know what the problem is but i don't know how to fix it!
I am loading movies on top of a base movie, i.e all my working swf's are on level one. For some reason I can't get flash to find my _droptarget on level1. here's the code
on (press) {
startDrag ("_level1.mindMC", true);
}
on (release, releaseOutside) {
stopDrag ();
if (getProperty (_level1.mindMC, _droptarget ) eq "/hole3") {
setProperty ("_level1.mindMC", _x, "633.6");
setProperty ("_level1.mindMC", _y, "304.2");
setProperty ("_level1.tick3", _visible, true);
_level1.responseMC.nextFrame();
} else {
setProperty ("_level1.mindMC", _x, "381.6");
setProperty ("_level1.mindMC", _y, "235.6");
}
}
I know "/hole3" is wrong but even when I change it to "_level1.hole3" it still doesn't work- does anyone have any suggestions, please
_droptarget Issues
I have a problem with a simple piece of drag and drop interactivity, I know what the problem is but i don't know how to fix it!
I am loading movies on top of a base movie, i.e all my working swf's are on level one. For some reason I can't get flash to find my _droptarget on level1. here's the code
on (press) {
startDrag ("_level1.mindMC", true);
}
on (release, releaseOutside) {
stopDrag ();
if (getProperty (_level1.mindMC, _droptarget ) eq "/hole3") {
setProperty ("_level1.mindMC", _x, "633.6");
setProperty ("_level1.mindMC", _y, "304.2");
setProperty ("_level1.tick3", _visible, true);
_level1.responseMC.nextFrame();
} else {
setProperty ("_level1.mindMC", _x, "381.6");
setProperty ("_level1.mindMC", _y, "235.6");
}
}
I know "/hole3" is wrong but even when I change it to "_level1.hole3" it still doesn't work- does anyone have any suggestions, please
_droptarget Always Blank
for some reason I am unable to get flash to return a value for _droptarget
I have a movie clip with a button. Attached to the button I have:
Code:
on(press){
startDrag(this);
}
on(release){
trace(this._droptarget); // always returns blank
stopDrag();
}
The clip drags fine but when I release the button the script prints a blank for _droptarget even if I drop on top of another mc. It doesnt even trace the _root timeline's target path if I drop anywhere on the stage. What am I doing wrong (must be something simple)?
Problem With _droptarget
Hi, I'm having a problem with my drag and drop movie. Here is the code:
on (press) {
startDrag(this, true);
this.swapDepths(100);
}
on (release) {
stopDrag();
if (this._droptarget == "/fossilhead") {
setProperty("/draghead", _visible, "0");
setProperty("/fossilhead", _alpha, 100);
}
} else {
setProperty("", _x, orgX);
setProperty("", _y, orgY);
}
}
This code works fine when I run it, however, when I load this as an external swf into another movie, the droptarget absolutely will not work. What am I doing wrong?
Any help would be greatly appreciated.
Thanks, Darren
_droptarget Help Por Flavor
Hey all-
I, as bored as I am at the moment, with a $700 program at my disposal am making a weight converter. This involves dragging and dropping the weights to a scale. In ASDG2, it has this ex. for _droptarget :
code: s1.origX = _x;
s1.origY = _y;
//and later
s1.drop = function() {
this.stopDrag();
if (this._droptarget != "/area") {
this._x = this.origX;
this._y = this.origY;
}
};
What is the way to specify where the origX and origY are? Whenever this goes into action, it redrops at 0,0 (upper left corner).
Also, I am unfamiliar with slash notation. What is up wit' it?
_droptarget Frustration
Ok folks. What am I doing wrong?
In the code below:
c1= a movie clip on the main timeline
c1dropoff=a movie clip on the main timeline
When c1 is dropped onto c1dropoff, c1dropoff should go to and stop on its own frame 2. What have I done wrong.
on (press) {
startDrag("_root.c1");
}
on (release) {
stopDrag();
if (_root.c1._droptarget == "/c1dropoff") {
_root.c1dropoff.gotoandStop("2");
}
}
Thanks for all of your help.
_droptarget [AS2] MX 2004
Hello,
this._droptarget returns things like _level0.honey1_mc3.honey_mc
or in my trace Honeycomb = _level0.honey2_mc4 was dropped on _level0.honey2_mc3.honey_mc. Is the way of getting rid of the _level0 and the instance the clip was made from (dynamically created) or is it just a matter of string manipulation?
Thanks,
Indoda
_droptarget Issue
Hi there,
I'm trying to slide a button over a certain area - and on that happening have my movie go to a new part of the time line. I'm currently using the code:
slider_btn.onRelease = function(){
stopDrag();
If (this._droptarget == mc_screen.mc_slider.green_box)
_root.gotoAndStop(2);
}
The problem is that with this code, the stopDrag doesnt work at all, and if I release the mouse anywhere (not over "green_box") I'm returned to _root, keyframe 2.
If I remove the code: _root.gotoAndStop(2); the stopDrag works again, but obviously I've lost the _droptarget functionality.
Can anyone help, its driving me nuts!!
Thanks, J.
What Does _droptarget REALLY Return?
I'm working in Flash 8 Pro on a PC. I've got an object that I'm dragging and dropping, and of course, Macromedia was nice enough to include the _droptarget function. It works fine until I want to compare it to a static string.
In the Help View, it simply shows that you can make a comparison on just the object instance name.
Example (from LiveDocs):
Code:
if (eval(this._droptarget)) == trashcan_mc) {
The issue I'm having is that _droptarget is returning more than just the instance name.
Code:
trace(eval(this._droptarget));
returns "_level0.trashcan_mc"
I've searched google for the last hour trying to find a thread where they too have had a different result than what is listed in LiveDocs. No luck. Every example ppl list as the solution doesn't mention that the level is included in _droptarget and that an adjustment needs to be made to the comparison:
Code:
if (eval(this._droptarget)) == _level0.trashcan_mc) {
So waht, right? Just account for it! Well, there is an issue that comes up when loading this SWF into another.
Let's say I have a SWF with a movieclip that has the instance name of "empty". Now, I run a loadMovie command for the SWF that has the _droptarget in it and the loadMovie target is "empty". Once it's loaded, it no longer works.
Code:
trace(eval(this._droptarget));
returns "_level0.empty.trashcan_mc"
Very annoying.
Am I a special case in this? Am I the only one getting this kind of read from _droptarget? Does anyone have a solution other than compensating for "empty", which I'm sorry to say would make this some hardcoded crap?
Thanks for your time.
Cant Find _droptarget
I have a drag-and-drop interaction that I can't seem to get to work. I think it has something to do with the fact that my drag-n-drop swf is loaded inot another move. Here's how it works:
On my stage, I have a target movie clip that's named "shirtTarget".
Then I have four movie clips that you can drag on top of "shirtTarget". The code in each of these movies is as follows:
Code:
on(press) {
startDrag(this,false);
}
on(release) {
stopDrag();
if (this._droptarget == "/shirtTarget") {
trace ("you're soooo special");
} else {
trace("you did something wrong");
}
}
So... When I test the swf by itself, it works great. I can drop my movie clips onto the target and everything works as it should. However, when I load this movie into my parent movie clip, I cannot 'drop' the draggable clips onto the target - it's like the target isn't even there. I have tried to set this.lockroot = true; in the main action timeline, but that didn't work either. I'd certainly appreciate any help! Thanks!
_droptarget Persist Bug
Hi All,
I am having trouble with a bug in _droptarget. I have a simple _droptarget check in a game for a client. If you drop the item on the rght area, you get a point and a function is called. However, the droptarget check is only run properly once. The second time(once you complete it the first time and click "replay"), it remembers its last droptarget property. Somehow it seems to persist, which is kinda weird. Any ideas?
--Alan
Dragging And _droptarget
ok, seems that ActionScript 2.0 and I are getting good friends
Code:
// ActionScript 2.0: power-up! :)
// Function to make draging easier on each call
DragMe = function(clip)
{
if (clip.hitTest(_root._xmouse, _root._ymouse, true))
{
startDrag(clip);
}
return;
}
// Let's drag our little square
square.onMouseDown = function()
{
DragMe(this);
}
square.onMouseUp = function()
{
stopDrag();
if (this._droptarget == "/circle")
{
trace("Estamos sobre el circulito"); // we're on circle
}
}
// Let's drag our circle
circle.onMouseDown = function()
{
DragMe(this);
}
circle.onMouseUp = function()
{
stopDrag();
if (this._droptarget == "/square")
{
trace("Estamos en el cuadrito"); // we're on square, even without targetting
}
}
My only ploblems is that sometimes when I move the 'square', without targeting to 'circle', trace is called from circle, any ideas?
PS: Both are MovieClips
Multiple _droptarget?
Hi everyone
I am making a quiz with multiple drop targets, not where the answer is right or wrong and where one drop target matches one mc.
So I was wondering if _droptarget can be used for multiple drop targets or is hit test the way to go?
Thanks for your time ;)
regards
Michael
_droptarget Issue
Hi there,
I'm trying to slide a button over a certain area - and on that happening have my movie go to a new part of the time line. I'm currently using the code:
slider_btn.onRelease = function(){
stopDrag();
If (this._droptarget == mc_screen.mc_slider.green_box)
_root.gotoAndStop(2);
}
The problem is that with this code, the stopDrag doesnt work at all, and if I release the mouse anywhere (not over "green_box") I'm returned to _root, keyframe 2.
If I remove the code: _root.gotoAndStop(2); the stopDrag works again, but obviously I've lost the _droptarget functionality.
Can anyone help, its driving me nuts!!
Thanks, J.
_droptarget Issue
Hi there,
I'm trying to slide a button over a certain area - and on that happening have my movie go to a new part of the time line. I'm currently using the code:
slider_btn.onRelease = function(){
stopDrag();
If (this._droptarget == mc_screen.mc_slider.green_box)
_root.gotoAndStop(2);
}
The problem is that with this code, the stopDrag doesnt work at all, and if I release the mouse anywhere (not over "green_box") I'm returned to _root, keyframe 2.
If I remove the code: _root.gotoAndStop(2); the stopDrag works again, but obviously I've lost the _droptarget functionality.
Can anyone help, its driving me nuts!!
Thanks, J.
_dropTarget Promblems Here
I just create a _dropTarget action and it looks fine.But when i load it to a movie , the _dropTarget action just wont work......
Anybody here know why?
_droptarget To Detect Non-top Object
Hi Folks,
I have a number of objects on the screen which I wish to colour modify via a drag-drop approach and setTransform.
This works OK but, where we have added "shadows" (alpha, greyscale overlays) on top of the objects, these now become the "_droptarget".
Is there anyway to get Flash to mark certain layers or objects (i.e. my shadows) not to seen by the _droptarget call so that it is the underlying object that gets "hit"?
Thanks in advance,
Chris. :-)
Defining A Bounded Box For _droptarget?
Is there any trick one can pull to define a boundary for the _droptarget property? I have a number of icons on a desktop that can be dragged and dropped over each other (they double as folders once they have contents), this works fine except I have to have a really large text field for their names (incase they have a long name) and although it is transparent it sometimes gets in the way of the real target if it is on a higher level. Wish there was an autosizer for textfields....
a really bad diagram (makes more sense in courier):
(i)icon_name======(=)===n_name=======
(the icon on the left is covering over the icon on the right because the text field for it's name is too long ("====" is empty/transparent space in the textfield). so you can't use _drogtarget to get to the icon on the right.
thanks for any suggestions.
Zach.
Get _droptarget To Recognize Invisible Mc?
Is there a way to get mc._dropTarget to recognize a hidden MC it drops on?
I have am trying to drag drop a movie clip item onto a 9 by 6 grid. The user should not see the grid. Each grid cell has a number of properties, including an animation that plays in it depending on what is dropped in it. What is the best way to do this. I came up with two ways:
A. Do the math:
1. Figure out what the drop point x and y values would convert to in the grid to find the grid cell it applies to.
2. Attach a new movie clip animation to that cell's centered x,y point to show something happened there.
B. Fill the grid with Movie Clips:
Use the mc._droptarget to see what grid cell movie clip was dropped on and then change its animated state to show something happened there.
The problem with A is that it is a little slow and cumbersome.
The problem with B is that I can't let the user see the cell movieclips. mc._droptarget only works to detect if a mc was dropped on visible graphic area of another mc as far as I can tell.
I could sure use some help on this. Is there a better way?
- Wade
_droptarget Does Not Seem To Target Correctly
amongst other code on a draggable MC with a buton in it i have the following code on (release)
=======================================
on (release) {
if (this._droptarget=_parent.target) {
// do what i tell you to do!!
}
}
=======================================
for some reason it appears that the droptarget is not testing whether i am over the target clip, and automatically runs the "do what i tell you to do!" script wherever i drop the draggable MC
Any clues as to why
thanks in advance
gilesb
Draggable/_droptarget Question
Hello all,
Here's my problem. I have a few MCs with, 7 in all, that are dragable. There is also a _droptarget. All this works fine. What I want to do, and am not sure how to go about it is, when all draggable clips are dropped in the right location I want to load a button. Here is my AS on the draggable clips.
on (press) {
startDrag(this);
}
on (release) {
stopDrag();
if (eval(_root.holder2.cha7._droptarget) == _root.holder2.chaLine) {
setProperty(_root.holder2.yinYang, _visible, true);
} else {
setProperty("_root.holder2.cha7", _x, "610");
setProperty("_root.holder2.cha7", _y, "38");
}
}
Right now the button is set to _visibility false whwn the page loads. The only problem is a have a yinYang for each draggable clip because I could not figure aout another way to do it. That's not what I want. I want the button to load only when all the MCs are droped on their target locations. I hope that all made sense.
I would greatly appreciate any help. Thanx ahead of time.
Testing _droptarget With An Array
I am working on a tile-based map generator. As of now I have each box in the grid as a seperate movieclip with a text box inside, and when I drag a tile onto it, the box will be assigned a number.
Here's my code for the tile to be dropped, it's a button inside of an mc:
Code:
on (press) {
startDrag("_root.part1");
}
on (release) {
stopDrag();
for (var i = 0; i<2; i++) {
if (_root.part1._droptarget == _root["box"+i]) {
_root["box"+i].text = "1";
}
}
_root.part1._x = 112;
_root.part1._y = 216;
}
The problem is that I don't know how to check a droptarget value of an array. Another problem is that when I just choose a box for the droptarget for testing purposes, instead of changing the value of only the box I dropped the tile in, it changes the value of all the boxes.
Using '_droptarget' In Loaded Movies
Hello again
I'm trying load a MC that has uses '_droptarget'
Since the movie I load is placed on _level2
I cannot get the following code to work even though I'm using "_level2" as part of the path of each movie clip.
if (eval(garbage._droptarget) == _root.trash) {
garbage._visible = false;
}
Can someone please enlighten me on the relationship between loaded MCs and the MCs they are loaded into
If I'm not making any sense--sorry
I'm just really confused
Thanks!
_droptarget With External Swfs HELP
ill try to explain this the best i can
i have an external swf loaded into a main swf. the external swf contains a drag and droptarget function that works correctly when its by itself, but when its loaded into the main swf and the actionscripts are modified to to make up for the extra layer, the drag function works but the droptarget doesnt work. it cant seem to recognize the droptarget MC.
is there something im missing when it comes to droptargets that dont allow it to work if it goes more than 2 layers deep?
im completely stumped and frustrated.
Problem With _droptarget In A Class
i'm building a system where you can drag and drop colours from a pallette onto a striped shirt design, so if you drop colour X on a stripe designated A, all stripes designated A will become that colour.
simplest way i though was to loop through the _droptargets parent element and using setRGB on the relevant stripes.
this works fine *within* a movie, but for reasons of extensibility and less coding i've placed into a class where it doesn't work
anyone any ideas?
heres the code for the class:
code: class PalletteColour extends Stripe{
// declarations
var pc_mc:MovieClip;
var posX:Number;
var posY:Number;
// constructor
public function PalletteColour(passed_mc:MovieClip){
// assign passed mc to our class member
pc_mc = passed_mc;
}
public function onPress () {
posX=this._x;
posY=this._y;
startDrag(this);
}
public function onRelease () {
stopDrag();
if(this._droptarget.indexOf("Stripe")>=0){
var strType, strType2, strX:String;
var name;
strType=this._droptarget.substring(this._droptarge t.length-1, this._droptarget.length);
var colours = new Color(this);
strX=getProperty(this._droptarget, _target);
/*for (name in getProperty(strX, _parent)){
if (typeof (_parent[name]) == "movieclip") {
strType2=_parent[name]._name.substring(_parent[name]._name.length-1,_parent[name]._name.length);
trace(_parent[name]._name);
if(strType2==strType){
var colours2 = new Color(_parent[name]);
colours2.setRGB(Number(colours.getRGB()));
}
}
}*/
}
this._x=posX;
this._y=posY;
}
public function setColour(colColour:Color, mcTarget:String){
var colours = new Color(mcTarget);
colours.setRGB(colColour);
}
}
thanks in advance
Reset _droptarget Property
Hi I got a drag and drop interaction with 4 drag options and 8 drop targets. I need to reset the drag options after first atempt.
function reset() {
for (i=0; i<13; i++){
_root["drag"+i]._x = xDragArray[i];
_root["drag"+i]._y = yDragArray[i];
}
}
This function works well to reset the position of the drag objects. Hoewever it does not reset the _droptarget property. If I do a trace of:
trace("droptarget reset: "+_root.drag0._droptarget) after I called the reset function, the value is still the same.
I tried to add the following to line to the function, but no luck.
setProperty(_root.drag0._droptarget, _droptarget, "");
evan
setProperty(_root.drag0, _droptarget, "");
Please I need help urgently on this problem.
[F8] [AS2] Quick Questioon About _droptarget
I understand that MC._droptarget can display the name of a movie clip directly under the one used to call _droptarget, when using startDrag() and stopDrag() functions.
I am wondering if there is a property which can be accessed that displays this information without using startDrag() and stopDrag();...
Thanks so much for your time, you will save me a couple of days worth of code =P !
Assigning Values To _droptarget
hi i was wondering if anyone knew if it was possible to assign values or to assign to null to _droptarget property of a movieclip
Thanks
Al
_droptarget Addressing Problem
Hello-
I've got an issue with _droptarget. My script works fine as long as I keep it within a siingle SWF, but when I try to load the SWF into an instance, it breaks.
Ideally, I want to load the SWF that contains this code into an instance called "place1" that's nested inside another MC called "nestedMenu". (_root.nestedMenu.place1):
================================================== ==
on (press) {
startDrag ("");
oldX = _x;
oldY = _y;
}
on (release, releaseOutside) {
stopDrag ();
if (eval(_parent._droptarget) == mytarget) {
_root.gotoAndPlay(3);
} else {
_x = oldX;
_y = oldY;
}
}
================================================== ==
I've changed the eval to absolute (eval(_root.nestedMenu.place1._droptarget) and tried using the same address with _level0 instead of _root and it still doesn't find the target.
Any suggestions? Thanks...
Loadmovie, Problem With (_droptarget ==)
Hi all
I have problem with loadmovie that drive me crazy!. I made a drag and drop quiz (attached) that works perfectly but when I load it in another movie it doesn’t work anymore!
The code that doesn’t work is:
if (getProperty("/face1", _droptarget) == "/box3")…
when the drag touch the target it should stay there.
I attached the fla. If you have an idea it would be a great help!
Thanks
Herny
Attach Code
stop();
function moveback () {
face1._x = 23;
face1._y = 95;
face2._x = 146;
face2._y = 95;
face3._x = 270;
face3._y = 95;
face4._x = 22;
face4._y = 230;
face5._x = 149;
face5._y = 230;
face6._x = 268;
face6._y = 230;
result = "Try again!";
}
function snap (){
if (getProperty("/face1", _droptarget) == "/box3") {
face1._x = 683;
face1._y = 89;
}
if (getProperty("/face2", _droptarget) == "/box2") {
face2._x = 559;
face2._y = 95;
}
if (getProperty("/face3", _droptarget) == "/box1") {
face3._x = 439;
face3._y = 90;
}
if (getProperty("/face4", _droptarget) == "/box1") {
face4._x = 439;
face4._y = 205;
}
if (getProperty("/face5", _droptarget) == "/box2") {
face5._x = 558;
face5._y = 213;
}
if (getProperty("/face6", _droptarget) == "/box3") {
face6._x = 680;
face6._y = 213;
}
if (getProperty("/face1", _droptarget) == "/box3")
if (getProperty("/face2", _droptarget) == "/box2")
if (getProperty("/face3", _droptarget) == "/box1")
if (getProperty("/face4", _droptarget) == "/box1")
if (getProperty("/face5", _droptarget) == "/box2")
if (getProperty("/face6", _droptarget) == "/box3"){
result = "All correct."
}
}
Problems With _droptarget And Loadmovie
Hi everybody!
I have a huge problem here. I'm doing a website which loads the contents on level 1. The problem is that one of those contents is a game where I use the droptarget action. When I probe the swf it works fine, but when I probe it using the interfaze (where is the button that loads the content on level 1) it doesn't work.
What am I doing wrong?
Please help!!!
Trouble Finding _droptarget With A Swf
Hi all,
I am having trouble in finding target in a drag drop scenario. I have a movie placeholder named onepic1 and i load a movie using
Code:
onepic1.loadMovie(this.img1lnk);
I load the img1lnk variable externally using
Code:
img1lnk=onepic1.swf
The SWF loads into the placeholder, NO PROBLEM in that!
And I identify a dragged object into that movie using
Code:
if (_droptarget eq "/onepic1") {...}
The problem is that it istnt going inside the IF logic. Previously i had
Code:
img1lnk=1pic1.jpg
and it worked. But when i replaced it with a .swf, it istnt working.
Am i missing something??
Replies appreciated!
Regards,
Vasanth
_droptarget Not Working If Not On _root
http://www.kirupa.com/developer/acti...t/dragdrop.htm
i did this tutorial, but for the life of me i just cant get the droptargets to work if the objects arent on the root timeline.
can anyone please lend a hand
How To Read A _droptarget Variable
Hi,
I'm doin' a note training game, were you're supposed to drop notes in the right places. To find out if you droped your note in the right place i figured that I would store a variable in each note that tells me which note I'm dragging. Now I want to compare that variable with the variable stored in each droptarget.
For example:
the note to be dragged's variable: _root.a_mc.deNote = a;
the droptarget's variable: _root.a_drop.dropNote = a;
when I now drop the "_root.a_mc" on the "_root.a_drop" I want to compare the two variables, and I thought that this was possible via _droptarget, but I cannot get access to the variable "_root.a_drop.dropNote". I've tried the eval() function with no luck.
Does anyone know if this is possible and if so how?
(see attached working copy)
thanks, Ollu
|