_droptarget Property - What If It Is A Textfield? Thanks, Sarah
Hi, I have a drag and drop flash movie - it's setup ok I can detect when the movie i have 'picked up' is dropped over a movie clip etc; on(release) { stopDrag(); _root.answer1 = this._droptarget; }
What I would like to know is: if the value of drop target is /grid/drs1/number
and number is a text field (dynamic) which has been filled is it possible to access/read a variable which is in number or if there is a text field inside the movieclip which is returned...
Thanks a million, Sarah
FlashKit > Flash Help > Flash ActionScript
Posted on: 12-07-2005, 01:36 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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.
Get Property _droptarget Script Problem
firstShape needs to be able to go into multiple areas not just firstShape-box. ie. second shape-box, third shape-box....I have tried paraenthsis,Brakets,double paraenthsis but can't seem to get the right combination.
any help would be appreciated
ActionScript Code:
on (release)
stopDrag();
if (getProperty("firstShape", _droptarget) eq "/firstShape-box") {
tellTarget ("/status") {
gotoAndPlay("correct");
}
}else{
setProperty("/triangle", _x, "400");
setProperty("/triangle", _y, "300");
}
}
Textfield Property
Hello all,
i am trying to change the font property of a textfield in actionscript.
i tried this but i am not seeing the effect of it. Actually nothing happens. What am i doing wrong?
_root.attachMovie("nav1","nav"+coun, coun);
_root["nav"+coun].textItem = "me";
myTextFormat = new TextFormat();
myTextFormat.font = Arial;
_root["nav"+coun].textItem.setTextFormat(myTextFormat);
korkor5
Scroll Property Of Textfield - What Gives?
Using F5.
It's late. I should stop now, but this is really getting me down! I have found out why some script I've written isn't working - I just can't see why it doesn't work.
I am trying to access the scroll property of a text field from the root timeline, to make a generalised scroll button. I suspect it is this function that's erroneous but can't really see where:
Code:
function outputScroll(clip){
//(simplified for brevity)
trace(clip.scroll);
}
If I supply the path (from _root to the textField) as the argument and call the outputScroll function (from _root) I thought I should get the value of scroll for the text field of interest - but I dont.
I think this is the problem as I can access the value of the scroll property of the text field using trace(myClip.nestedClip.nestedClip2.textField.scro ll);on the _root timeline.
Sorry if this seems obvious.
Thanks in advance for wise words,
oddbodjnr
Restrict TextField Property
G'Day all,
I'm using the restrict property for a text box. When I use :
tbComments.restrict = "";
it doesn't restrict anything although acording to the documentation it is supposed to restrict everything. Can someone please help, I'm trying to stop people entering things into the text box at certain times.
TextField.text Property
hey guys!!
PLz tell me if TextField.text property is only for string?? To be clear, I want to retrieve value for an Array from input text fields placed on stage.THe function is actually to get an average where I need value for variable sum.
Script I have written is below-
function average() {
var sum = 0;
var numbers = arguments.length;
i = 0;
while (i<=arguments.length) {
sum = sum+arguments[i];
i++;
}
trace(sum/numbers);
}
average(fld1.text,fld2.text,fld3.text);///here it takes input numbers in text fields (i.e. instance name txtfld1 and so on)as string and does calculation.
What do I do if I want those values as numbers???(ouchhhh...is it a stupid question??)
TextField.variable Property
hi all,
i have a problem with the TextField.variable property.
i assigned my textField with the name in "" using the variable property and the text field shows nothing.
the variable i am assigning it to is a property of a class i created.
my code line looks like this:
PHP Code:
textContainer.inTxt.variable = "game.score";
where textContainer is a MovieClip that contains the inTxt TextField.
game is an instance of a Class i made and score is a property of the class (a variable inside it that has a get function).
why doesnt it work?
is it because the variable is inside the class?
should i declare some kind of variable outside of the class that will act as a pointer to the game.score?
thanks in advance.
TextField & Margin Top Property ... If Any ...
Hello everyone,
I use very often textfield with html texts ans css. The marginLeft and marginRight properties are very familiar to me but ...
Is there any marginTop (& marginBottom) property available ? None if I read the documentation... well I probably missed something ...
So how can I specify the distance in pixels between the top of my TextField and the top of my text ?
Thanks a lot for any advice you can give me ...
Textfield.backgroundColor Property
I remember back in the day at macromedia's site on the main page there was a search box, which when in focused changing its background color smoothly.
I have found how tochange it but couldn't figure it out how to transform it, should I be defining a function which within change the background color in a sequence, maybe using tween prototypes. ?
am I on the right track, do any of the guys has any example sites around ?
_alpha Property Of TextField Instance
hi there,
i have a dynamic txt-field and want to "fade in" text. i discovered the MX feature which allows instances of a dynamic text field to have an alpha property. so if i change this property now, i get some strange values like 77.734375 for example. any explanation?
every help appreciated
Please Help With TextField.html Property In Scroller
Can someone send me or post a working version of the fla (and text file) located here?
http://www.macromedia.com/support/fl...t_scrollmx.htm
Also, could you let me know which html tags can be used? Thanks
Ashley
Access Of Undefined Property? Textfield?
I'm creating a text field in a class and keep getting the same "1120: Access of undefined property feedback." error. What am I doing wrong?
Code:
package
{
import flash.display.Sprite;
import flash.text.*;
import flash.display.*;
import flash.text.TextField;
import flash.text.TextFieldType;
public class test extends Sprite
{
public var feedback:TextField = new TextField();
feedback.multiline = true;
feedback.width = 600;
}
}
[Textfield] No Alias Text Property?
Am I missing something here? Is there a alias text property to textfield?
Because there should be! Again (just like with the skewing thing) Macromedia forgot to implement AS for this feature, didn't they... ?
Heup!
Assign The Property 'input' To A Textfield
how is it possible that i can create a new textfiel (dynamicly) and assign the property 'input' to this textfield??
this.createTextField ("txt", 1, 15,11, 70, 15 );
this.txt.textColor = 0xFFFFFF;
this.txt.text = "";
this.txt.embedFonts = true;
this.txt.selectable = true;
this.txt.type = "input";
myformat = new TextFormat();
myformat.font = "pixelfont";
myformat.size = 8;
this.txt.setTextFormat(myformat);
i tried a lot but i did not find a solution for this problem. i hope that u can help me.
yours lionhead
Scripting A TextField.property Loop--any Success?
As far as I can determine, setting TextField field properties can't be done in the same way as using setter/getter functions for, say, TextFormat objects where a property list is applied to an object with a single method.
But in trying to build something from scratch (I'm so tired of devoting dozens of lines of the same code for each textfield), I've come this far:
PHP Code:
txtFieldPropList=new Array('.background=true','.backgroundColor=0xffffff','.type="input"')
function fieldFormat(){
for(j=0;j<arguments.length;j++){
for(i=0;i<txtFieldPropList.length;i++){
field=arguments[j]+txtFieldPropList[i];
trace(field)
}//end for...i
}// end for...j
}// end fieldFormat()...
fieldFormat('progAttribs_mc.progName_tf','progAttribs_mc.progLen_tf','progAttribs_mc.progComment_tf');
...it traces out a perfectly well-formed path for an object/property, but it doesn't actually get applied to the textfield. Has anyone figured out how to do apply TextField formatting to textfields? Is this not working because of runtime issues, or am I just missing something? (And I'm NOT talking about the TextFormat object's character formatting!! That's something else entirely...)
thanks...
TextField Not Taking Parent Clip Property
Ok,
I am feeling stupid here. I want to create text fields at runtime and have them take on the properties (ie. alpha) of their parent clips.
I have a movie that fades clips in a various intervals based on a random number. However the clip that contains the textfield doesn't fade in it just shows up. Since this was a modification to an already existing movie I decided to make a very simple movie to make sure I understood how this worked. The problem is I can generate the text but when I apply rotation or anything else to its parent clip the text doesn't appear.
I can't for the life of me figure out why. The code is on a movie clip on the stage. Any help?
PHP Code:
onClipEvent (load) {
//this._rotation = 90;
var mytext:TextField = this.createTextField("mytext", 0, 0, 0, 100, 25);
this.mytext.multiline = true;
this.mytext.wordWrap = true;
this.mytext.border = true;
var myformat:TextFormat = new TextFormat();
myformat.font = "Toxica";
myformat.color = 0xCCCCCC;
myformat.size = 20;
this.mytext.text = "Dana L.";
this.mytext.setTextFormat(myformat);
}
Reseting Text In Textfield (using Scroll Property?)
Hello and please help.
I have a text field which I fill with text and I made a scrollbar for it following a tutorial I found in flashkit.
Everything works quite ok, but... I need to use prev and next button to change the text in the field. That's not a problem, the only problem is that after I changed the text, it remains in the same position as the previous text (I mean - if the user scrolls down, then clicks "next", the next text is scrolled down, too). Is there any property that would set the text back to it's top in the text field? Thanks a bunch!
Alpha Property Does Change Textfield Prop.
I'm switching the alpha property from 1 to 0 and back on an instance of a custom class that extends a sprite. The code works for the most part. The only thing that does not turn alpha 0 some textfields associated with buttons. I cant think of why the entire button can be alpha 0 and the textfield does not get affected. Any thoughts?
ActionScript Code:
function bsRollOver(event:MouseEvent):void { if (menuCont.getChildAt(1).alpha > 0) { menuCont.getChildAt(1).alpha = 0; } else { menuCont.getChildAt(1).alpha = 1; }}
I'm sure I'm missing simple =/
Setting Variable Property For Dynamically Created Textfield
i'm creating a completely dynamic form. i want to assign a variable name to a textfield and then pass that variable with a LoadVars() object.
here's a small piece of code i can't get working:
//create movieclip (used like a form)
_root.createEmptyMovieClip( 'dialog_body', 0 );
//create textfield input
dialog_body.createTextField( answer, 50, 500, 150, 100, 30 );
dialog_body[ answer ].type = "input";
dialog_body[ answer ].border = true;
dialog_body[ answer ].variable = "fname"; //id will be 1 - 400
// lname is a textfield created using the stage, and the properties window
// putting 'lname' as the var.
//when button is clicked
mybutton.setClickHandler( "OnClick" );
function OnClick() {
trace( dialog_body[ "fname" ] ); //traces the correct value
trace( lname ); //traces the correct value
dialog_body.removeMovieClip();
//simple test script prints all the recieved variables
getURL( 'testing.php', 0, 'post' );
}
problem / question: my test script 'testing.php' doesn't have any knowledge of dialog_body[ "fname" ], why?
it prints:
FUIComponentClass=[type Function]
FPushButtonClass=[type Function]
OnClick=[type Function]
i=0
lname=smith
--- where is fname?
bottomline: if i create a textfield using the traditional method and assign the 'var' it works fine. if i create a textfield dynamically at run time, and use the *.variable property, the variable is NOT sent...why? and how?
thanks for any (much needed) help.
Setting Variable Property For Dynamically Created Textfield
i'm creating a completely dynamic form. i want to assign a variable name to a textfield and then pass that variable with a LoadVars() object.
here's a small piece of code i can't get working:
//create movieclip (used like a form)
_root.createEmptyMovieClip( 'dialog_body', 0 );
//create textfield input
dialog_body.createTextField( answer, 50, 500, 150, 100, 30 );
dialog_body[ answer ].type = "input";
dialog_body[ answer ].border = true;
dialog_body[ answer ].variable = "fname"; //id will be 1 - 400
// lname is a textfield created using the stage, and the properties window
// putting 'lname' as the var.
//when button is clicked
mybutton.setClickHandler( "OnClick" );
function OnClick() {
trace( dialog_body[ "fname" ] ); //traces the correct value
trace( lname ); //traces the correct value
dialog_body.removeMovieClip();
//simple test script prints all the recieved variables
getURL( 'testing.php', 0, 'post' );
}
problem / question: my test script 'testing.php' doesn't have any knowledge of dialog_body[ "fname" ], why?
it prints:
FUIComponentClass=[type Function]
FPushButtonClass=[type Function]
OnClick=[type Function]
i=0
lname=smith
--- where is fname?
bottomline: if i create a textfield using the traditional method and assign the 'var' it works fine. if i create a textfield dynamically at run time, and use the *.variable property, the variable is NOT sent...why? and how?
thanks for any (much needed) help.
_alpha Property Doesn't Work With A Dynamic Textfield
Hello guyz,
i've a problem.. maybe look as a stupid problem but i cannot solve it.. :(
i've a for statment and in it a dinamically attached movieclip from library..
into this movieclip there's a dynamic textfield and i insert into it a string ..
all rights..
but my problem is to assign _alpha property to the mc ! !
for example
Code:
// container is a mc on the stage
str = "my name"
for (var i=0; i<str.length; i++) {
letterMc = container.attachMovie("mc", "mc_"+i, container.getNextHighestDepth());
letterMc._x = xpos
letterMc._alpha = 10 // this doesnt' work [/b]
letterMc.field_txt.autoSize = "left"
letterMc.field_txt.text = str.substr (i,1)
xpos += 10
}
the line letterMc._alpha = 10 doesn't work.. infact the textfield into the letterMc movie clip is always visible..
i've tested into flash debbugger and i've noticed that _alpha property of letterMc is 10 ! ! ! but the textfield is always entirely visible !!?
can depend from the type of textfield ( that's dynamic ) ??
please help me to solve
hello
tnx a lot ;)
How To Retrieve A TextFields.height Property When TextField.autoSize Is Enabled?
I have a TextField that has the autoSize property set to TextFieldAutoSize.LEFT; and for some reason when I try and retrieve the textField's height property like this "myNumVar = textField.height" it always returns the value of 100, even though the text fields height is nothing like this. Furthermore when I input a larger or smaller amount of text into the field, the height property still returns 100.
If anyone has any ideas on how I can retrieve an accurate height value then please let me know
_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
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
_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!
|