Droptarget Advice Please
Can you have more than one drop target area? I want to create an additional area to the one I have (exsisting on is called 'state' new one to be called 'add') anyone?
on (press) {
startDrag(getProperty(_x, _y));
}
on (release) {
gotoAndStop(2);
stopDrag();
if (_droptarget eq "/state") {
_root.correct_count = _root.correct_count+1;
}
setProperty("", _y, OrgY);
setProperty("", _x, OrgX);
}
FlashKit > Flash Help > Flash MX
Posted on: 07-24-2003, 04:55 AM
View Complete Forum Thread with Replies
Sponsored Links:
Need Some Advice On Drag,drop,droptarget Etc.
im currently making a small flash file in which you drag the hands of a character over an item to access it. The drag and drop works fine, but the collision, or droptarget, isnt working, the hand can go onto the item (in this case a large green box) but it doesnt do what i tell it to do (or what i think im telling it to do). in other words, the square doesnt change colour when i drag the hand onto it.
i'd really appreciate some help.
aaanyway.
code on button (Symbol 1 - no instance name) which is inside a MC (hand - hand)
Code:
}
on (press) {
startDrag(this);
}
on (release) {
stopDrag();
if (root.hand_droptarget == "/images") {
_root.computer.gotoandStop("green");
}
The "images" is simply a square MC i used to test the idea. Inside the MC is a stop(); on the 1st frame and on the 5th a named frame called "green" where the square changes colour.
View Replies !
View Related
Some Advice (actually A Lot Of Advice) On Navigating My Web Site
My web Site consists of 1 large flash movie that is being used as a template for the site as a whole. Different 'pages' in the site will consist of the same movie...different colour and content.
ie
Page1 = template/ red/ content A
Page2 = template/ blue/ content B etc etc
My problem is with navigation ( and not knowing enougth about flash )
Choice 1. use traditional hltm with frames. navigation buttons on the left frame call up the a url to load the new flash template.
Problem. Can the call command to load, the url, also navigate to a certain frame within the template?
Choice 2 Make the different pages into different scenes within the same movie.
2A Can the navigation buttons be in a different frame ( web page frame as opposed to a flash frame) and if they can how do I navigate
,or can I navigate as below
Button 1 = load url= www.blah/blah/blah gotoandplay= frame 40
2B the navigation button are in the main movie ( template ) how do I tell it to go to,
button1= go to scene2 frame 30 and play
Lastly!! If I go down the scenes route does flash load the whole movie before it starts playing, this would not be acceptable due to download times, or can it be made to;
1 Load the next scene when it is requested
even better
2 Be made to load the other scenes while the user is looking at the first scene
There will be a large bottle of whiskey ( if your old enougth) for any help that you can give me. Thanks
View Replies !
View Related
Droptarget
can someone explain the working of the drag, drop and snap object script...when the object is dragged over another it fits the object ....like a jigsaw puzzle...also needed the help when the object is not the one which is the match to the corresponding object it snaps back to its original position
thanx
View Replies !
View Related
Droptarget _ X _y
hey all, what i need to do is set a range of x and y coordinates for a droptarget instead of using the usual mc target. i have tried hacking a bit, but no luck... can anyone point me in the right direction for this. here is the code.
on (release) {
stopDrag ();
if (_droptarget == "/t_eight") {
with (_root.eight) {
gotoAndStop("2");
}
} else {
setProperty ("_root.eight", _x, "607");
setProperty ("_root.eight", _y, "239");
}
}
cheers
j
View Replies !
View Related
Droptarget Help
I have a draggable MC I want to use as
a "LINK ACTIVATOR" I drag it onto the screen
and If I release it on some other MC
I can obtain actions (get url in my case).
_droptarget is in use for sure here's my code..
why it does not work?
onClipEvent (load) {
startx = this._x;
starty = this._y;
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse, false)) {
this.startDrag(true, 230, 20, 525, 374);
}
}
onClipEvent (mouseUp) {
this.stopDrag();
rilascio = eval(this._droptarget);
if (rilascio == _level0.tasto01) {
setProperty ("/punt01", _alpha, "100");
getURL ("/docs/des01.htm", "_blank");
}
if (rilascio == _level0.tasto02) {
setProperty ("/punt02", _alpha, "100");
getURL ("/docs/des02.htm", "_blank");
}
if (rilascio == _level0.tasto03) {
setProperty ("/punt03", _alpha, "100");
getURL ("/docs/des03.htm", "_blank");
}
this._x = startx;
this._y = starty;
}
I used eval to avoid "/" (as suggested by the
reference) should I try to change _level0
with _root??
View Replies !
View Related
Droptarget
Hey guys,
I have a simple question. Can anyone shed some light using drop targets. I used the following code but no luck.
if (eval(garbage._droptarget) == _root.trash) {
garbage._visible = false;
} else {
garbage._x = x_pos;
garbage._y = y_pos;
}
garbage is the instance name of the button to be dragged, and trashcan is the location. Any ideas. Thanks much
View Replies !
View Related
Droptarget
Hey guys,
I have looked through the archives for a drop target explanation but unfortunately, I was unable to find one. This is the code that I have. If anyone has the time or patience, could he or she just take a quick look at it. Thank you
I have a button that drags. the instance is called button. I have a hit area called pool. These instances are all on the main timeline
this.onEnterFrame=function() {
if (eval(_root.thebutton._droptarget)==_root.pool) {
trace("you got the hit state");
}
}
View Replies !
View Related
Droptarget
I have a movieclip A and I want to check if it has been dragged onto another movieclip B. If this happens I want to reset the x, y position of the movieclip A. The problem is the droptarget of A doesn't change - it still says its B. I need to change this, I've tried resetting it but it doesn't seem to work.
View Replies !
View Related
Droptarget
Help. This seems simple, but I can't get it to work.
Scenario:
Need to be able to drop a button on a movie clip. If the button is dropped anywhere outside of the mc, it needs to return to its original position. If the button is dropped on the appropriate mc, the targeted mc will go to and stop on its second frame.
Thanks bunches
View Replies !
View Related
Droptarget
Can anyone explain why the IF conditional is not evaluated when the movie clip is dropped on target 2? It evaluates only if dropped on target1.
on(release){
if(mymc._droptarget == target1){
trace("dropped target ============1");
}else if(mymc._droptarget == target2){
trace("dropped target ============2");
}
}
iaustin
Thank You
View Replies !
View Related
[F8] Droptarget Help
hi, if anyone can help it would be fantastic, im using the script at the moment to initiate the loading of various movie clips if an image is dragged into the target area.
var mcPic1:MovieClip;
mcPic1.onPress = function(){
this.startDrag();
};
mcPic1.onRelease = mcPic1.onReleaseOutside = function(){
this.stopDrag();
if (eval(this._droptarget) == mcSquareBig ){
mcStatus.gotoAndPlay ("rooney");
} else {
this._x = 67;
this._y = 67;
}
};
i got it from the flash 8 bible.
what i want to know is, is there anyway of using more than one item to drag to initiate an event. so for example, if i drag a picture of david beckham, i get pictures and videos of him, if i drag a picture of victoria beckham i get stuff about her, if i drag both there images then i get stuff about the pair of them together. crap example i know but thats all i could think of.
that script works for 1 drag item but i need to know if its possible for 2 items to initiate a new response.
thanks in advance for any assistance i get.
View Replies !
View Related
Droptarget
I am having trouble with droptarget. It works great by itself or when loaded to the root of my main movie but when I put it at the next depth or call it from other movie clips in my main movie it will not drop or release.
Here is the code to load the movie swf with the droptarget code in it.
createEmptyMovieClip("calcount", 23);
loadMovie("webmedia/cal_counter.swf", calcount);
trace(calcount);
and here is the code to drop the dragging movie clip which is in the movie swf that is loaded into my main movie.
After the movie clip "m_pepperoni_main" is draging, I call this...
m_pepperoni_main.onRelease = function() {
//trace(m_droptarget_pizza);
if ((eval(m_pepperoni_main._droptarget) == m_droptarget_pizza) && (_global.pepperoni == 0)) {
m_pepperoni_main.stopDrag();
m_pepperoni_main.gotoAndStop(1);
m_pepperoni_main_visible = true;
_global.calories = (_global.calories+_global.pepperoni_cals);
_parent.m_calories.m_calories_action.gotoAndPlay(2 );
_parent.m_calories.m_calories_action.total_calorie s.text = _global.calories;
pizzaaddrisk(_global.pepperoni_cals);
_parent.m_cal_spin_sound.gotoAndPlay(10);
_global.pepperoni = 1;
}
etc.....
Is there a problem with my code? I am using Flash MX 6 (can't afford the new versions) and exporting as player 6. I have traced the "m_pepperoni_main" and tried using the full path like:
eval(m_pepperoni_main._droptarget) == _level0.m_mainbg.m_mainbgg_... / "up to" / ...m_pepperoni_main
View Replies !
View Related
Droptarget
i am using the droptarget for a uni piece i am doing but i cannot seem to get it to function fully.
i have a few MCs which are pictures and also a few MCs that are lables, what the user has to do is link the label MC with the picture MC, i can get it to work so that when the label is on the right picture it changes a variable to 2 and when the label is not on the right picture it changes the variable to 0 but i want it so that if the label is dropped onto the wrong picture it sets the variable to 1. i have tried this code, but does not seem to work:
on(release) {
stopDrag();
if (this._droptarget == "/antibody") {
_root.status_antibody=2;
}
if (this._droptarget != "/antibody" || "/idbg") {
_root.status_antibody=1;
}
if (this._droptarget ="/idbg") {
_root.status_antibody=0;
}
}
can anyone see a way of doing it without having a long list of if statements, ive worked out it seems to be the || that dosnt work
View Replies !
View Related
Droptarget
i am using the droptarget function to set a variable.
the variable is initially set at "1" but when i drop a movie clip over the target MC the variable is changed to "2". i have this working fine but i would like to be able to set the variable back to "1" when the mc is moved off of the target mc.
is there any way of doing this? thanks
View Replies !
View Related
Please Help With Droptarget
Basically what I am trying to do is, 1) click on the square to make duplicate movies of the ball. 2) which can be dragged to the trash can, to be discarded, but the problem I’m having is that I when I hit the square after the first time I drag a ball to the trashcan, it appears on top of the trashcan, and not where I want it to, yet the next time I hit the button it’s fine.
TIA
Tom
View Replies !
View Related
DropTarget In AS3
This is using Flash CS3 and AS3.0
When I use dropTarget on symbols that are instantiated at design time, the dropTarget property reports the name as instance1 and instance2 instead of the names that were assigned through the properties panel.
Most of the code came from some help files from Adobe, but here is the code. I was just using a trace command to identify the dropTarget.
ball_mc.buttonMode = true;
ball_mc.addEventListener(MouseEvent.CLICK, clickHandler);
ball_mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownListener);
ball_mc.addEventListener(MouseEvent.MOUSE_UP, mouseUpListener);
function clickHandler(event:MouseEvent):void {
trace("You clicked the ball");
}
function mouseDownListener(event:MouseEvent):void {
ball_mc.startDrag();
}
function mouseUpListener(event:MouseEvent):void {
trace(ball_mc.dropTarget.name);
ball_mc.stopDrag();
}
View Replies !
View Related
DropTarget
I've been able to create a draggable movie clip in flash. I want to be able to have the user drag the movie clip over another clip and then perform more actions based on the dropTarget event. Is this available in CS3?
View Replies !
View Related
How To Use DropTarget
I'm trying to understand how to use the dropTarget property, so I set up a test as attached.
note that the handleDrop function is in the target sprite, and the dropped sprite has a reference to the target sprite already and calls handleDrop, sending a ref to itself. not that this will always be possible, just setting up a test condition.
the output from the test is this:
my (the target sprite) name: instance1
name of dropped sprite's dropTarget: instance2
how about '==' equivalence?: false
how about '===' object equivalence?:false
how about hit test: true
why are the names different? where are they set? I tried setting them explicitly in the different constructors ('this.name=myName), but no dice... wondering if a copy of a reference is getting passed in by caller (the dropped sprite) but 'deep' equality should test true, no?
mostly wondering how it's used for anything useful
thanks!
Attach Code
public function handleDrop(droppedSprite:Sprite) {
if (droppedSprite.dropTarget != null) {
//these two names should be the same, as they should be the same object
trace("my (the target sprite) name: " + this.name);
trace("name of dropped sprite's dropTarget: " + droppedSprite.dropTarget.name);
//but they arent
//so they arent the same object?
trace ("how about '==' equivalence?: " + (this == droppedSprite.dropTarget));
trace ("how about '===' object equivalence?:" + (this === droppedSprite.dropTarget));
//but this works! should I just forget about using dropTarget.name? it seems handy...
trace("how about hit test?: " + hitTestObject(droppedSprite.dropTarget));
}
}
View Replies !
View Related
Droptarget Help
Can someone view this and let me know whats wrong?
thanks a lot.
followed tutorial from http://www.kirupa.com/developer/acti...t/dragdrop.htm
but couldnt duplicate the effect
View Replies !
View Related
DropTarget
The following method lives in a class called View which extends Sprite, I'm trying to call a method after the clip is drag on top of another View. But I can't call any methods on dropTarget (which I think its the View that I'm dragging on top of ) what am I doing wroing? thank you in advance.
Code:
private function endDrag( evt:MouseEvent ):void {
evt.stopPropagation();
stopDrag();
if ( dropTarget ) {
x = 0; y = 0;
trace( dropTarget.someMethod);
}
if ( owner ) owner.update();
}
View Replies !
View Related
DropTarget
I am having a problem with my drop traget. I have the ability to drop and duplicate multiple objects on a stage. I have a clip set up (canvas) which is used for if someone drops objects onto this it duplicates the dragged clip.
However the problem I am having is that if someone tries to drop an element on top of an already drop/duplicated element, it wont duplicate the new clip. Its like it thinks that the dragged clip is not over the canvas.
This is urgent please.
Thanks
View Replies !
View Related
[as2] Droptarget
Hello,
In the snapto section of the code i'm trying to dynamically snap any choosen clip to the target object. The code works if i hardcode in the "clip1" clip name (replacing vname with clip1). The variable vname when traced, show the correct chosen clip, BUT it will not execute the droptarget action as does the hard coded clip1 name.
maustin
Help!
onEnterFrame = fdragbtn;
function fsnapto(){
//snapto
xtarget = itarget._x;
ytarget = itarget._y;
trace("vname @ snaptp=== " +vname);
if(eval(vname._droptarget)==itarget){
_root.vname._x= xtarget;
_root.vname._y= ytarget;
}
}
//snapto
function fdragbtn(){
fsnapto();
for(prop in this){
if(this[prop] instanceof MovieClip || this[prop] instanceof Button){
this[prop].onPress = function(){
vname = this._name;
trace(vname);
this.startDrag();
}
this[prop].onRelease = function(){
stopDrag();
}
}
}
}//f
View Replies !
View Related
Droptarget Problem
I have a movie that's using a lot of drag and drop stuff. It's a game. There seems to be a problem with the snapping to the target. It works, but is really fussy. Is this a problem in Flash? My customer isn't happy with it's persnickityness.
Thanks,
Rick
View Replies !
View Related
Simple Droptarget
ok, i put together a REAL simple movie to show you what i'm trying to do.. you can get the .fla or .swf at http://www.bojangz.com/cr/dummy.fla (obviously replace .fla with .swf)
it's just a real simple drag and drop setup with three draggable movies and a total button. you simply drag movie one into target one, hit total and it gives you it's value which is 1. same goes for movie two.. drop it in target one and hit total and it gives you it's value which is 2. now when the third movie gets dropped i'm trying to make it look at the current variable occupying target one and have it change the value accordingly.. basically, if the value of target one is 1 it will change it to 10, if the value of target one equals 2 it will change it to 20. that's it! simple enough right? obviously not for me since i can't get the damn thing to work!! man this is frustrating! could someone please take a look at this.. i've tried it tons of different ways (using = or < or > ) and it still doesn't work properly..
thank you!
View Replies !
View Related
Droptarget And Layers
I am using flash 5 and have developed a number of educational resources using droptarget, these work fine. Well thats until they are loaded into any level other than level0. Why?
The general form of the actionscript in one example is:
_root.electron20._droptarget == "/firstOrbit"
I have replaced _root with _level2 (in this case), this, and _parent. None of which work, I understand that _root in the this situation will return _level2 anyway.
DR Murray
View Replies !
View Related
# # DropTarget # # Plzzz Help
i have a main movie and using the load movie command i load and unload various movies onto various levels, but when i load a movie with the droptarget function the problem starts.
the movie can be dragged but when u leave it on the hit area it does not recognise the hit area and comes back to its orginal position.
but when u play the movie independently it works fine..
i am attaching two files for reference
click.swf ie the main movie
ooo.swf ie the movie with the drop target feature.
Plzz help !!
View Replies !
View Related
SwapDepths And DropTarget Help.
I am having trouble with swapping Depths in my flash movie. Here is the setup:
I have 6 targets total. the first 3 are on one frame, next 3 on another.
The target clip contains different photos 1-12 one on each frame of the clip.
The targets overlap a little for effect.
The swapDepths works but when I go to the frame with the next 3 targets, one of the other targets always shows up form the other frame. and vice versa.
to get an idea of what I have look at the portfolio section it is drag and drop, without the swapDepths implemented.
http://www.parlettdesigns.com/desksite/desk.html
If anyone has the time to help I would appreciate it.
here is the code I have:
function Checkit (thumbclip) {
stopDrag ();
dropTarget = new Array(target1, target2, target3, target4, target5, target6);
for (i=0; i<7; i++) {
if (eval(thumbclip._droptarget) == dropTarget[i] && photNumber == 1) {
dropTarget[i].gotoAndStop("photo1");
dropTarget[i].swapDepths(0);;
} else if (eval(thumbclip._droptarget) == dropTarget[i] && photNumber == 2) {
dropTarget[i].gotoAndStop("photo2");
dropTarget[i].swapDepths(0);;
} else if (eval(thumbclip._droptarget) == dropTarget[i] && photNumber == 3) {
dropTarget[i].gotoAndStop("photo3");
dropTarget[i].swapDepths(0);;
} else if (eval(thumbclip._droptarget) == dropTarget[i] && photNumber == 4) {
dropTarget[i].gotoAndStop("photo4");
dropTarget[i].swapDepths(0);;
} else if (eval(thumbclip._droptarget) == dropTarget[i] && photNumber == 5) {
dropTarget[i].gotoAndStop("photo5");
dropTarget[i].swapDepths(0);;
} else if (eval(thumbclip._droptarget) == dropTarget[i] && photNumber == 6) {
dropTarget[i].gotoAndStop("photo6");
dropTarget[i].swapDepths(0);;
} else if (eval(thumbclip._droptarget) == dropTarget[i] && photNumber == 7) {
dropTarget[i].gotoAndStop("photo7");
dropTarget[i].swapDepths(0);;
} else if (eval(thumbclip._droptarget) == dropTarget[i] && photNumber == 8) {
dropTarget[i].gotoAndStop("photo8");
dropTarget[i].swapDepths(0);;
} else if (eval(thumbclip._droptarget) == dropTarget[i] && photNumber == 9) {
dropTarget[i].gotoAndStop("photo9");
dropTarget[i].swapDepths(0);;
} else if (eval(thumbclip._droptarget) == dropTarget[i] && photNumber == 10) {
dropTarget[i].gotoAndStop("photo10");
dropTarget[i].swapDepths(0);;
} else if (eval(thumbclip._droptarget) == dropTarget[i] && photNumber == 11) {
dropTarget[i].gotoAndStop("photo11");
dropTarget[i].swapDepths(0);;
} else if (eval(thumbclip._droptarget) == dropTarget[i] && photNumber == 12) {
dropTarget[i].gotoAndStop("photo12");
dropTarget[i].swapDepths(0);;
}
}
}
View Replies !
View Related
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") {
Basically what im asking is can you, instead of hard coding the droptarget can it be generated by a string within a variable
Please help?
cheers
View Replies !
View Related
Droptarget Problems
I have a drag and drop portfolio that I am working on. When I drag the object to the container, it will not load the movie in that container. I've attached the files to give a better idea of what's going on. Please help!!! Thanks in advance...
View Replies !
View Related
Droptarget Question
If I want to check the result of a droptarget, but I only want to check part of the name of the mc how is this possible?
i.e. normally
on (release) {
stopDrag();
if((_root.activering._droptarget)=="option6"){
trace ("do something if it is equal");
}else{
trace ("do something else if it isn't equal");
}
}
but my situation the mc "option6" is part of an array, and I only want to check if the result of the _droptarget has "option" in the name (as it might hit "option5" or any of the other options in the array) which should also give a true result
What actionscript should I replace "option6" with in the above code?
View Replies !
View Related
Droptarget Property
Is there a way to identify the name of a movieclip that has been dropped on a specific target. I know you can get the droptarget property for a dragged item, but I am looking for the opposite.
Thanks!
View Replies !
View Related
Invisible Droptarget
Hey guys,
HOw do you make an invisible drop target? I mean, i have a square area that i want to use as the drop target. But I dont necessarily want the square to show. Thanks for your help
Don
View Replies !
View Related
Droptarget Nightmare
so we built this paint application
actually, we borrowed it from a book
and it works fine on its own
as soon as we load it into another movie via loadMovie(), it doesnt retrieve anything using the _droptarget command
after searching the board, we found no real solution
does anyone know a fix for this?
we cannot use hitTest because the clips we are coloring overlap, so sometimes it returns many clips, not the top one that was clicked
we really need dropTarget to work
thanks in advance
dan
View Replies !
View Related
Droptarget / Mc Issue
im creating a mapping application (paning zooming etc etc)
however the map is very large. i had an idea to make it perform better ... dynamically load sections of the map when needed.
heres how ive gone about it
I created a background (back) mc (the map will be dragged over this).
Then i create a mc (map) of a grid of empty mc's
A1 A2 A3 A4 A5 A6 A7 A8
B1 B2 B3 B4 B5 B6 B7 B8
C1 C2 C3 C4 C5 C6 C7 C8
etc etc
my code on the map mc is
on (press) {
startDrag(this);
}
on (release, releaseOutside) {
this.stopDrag();
if (eval(this.a1._droptarget) == this._parent.back) {
trace("A1"); // this is where i would load the map section into the empty mc
}
}
the problem is its not working.
If i put the empty mcs on the main timeline and use the code above on each one it will work...BUT thats not what i want as i want the empty mc's (map sections) to stay together all the time
CAN ANYONE PLEASE POINT ME IN THE RIGHT DIRECTION???
View Replies !
View Related
Droptarget Problem
Hello all
I am using the following code which first of all, creates 10 movie clips which all contain the variable 'count'. These movie clips are used as the drop targets.
What I need to do is - when the movie clip 'garbage_mc' is dropped onto one of the droptargets the variable 'count' can be used later in my script.
I am unsure of how to get hold of the variable 'count'
i = 1;
while(i < 10){;
duplicateMovieClip('green', 'drop'+i, i);
_root['drop'+i].count = i;
_root['drop'+i]._x = 0;
_root['drop'+i]._y = i*40;
i++;
};
garbage_mc.onPress = function() {
this.startDrag();
};
garbage_mc.onRelease = function() {
this.stopDrag();
trace(eval(this._droptarget));
};
Thanks in advance for any help
View Replies !
View Related
Droptarget-issue
I am doing a "game" where You you should put together a good headline. You get a picture and a few words. If You put the words right You get full score if you put them in another way you get bad score.
I put this I the first frame. Now it´s only two words but if there´s is let´s say 20 words is there a better way to do it, using arrays or something?
the code is like this:
-----
_root.score=0;
//the gudrun_mc//
_root.gudrun.onPress = function(){
this.startDrag(false);
};
_root.gudrun.onRelease = function(){
this.stopDrag();
if(eval(this._droptarget) == rubrik1) {
_root.score+=3;
trace (this._name);
}
};
//the kungen_mc//
_root.kungen.onPress = function(){
this.startDrag(false);
};
_root.kungen.onRelease = function(){
this.stopDrag();
if(eval(this._droptarget) == rubrik3) {
_root.score+=3;
trace (this._name);
}
};
----
A problem that I found out is :
If You put the words in a bad way the first time and don´t get full score. If You try again, the old score are still there and the new are added so you get more than full score when You try again. so in some way You have to put a code in the " I am finished"-button to make the score zero again. At the same time the mc:s may be on the target so get score will be there again.
Any ideas to solve it ( if You understood it).
View Replies !
View Related
This Must Be Easy - Droptarget
I´ve tried different ways but could get it to work. I have a _droptarget-case where a mc get high-scores when dropped on one mc but no scores when dropped on other mc:s. I was only working when I wrote like this:
-----
if(eval(this._droptarget) == rubrik1) {
_root.score3=0;
}
if(eval(this._droptarget) == rubrik2) {
_root.score3=0;
}
-----
But it must be a way to write the -droptarget-test towards more than on mc in one code. I guess it´s easy but I could not find a way.
View Replies !
View Related
LoadMovie With DropTarget
Hi.
I am right now creating a Graphical Interface with flash.
I have a movieclip with the instance name movie called as movie.swf
which changes its color when i send a command gotoAndStop(2).
So. when i import it into another Movieclip with
loadMovie("movie.swf","base"). how can i control the movie instance.
Please post in your comments.
View Replies !
View Related
Problem Of Droptarget
I hv two objects called blue and X
I expect if blue is dropped over X, X._x += 100,so I write this :
on (release) {
if (blue._droptarget) = "/X" {
X._x += 100 }
but it doesn't work,how can I do ? thank you !!
View Replies !
View Related
DropTarget Confusion
Hello, just wondered if you could provide a bit of explanation for the following code. It's the start of a drop function in a drag and drop game. I understand how it works, however the last line is puzzling me slightly.
Firstly I'm not entirely clear on why the dropTarget has to not equal null and, secondly, why the dropTarget's parent has to be equal to myTarget, rather than the dropTarget itself.
ActionScript Code:
function dropIt(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){}
Hope that's clear, I really want to understand why it works, rather than just going for trial and error!
Thanks,
Rebecca
View Replies !
View Related
Problems With Droptarget
on (press){
startDrag(aboutB,true)
}
on (release){
trace aboutBdroptarget)
stopDrag()
}
i just want to find one droptarget
if i put
on (press){
startDrag(aboutB,true)
}
on (release){
if (aboutB._droptarget == "/textBox") // that is a instance name
stopDrag()
}
why wont this work..
thanks
Mike
View Replies !
View Related
Droptarget Problem
I've created a movie with a droptarget function looking something like this:
on (release) {
stopDrag();
if (this._droptarget == "/targetCircle") {
setProperty(this, _x, 561);
setProperty(this, _y, 263);
}
}
It works fine when I test that movie. When I load the movie into another movie though, say at level1 and run it there, it doesn't seem to be able to locate the droptarget.
Whats wrong?
/Johan
View Replies !
View Related
Playing Mc After DropTarget
I'm trying to create a virtual turntable where you drag and drop a number of records onto the turntable and the music starts. This is the script i have so far for the drag and drop (see below) but im having trouble writing script for the music to start once the record snaps to the targetCircle.
Can anyone help me please??
ActionScript Code:
circle_mc.onPress = function() {
startDrag(this);
};
circle_mc.onRelease = circle_mc.onReleaseOutside=function () {
stopDrag();
if (this._droptarget == "/targetCircle") {
this.onTarget = true;
} else {
this.onTarget = false;
}
};
//the variables below will store the clips starting position
circle_mc.myHomeX = circle_mc._x;
circle_mc.myHomeY = circle_mc._y;
//the variables below will store the clips end position
circle_mc.myFinalX = 346;
circle_mc.myFinalY = 253;
circle_mc.onMouseDown = function() {
//this variable tells us if the mouse is up or down
mousePressed = true;
};
circle_mc.onMouseUp = function() {
mousePressed = false;
};
circle_mc.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 (mousePressed == false && this.onTarget == false) {
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 (mousePressed == false && this.onTarget == true) {
this._x -= (this._x-this.myFinalX)/5;
this._y -= (this._y-this.myFinalY)/5;
}
};
View Replies !
View Related
Remove Droptarget Value... :(
I am doing a chemistry quiz. whereby the user will drag the movieclip (the ball) to over the movieclip(a hole) and it stays.
so there is two function invloved: CheckAnswer() and Reset()
CheckAnswer use the droptarget funtion to detect the right movieclip drop on top and evaluate it to determine the answer.
Reset will reset the whole location.
but the reset function did not reset the droptarget value.
Thus it keep the previos drop value.
Even the button reset is pressed, nad the ball are not drag.
the droptarget value remain.
May I know How to remove the droptarget value?
Thank you.
View Replies !
View Related
Dynamic Droptarget?
Hi,
I have one movi clip that I am dragging over lots of smaller ones. With drop target I can easily see which small movie clip I have dropped it on top of.
Is there any way to do this so that I know which movie clicp I am on top of 'while' Im dragging the movie clip.
Like a dynamic _droptarget that works all the time, not just on mouse release..?
JV
View Replies !
View Related
DropTarget Problem In AS3
This is using Flash CS3 and AS3.0
When I use dropTarget on symbols that are instantiated at design time, the dropTarget property reports the name as instance1 and instance2 instead of the names that were assigned through the properties panel.
Most of the code came from some help files from Adobe, but here is the code. I was just using a trace command to identify the dropTarget.
ball_mc.buttonMode = true;
ball_mc.addEventListener(MouseEvent.CLICK, clickHandler);
ball_mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownListener);
ball_mc.addEventListener(MouseEvent.MOUSE_UP, mouseUpListener);
function clickHandler(event:MouseEvent):void {
trace("You clicked the ball");
}
function mouseDownListener(event:MouseEvent):void {
ball_mc.startDrag();
}
function mouseUpListener(event:MouseEvent):void {
trace(ball_mc.dropTarget.name);
ball_mc.stopDrag();
}
I have a ziiped file of all of the code available if you would like it.
Kinsey
View Replies !
View Related
Trouble With Droptarget
This is from the Flash 8 Doc on dragging MovieClips
It doesn’t work because it’s suppose to be in a onClipEvent
Why isn’t the Doc updated I find this a lot in Move Clip examples
garbage_mc.onPress = function() {
this.startDrag(false);
};
garbage_mc.onRelease = function() {
this.stopDrag();
if (eval(this._droptarget) == trashcan_mc) {
garbage_mc._visible = false;
}
};
This is the same thing in onClipEvent it doesn’t work
The eval droptarget isn’t working
onClipEvent (mouseDown) {
this.startDrag(false);
}
onClipEvent (mouseUp) {
this.stopDrag();
if ( eval(this._droptarget) == trashcan_mc) {
garbage_mc._visible = false;
}
}
This is from an example I found on this Forum the eval drop target won’t work either
on (press) {
startDrag("");
}
on (release) {
stopDrag();
if(eval(this._droptarget) == _root.Fire2_mc){
Fire2_mc._visible = false;
}
}
Help I know it has to be me but I can't see why it won't work or why the Doc examples are wrong I have done this in previous versions of Flash using the first example from the Doc
View Replies !
View Related
DropTarget Problems
Hello,
I am currently trying to create a drag and drop feature in an application.
I am using a MouseEvent listener to detect the drag and the drop and both work exactly how I want them.
But this only works when I make the line:
event.target.dropTarget.name == "instance16"
However I would ideally want to be able to call up the actual name of the object dynamically using something like event.target.dropTarget.name == "dropT_mc" but this goes unrecognised by the Flash and it will only recognise event.target.dropTarget.name when I use the "instance16" or "instance18" name.
I have declared a name for the area for the dragged object to be dropped earlier in the code which is done by the following code:
var dropT_mc:mcDrop = new mcDrop();
var dropB_mc:mcDrop = new mcDrop();
dropT_mc.name = "dropT_mc";
dropB_mc.name = "dropB_mc";
Just for your information the objects being dragged are called cogS_mc, cogM_mc and cogL_mc which all work great and it is these which I would like to drop into dropT_mc ("instance16") and dropB_mc ("instance18").
The thing is with calling them by the instance number is that when I add new objects to the library or stage these numbers change and then I have to go digging for the instance numbers and it is taking up a recidulous amount of time and it is knocking me off my train of thought.
Is there a piece of code which i can use to declare the names of dropT_mc and dropB_mc in the following statement instead of using "instance16" and "instance18"??
// this code is inside an event listener which works well but the instance names are causing problems
if (event.target.dropTarget.name == "instance16") {
//******* what happens when user drops the cog on the TOP cog drop zone? *******//
// snap the cog to the centre of the drop zone
event.currentTarget.x = dropT_mc.x;
event.currentTarget.y = dropT_mc.y;
}
if (event.target.dropTarget.name == "instance18") {
//******* what happens when user drops the cog on the BOTTOM cog drop zone? *******//
// snap the cog to the centre of the drop zone
event.currentTarget.x = dropB_mc.x;
event.currentTarget.y = dropB_mc.y;
}
I hope this makes sense. And sorry for the long message but any help would be greatly welcomed.
Thank You
Lee
View Replies !
View Related
Droptarget While Using MC As Mousepointer
Firstly,
I am hiding the actual mouse pointer and using an MC (MovieClip) as the mouse pointer.
Secondly, I want to drag another MC. However when I check the droptarget it will always give me the value of the MC i am using as the mouse pointer and not the MC i am actually dragging.
Is there a way i can check the dragged MC and not have it check the mouse MC? Naturally the depth of the 'mouse pointer' MC is higher than that of the MC i am dragging.
Any help will be much appreciated or else i have to tras hthe idea of using an MC as my mouse pointer.
No way to change the original graphical icons that the mouse uses? Maybe somewhere in components or so?
View Replies !
View Related
Using Droptarget With Dot Syntax
How can I replace this code to use dot syntax instead of slash?
Code:
square.origX = _x;
square.origY = _y;
square.onPress = function() {
this.startDrag();
};
square.onRelease = function() {
stopDrag();
if (square._droptarget != "/ball") {
this._x = this.origX;
this._y = this.origY;
}
};
Thanks.
View Replies !
View Related
|