Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Rollover Text On A Drag And Drop Object



Hi folks, I wondered if someone could help me with this problem. Last week I was adding text to a drag and drop object on the press of a button and release of a button. This week, I am trying to get the drag and drop object to reveal text when the mouse rolls over it and again when the mouse releases it. I thought it should be pretty easy to fathom out the script for this, because I was given a lot of help last week. But I put in the attached code, and the object does not drag and drop, and neither does it show any text when the mouse rolls over it and off it. Can anyone tell me what I am doing wrong?Thanking you,MarchanAttach Codemovieclipa.onrollOver = function() {this.movietexta.text = 'text on roll over.';startDrag(this); }movieclipa.onrollOut = function() {this.movietexta.text = 'It works.';stopDrag();}var obj_encountered = false;trace('things in _root are:');for(var obj in _root) {trace('-------------------');trace(obj + ' and it is a ' + typeof(_root[obj]));if(typeof(_root[obj]) == 'movieclip') {trace('and it contains:');for(var moreobjects in _root[obj]) {var mytype = typeof(_root[obj][moreobjects]);if(mytype.substring(0,1) == 'o') {var indefinite_article = 'an ';} else {var indefinite_article = 'a ';}trace(moreobjects + ' and it is ' + indefinite_article + typeof(_root[obj][moreobjects]));if(moreobjects == 'obj') {obj_encountered = true;}}}}if(obj_encountered) {trace('-------------------------------------- Hey - your script is in the wrong place!!!--------------------------------------');} else {trace('-------------------------------------- Congratulations! Your script is in the _root!!!--------------------------------------');}



Adobe > ActionScript 1 and 2
Posted on: 04/26/2008 06:54:00 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

How To Add Text To A Drag And Drop Object
Hi everyone, I am quite a beginner with Flash so do excuse me. First, I am not sure if what I want to achieve may actually be impossible with Flash. I presently use MX 2004, but will shortly be upgrading to CS3. But if you know the answer for MX 2004 that would be really useful for now.

I am writing a digital fiction story, and I want to create drag and drop objects. This I have managed to do. But I would like these drag and drop objects to also reveal text when they are actually pressed on. I have had no success so far in being able to achieve the two effects together.

Does anyone know how I can achieve this? If, by chance, you know the action script that would be great. If you can explain to me in simple terms how I can achieve this I really would be grateful.

Thanking you,
Mary

[MX04] Drag And Drop Object That Reveals Text
Hi, I am using Flash MX 2004 and I am quite a new to Flash. Anyway, I am trying to create a digital fiction story whereby draggable objects on the screen will reveal text when pressed on. Now, I have fathomed out how to make a draggable object, but I cannot fathom out how to also have the object reveal text once it is pressed by the viewer. I also want the text to then disappear when the viewer releases the object.

In another forum someone has said that I must use dynamic text, and I have been trying to make this work for the past two days, but I have had no success.

Is it possible that anybody knows how to do this and can explain this to me in simple terms, and step by step.

Thanking you,
Marchan

[MX04] Adding Text To A Drag And Drop Object
Hi, I am quite new to Flash and to Actionscripting. I am struggling with trying to get a drag and drop object to reveal text once pressed. I have managed to get an object to drag and drop, but I cannot get text to show itself once the object is pressed by the viewer, or to then hide when pressed off.

I have tried researching this on the Internet, and so far have been told that I need to create a dynamic text field and to use this script:

myclip.onPress = function() {
this.mytext.text = "stop pressing so hard";
startDrag(this);
}
myclip.onRelease = function() {
this.mytext.text = "keep on pressing";
stopDrag();
}

I have not had any luck with this so far though. I am not sure if it is a problem with the script, or if there is something else that I am doing wrong. I am really very new to this. However, I have tried creating this in both the Main Scene stage area and in the Scene/Symbol stage area. I make three layers, one for the myclip, one for the mytext, and one for the Actionscript. I give the dynamic textfield box an instance name mytext, and the symbol is given the instance name myclip, but so far no joy.

Can anyone enlighten me with this?

Thanking you,
Marchan

Drag Abd Drop, Rollover When Drag Is Over Drop Target?
Hi, im using Flash MX 2004.

I am building a drag and drop, and I have a MC that can be dragged around the stage. The trouble im having is trying to make the drop location do something when i drag the MC over/off it.

I have the following code which works.

objectToDrag.onMouseMove = function() {
if ((objectToDrag.hitTest(dropper)) && (component._beingDragged == true)) {
dropper._alpha = 50;
temp++;
trace("working"+temp);
}
}

This will make the clip i am dragging the draggable MC over change alpha, but for the life of me I cant figure out how to get the alpha to change BACK, after the draggable MC is taken away from the 'dropper'.

Is there a better way that hitTest??

Cheerz,
Dwayne

[AS3] Drag And Drop + Rollover
Hello,

I have some buttons, i need to drag and drop different movieclips on these buttons.
I use

Code:
myclip.addEventListener(MouseEvent.MOUSE_DOWN, on_mouseDownHandler);
myclip.addEventListener(MouseEvent.MOUSE_DOWN, on_mouseDownHandler,true);
and with

Code:
function on_mouseDownHandler(evt:MouseEvent):void {
var object = evt.target;
object.startDrag();
}
i can actually drag my clip around.
The problem is that when i drag my clip over a button, the button does not rollover.
If i move the mouse over a button (without dragging my movieclip), it changes to over state

I am missing something?

My goal is to have a rollover effect on "drag over" an area (simple button in my case)

Can anyone point me in the right direction?

Thank you!

Drag & Drop: Rollover HitTest?
Hi there. I have created a Drag & Drop quiz question that has the hitTest method on the mc's onRelease functions so that when user releases mc_question onto mc_answer an action is called. No probs there.

Can anyone tell me how to call an action when dragging mc_question OVER mc_answer?

I have attempted using an onEnterFrame hitTest function here but that stops working after the first onRelease function is called.

fla attached (exuse the graphics).

Regs

/////////////

[flash8] Drag And Drop / Rollover Question
Hello all

I'm working on a project that in regular english works like this:

There's a map of the U.S. There's a draggable object. The user can drag the object around over the map and drop to choose a state. When the object hovers over the map, a little label pops up that follows the object and incicates which state it's over. When the user drops the object on a state a getURL command is fired off sending the user to a site that is tailored to the region of the country that they chose.

Using the drag and drop tutorial from kirupa.com I have that functionality working. Using a hovering captions tutorial I have the rollover with the label working. However, they don't work in conjunction. When I rollover the map the labels for the states pop up and track with the mouse. But when I drag the object over the states the rollover doesn't work.

Here are some snippets from my coding. This first one is the code for the rollover labeling:

code: //caption coding
Arizona.onRollOver = function() {
captionFN(true, "Arizona", this);
this.onRollOut = function() {
captionFN(false);
};
};

Florida.onRollOver = function() {
captionFN(true, "Florida", this);
this.onRollOut = function() {
captionFN(false);
};
};

Massachusettes.onRollOver = function() {
captionFN(true, "Massachusettes", this);
this.onRollOut = function() {
captionFN(false);
};
};

Illinois.onRollOver = function() {
captionFN(true, "Illinois", this);
this.onRollOut = function() {
captionFN(false);
};
};

captionFN = function (showCaption, captionText, bName) {
if (showCaption) {
_root.createEmptyMovieClip("hoverCaption", this.getNextHighestDepth());
cap.desc.text = captionText;
cap._alpha = 100;
//
hoverCaption.onEnterFrame = function() {
cap._x = _root._xmouse;
cap._y = _root._ymouse;
cap._visible = true;
};
} else {
delete hoverCaption.onEnterFrame;
cap._visible = false;
}
};


//end caption coding



Here is the code that exists on the movieclip of the draggable object:

code: //drag-n-drop code
on (press) {
startDrag ("_root.dragBall" ;
}

on (release) {
stopDrag ();
if (_root.dragBall._droptarget == "/Arizona" {
_root.brandName.gotoAndStop("brandX" ;
}
if (_root.dragBall._droptarget == "/Florida" {
_root.brandName.gotoAndStop("brandY" ;
}
if (_root.dragBall._droptarget == "/Massachusettes" {
_root.brandName.gotoAndStop("brandX" ;
}
if (_root.dragBall._droptarget == "/Illinois" {
_root.brandName.gotoAndStop("brandY" ;
}
if (_root.dragBall._droptarget == "" {
_root.brandName.gotoAndStop("noDecision" ;
}
}
//end drag-n-drop code

Obviously something is missing. I'm new to actionscripting, so it's likely that I'm going about this entirely the wrong way. I'm also certain that there are probably much more efficient ways to roll all of this together. But like I said, I'm just digging into coding so I may not be thinking about this the right way yet. Here are links to the .fla and .swf respectively so you can see everything for yourselves.

Any help thinking through this is greatly appreciated!
http://www.roxorbot.com/mapTest.fla
http://www.roxorbot.com/mapTest.swf

Drag And Drop And Object
Hello I'm still new to Actionscript. Just wondering how do you make and object to drag and drop to an area.For example i have 2 sets of items, animals and vehicles. How do i set the coding so that the object can go to a correct group.

Can I Drag And Drop Tweens From One Object To Another?
I have 50 pictures on 50 different frames, I want them all to fade in and out over 5 frames. Do I have to do this for all of them, or can I do it once and drop the tween on the other pictures?

TIA

Drop & Drag Learning Object
HELP -- I have developed a drop and drag learning object that is only doing half of what I need it to do, but I cannot finish it do to my inability to use action script.

I have 10 sentences and five x's. Five of the sentenses are correct and you can now drag an x to the correct sentence, however, all five right answers are equally right.

How can I have an x go to anyone of the five correct answers. After the user uses up all of the five x's they should be able to use the reset button and be able to do the exercise over again.

I have attached the fla file.

Can anyone help,

Carolyn
Instructional Designer

Drag Drop And Object Fall...
http://www.weazolink.com/flipflap.swf
the beach ball is drag and dropable.. how do i mak it to when you drop it in the air it falls back down... maybe with the effect of a bounce too..

Drag Drop And Object Fall...
http://www.weazolink.com/flipflap.swf
the beach ball is drag and dropable.. how do i mak it to when you drop it in the air it falls back down... maybe with the effect of a bounce too..

Resizing Drag&Drop Object In A Movie
Hi People :-)

I've got a question that is probably really obvious but I haven't been able to find any answers to it on here or various other Flash sites.

Basically I want to create a drag and drop object that a user can resize/scale, as well as move around. Similar to what you'd use when scaling an object in the flash stage environment...mousedown on a corner and drag big or small to change the size of the entire rectangle for example.
I've seen it done before, and think it has something to do with the 'x_scale' etc but I'm not sure how to string it all together.

I have a basic knowledge of actionscript and good knowledge of general flash techniques.

I'd really appreciate some tips and/or script examples of what to do :-)

Thanks in advance...hehe :-)

Kate

Drag And Drop - Scaling The Object When Dragging
hi,

I'm trying to make use of the drag and drop function in flash, whereby the drag object will get smaller when it reaches the target.

I tried creating a hotspot around the target and use 'dragOver mouseEvent' with 'tell target', but doesn't seem to work.

I would appreciate very much if anyone would provide me with some solutions to this problem.

Thanks in advance.

Drag And Drop Object Onto Target And Back Again
please help!
I want to be able to drag and drop an object onto a target area. If it doesn't go over target area I want it to go back to its start position.
When droped on the target area I want it to be dragable. When dragged outside the target area I want it to snap back to the origional start position.
Have had a look at Peter Brouwers tutorial on this site and so far so good except that when I drag the object out of the target area it goes to the previous position as oposed to the start position, am new to this actionscript thing and any help would be appreciated.
thanks...

Triggering MC Or Button With Drag 'n' Drop Object
Hi,

I need to find out a way to trigger either a button or MC with a drop 'n' drop object. Any suggestions???

I use Flash 5.

Multiple Targets For Drag And Drop Object?
I followed this tutorial:
http://www.hed.swin.edu.au/design/tu..._tut/index.php

And everything works out fine, until I added more targets and objects. I have a total of 5 objects and 5 targets. I would like to allow any of the objects to be dropped on any of the 5 targets. Right now, the object is assigned to one target. How do I make it so that it can go on any of the targets?

Here is the code:
onMouseMove = function(){
updateAfterEvent();
}

function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this,true,63,85,530,465);
this.beingDragged=true;
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged=false;
if (eval(this._droptarget) == targ) {
this.onTarget = true;
_root.targ.gotoAndStop(2);
} else {
this.onTarget = false;
_root.targ.gotoAndStop(2);
}
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
clip.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/3;
this._y -= (this._y-this.myHomeY)/3;
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (!this.beingDragged && this.onTarget) {
this._x -= (this._x-this.myFinalX)/3;
this._y -= (this._y-this.myFinalY)/3;
}
};
}

//here are two of the objects each corresponding to their own target.
dragSetup(ruff_mc,target1);
dragSetup(chee_mc,target2);






------------------------------------
I've tried everything I can think of, even copying the dragSetup like this:
dragSetup(ruff_mc,target1);
dragSetup(ruff_mc,target2);
dragSetup(ruff_mc,target3);
dragSetup(ruff_mc,target4);
dragSetup(ruff_mc,target5);

But, in this case, it ignores the previous targets and will only go to target 5.

How do I make the object go to any of the 5 targets?

Any help will be wonderful!

How To Save Object Positions In Drag & Drop
If I create a small drag & drop program, how would I save the positions of the objects I dragged to the stage. I ultimately want to send an email with a picture of the obejcts on the stage.

Drag And Drop An Infinite Number Of An Object
I need to create an object such as a movie that when the user press on it, it can be dragged and dropped and at the same time, another identical object is generated in its place.

Help!!

Thks

Making A 'drag N Drop' Object Snap To A Position
Howdy all, just a quick question. In following on from the 'drag and drop' tutorial, how would I make the object that i'm dragging snap to a particular position (lets say a tshirt snapping to a body)? Thanks all, BP

Drag And Drop File On A Flash Object To Upload
Hi,

Can anyone suggest me an idea for uploading a file which can be dragged from the local machine and dropped on a flash object which is embedded in a web page?

Drag N Drop Problem..i Cannot Drap E Duplicated Object
here is my case,
i have created a button which its function is to duplicate another object. After pressed e button, it duplicate an object.it can duplicate as many as i need. e duplicated button is dragable. but now my problem is .. i cant drag the duplicated object.. somoone help me... it is regarding about school final project, urgent. here my source

[MX04] Drag And Drop- Locking Object Into Center Of Target...
Hello all,
New member and relatively new Flash user. I created a drag and drop in Flash MX 2004, and I'm trying to find script that will lock the object into the center of the target when it is dragged over, sort of like a magnet effect. Here is the script I currently have on each object:


on(press) {
startDrag(this);
_root.reply.text="";
xstart = this._x;
ystart = this._y;
}

on(release) {
stopDrag();
if (this._droptarget == "/pinottarget") {
_root.reply.text="Correct!";
this.enabled = false;
_root.counter++;
}

else{
_root.reply.text="No, keep trying!";
this._x = xstart;
this._y = ystart;
}
}



If anybody can help me out with the correct script to do what I'm trying to do, I would greatly appreciate it. Attached is the source file. Thanks.

Lee

Drag & Drop - Animating A Dropped Object To Start Position
How can I make my drag and drop exercise so that when a dragged object is released, it goes back to its start position by animating back to it? I know how to script this so that it instantly snaps back to the start position, but I would like the user see the object move back to its start position.


My flash project can be downloaded from:

http://www.munzamedia.co.uk/flash/


Note: only the two top-left objects can be dragged.

Drop & Drag Text In MX ?
I have a scene involving 6 photos, and 6 descriptions on the bottom...

I want to make it so that the user can click and grab the individual text descriptions, and drag them and place them underneath the matching photos...I have seen it done before...

How can I do this...???

thanks,

D...

Drag And Drop Text
Can anyone point me in the direction of how to get input text, then create a new movie that contains that text. The new movie must then be draggable. I must also build a tool bar that would allow user to adjust the size, color and font of the new text. It would be even cooler if someone could explain how it is possible to dynamically arch or curve text. Thanks

Help With Drag And Drop Text
I am trying to create a series of text objects that I can drag and drop on the screen. I am trying to put text fields into a movieClip container since the Drag and Drop will not work on text fields. When I do this, Flash still sees the objects as text fields rather than movie clips, and I get the following error.

ReferenceError: Error #1069: Property startDrag not found on flash.text.TextField and there is no default value.
at chris_fla::MainTimeline/startDragging()

I am a beginner at this. What am I doing wrong? Thanks!

Russ









Attach Code

var sodaArray:Array = ["Coke", "Pepsi", "Sprite"];
var myFormat:TextFormat = new TextFormat();
myFormat.size = 16;
myFormat.font = "Arial Bold";

for (var i:int; i < sodaArray.length; i++) {
var container:Sprite = new MovieClip;
var soda:TextField = new TextField();
stage.addChild(container);
container.addChild(soda);
soda.text = sodaArray[i];
soda.setTextFormat(myFormat);
container.name=sodaArray[i];
container.y= 20*i;
DisplayObjectContainer(stage).addChild(container);

container.addEventListener(MouseEvent.MOUSE_DOWN,startDragging);
container.addEventListener(MouseEvent.MOUSE_UP,stopDragging);

}

function startDragging(event:MouseEvent):void {
event.target.startDrag();
}

function stopDragging(event:MouseEvent):void {
event.target.stopDrag();
}

Drag And Drop EDITABLE Text
Drag and Drop is no problem, done. Problem I'm running into is the EDITABLE text part. After the button is clicked a larger movie clip pops up, which your able to drag, etc.....
What would I have to do do to make this text in the movie clip EDITABLE?

I've tried Input Text, Dynamic Text all _sans so it's not a font issue.

Gurr.

Drag N Drop N Dyanmic Text
HI dere

im nt sure how to clear the endComment(dynamic text) once the user place the item back to the shelf.Cn u please hlp me chck my codes and see where did i go wrong. thank u veri much.

ps: my swf file juz drag the battery.




Code:
/********************************
Battery
********************************/
stop();
var dropBool = false;//1st var i created
var waterBool = false;//2nd var i created
battery5_mc._visible = false;
battery2_mc.useHandCursor = false;
battery2_mc.onPress = function() {
this.startDrag(false);
this.onMouseMove = function() {
updateAfterEvent();
};
};
// handle release event
battery2_mc.onRelease = battery2_mc.onReleaseOutside=function () {
stopDrag();
this.onMouseMove = undefined;
if (this.hitTest(_root.dropTarget_mc)) {
this.gotoAndStop(2);
this._x = 92;
this._y = 190;
_root.answer3 = "17.99";
_root.answer1 = "17.99";//mass
_root.waterBattery_mc.gotoAndStop(1);
_root.error_mc.gotoAndStop(1);
dropBool = true;
} else if (this.hitTest(_root.waterTarget_mc)) {
this.gotoAndStop(2);
this._visible = false;
this._x = 92;
this._y = 190;
_root.answer2 = "7";//vol
_root.answer3 = "0";
_root.water_mc._visible = false;
_root.waterBattery_mc.gotoAndPlay(2);
_root.error_mc.gotoAndStop(1);
waterBool = true;
} else {
this._x = 88.5;
this._y = 31;
_root.answer3 = "0";
_root.answer1 = "";
_root.answer2 = "";
_root.endComment = "";
_root.water_mc._visible = true;
_root.waterBattery_mc.gotoAndStop(1);
_root.error_mc.gotoAndStop(1);
}
if (dropBool && waterBool) {
_root.endComment = "2.57";
}else if(dropBool && waterBool != true){
_root.endComment = "";
}
trace(dropBool);
trace(waterBool);
};

Drag And Drop Dynamic Text
my code:


hazard1.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
hazard1.addEventListener(MouseEvent.MOUSE_UP, dropIt);

function pickUp(event:MouseEvent):void {
event.target.startDrag(true);
}
function dropIt(event:MouseEvent):void {
event.target.stopDrag(true);
}

I receive error:

ReferenceError: Error #1069: Property stopDrag not found on flash.text.TextField and there is no default value.
at dragdrop_as3_complete_fla::MainTimeline/dropIt()


Im trying to drag a movie clip that contains a dynamic text field only. Is there something that I'm missing

Drop Down Menu With Rollover Text
Where can I find a tutorial about drop down menu buttons that the text have rollover colors and each text acts like it's own button within the button?

And also be a tutorial for Mac.


TIA

Text Fields+variables, Drag And Drop?
I'm building a photography portfolio.
How do I change a single sperate text field to display a different title when the mouse moves over different objects (buttons etc.) ?
Also, I want to build a drag and drop mini clipboard area as well so the user can store thumbnails of their favourite images as they navigate the site. (Flash4)
Suggestions v.much appreciated.

richieeaton@yahoo.co.uk

Thanks.

Drag/Drop Selected Text In TextField
This is a long shot, but is there a simple way to allow for the dragging and dropping of selected text in a text field?

For example, in a textfield if I were to highlight the last sentence, and drag it to the top so that it was the first sentence instead.

Thanks in advance for any help!

-Aaron

Html, Dynamic Text, Drag/drop, Ect...
ok i have a few problems
1.how do you change the color of the arrows in the scroll bar provided by flash?
2. if i have a dynamic text box, how do i add a button or make a work link to something...is it html? if so what is the code cause i have no html experience..
3. i have a drag and drop menu where when you drop an object on the target it opens a swf in the _root movie. the menu is always on the left side of the screen so i want it to erase the object dropped from the target area after it opens the swf...any ideas? and since its a menu i want to be able to choose that menu option again so if it erases it completely i wont be able to so i guess i need it to move back to its original place. i made a little example...ideally i would have more than one menu item hense the need for it to "reset


thanks in advance
xxx

[F8] Issue With Dynamic Text In A Drag And Drop
Hi guys,

I've coded a teaching resource in flash but want to give feedback dynamically as to whether the answers are right or wrong, I've followed the guides I have found and it's STILL not working.

I've put my dynamic text field in, with an instance name and referred to this instance name within the code for the drag and drop item in the top left, if you would like to check the code.

Please find attached an FL8 version of the .fla file.

Any help you can provide would be VERY much appreciated.

http://www.2shared.com/file/3657125/daf08d54/DLFL8.html

To download click 'Click here' in the bottom right.

Dynamic Text Error In A Drag And Drop
Hi guys,

I've coded a teaching resource in flash but want to give feedback dynamically as to whether the answers are right or wrong, I've followed the guides I have found and it's STILL not working.

Please find attached an FL8 version of the .fla file.

Any help you can provide would be VERY much appreciated.

http://www.2shared.com/file/3657125/daf08d54/DLFL8.html

Dynamic Drag And Drop From A Text File
Hope you had a Happy Newyear!


I am prototyping(or trying) to get data from a text file and populate a drag and drop exercise.

The user inputs the name of the drag & drop elements and the drag and drop exercise is dynamically posistioned on the stage.... I have included the basics of this exercise

Where would I start... I am familiar with importing both XML and Text

I am trying to break down another tutorial..to no avail...this block initializes how many targets ////////////////////////////////////


ActionScript Code:
/:howmany = 12;
/:try = 0;
index = 1;
while (Number(index)<=Number(/:howmany)) {
    set("/:target_x" add index, getProperty ("/target" add index,_x));
    set("/:target_y" add index, getProperty ("/target" add index,_y));
    set("/:object_x" add index, getProperty ("/object" add index,_x));
    set("/:object_y" add index, getProperty ("/object" add index,_y));
    index = Number(index)+1;
}
stop();


This block Checks/////////////////

ActionScript Code:
index = 1;
while (Number(index)<=Number(/:howmany)) {
    if (getProperty ("/" add /:me,_droptarget) eq "/target" add index) {
        setProperty("/" add /:me, _x, eval("/:target_x" add index));
        setProperty("/" add /:me, _y, eval("/:target_y" add index));
        if (/:num eq /:dropnum) {
            set("/:hit" add /:num, "1");
        } else {
            set("/:hit" add /:num, "0");
        }
    }
    index = Number(index)+1;
}
stop();

This block evaluates a correct hit//////////

ActionScript Code:
/:try = /:eval("try") + 1;
index = 1;
if (/:eval("try") < 3) {
    while (Number(index)<=Number(/:howmany)) {
        if (eval("/:hit" add index) eq 1) {
            tellTarget ("/object" add index) {
                gotoAndStop(2);
            }
        }
        index = Number(index)+1;
    }
} else {
    index = 1;
    while (Number(index)<=Number(/:howmany)) {
        setProperty("/object" add index, _x, eval("/:target_x" add index));
        setProperty("/object" add index, _y, eval("/:target_y" add index));
        tellTarget ("/object" add index) {
            gotoAndStop(2);
        }
        index = Number(index)+1;
    }
}
stop();

Drag And Drop Text Field Problem
I'm working on a simple counting game for my son, However I'm running into a problem with the text field inside of my bomb movieClip. I thought that turning off the text fields selectability might fix it, but that didn't work. I'm guessing that the fix to this problem may have to do with stopEventPropagation, but I'm not sure how to use it.

Code:

//123bomb: a counting game for pre-shoolers

//assets
//empty container for bombs
var container:Sprite = new Sprite();
addChild(container);
//movie clip exported for use in actionscript
var bomb:Bomb;
//counts the # of bombs on the stage
var bombCount:int = 0;

//event listeners for drag and drop
container.addEventListener(MouseEvent.MOUSE_DOWN, onStartDrag);
container.addEventListener(MouseEvent.MOUSE_UP, onStopDrag);

//functions
function onStartDrag(e:MouseEvent):void {
   e.target.startDrag();
   e.target.scaleX = 1.25;
   e.target.scaleY = 1.25;
   var thisBomb:MovieClip = e.target as MovieClip
   container.setChildIndex(thisBomb, container.numChildren - 1);
}

function onStopDrag(e:MouseEvent):void {
   e.target.stopDrag();
   e.target.scaleX = 1;
   e.target.scaleY = 1;
   
   
}


//place bombs on stage
for (var i:int = 0; i < 20; i++) {
   bomb = new Bomb();
   bombCount ++;
   bomb.x = Math.round(Math.random() * 371) + 48;
   bomb.y = Math.round(Math.random() * 308) + 119;
   container.addChild(bomb);
   bomb.bombNum.selectable = false;
   bomb.bombNum.text = ("" + bombCount);
}



as you can see, if you click on the text field it interferes with the drag and drop functions.
I'd be grateful for any feedback.

Thanks.

Drag And Drop Interaction With Variables And Text Fields
Hi there....

I'm making an interface for a make your own trailer style website. The users drag clips from the Clips section on to a time line made of 4 blocks. the clips are a Movie Clip with a button inside on the main tmieline. The button inside has the following code on it:

on (press) {
startDrag ("/a1");
}
on (release) {
stopDrag ();
}
// drag and drop script
on (release) {
// if clip1 is dropped onto block 1
if (getProperty("/a1", _droptarget) eq ("/b1")) {
setProperty ("/a1", _x, "40");
setProperty ("/a1", _y, "360");
// set variable of block 1 to 1
TL1 = "1";
// if clip1 is dropped onto block 2
} else if (getProperty("/a1", _droptarget) eq ("/b2")) {
setProperty ("/a1", _x, "80");
setProperty ("/a1", _y, "360");
// set variable of block 2 to 1
TL2 = "1";
// if clip1 is dropped onto block 3
} else if (getProperty("/a1", _droptarget) eq ("/b3")) {
setProperty ("/a1", _x, "120");
setProperty ("/a1", _y, "360");
// set variable of block 3 to 1
TL3 = "1";
// if clip1 is dropped onto block 4
} else if (getProperty("/a1", _droptarget) eq ("/b4")) {
setProperty ("/a1", _x, "160");
setProperty ("/a1", _y, "360");
// set variable of block 4 to 1
TL4 = "1";
} else {
setProperty ("/a1", _x, "50");
setProperty ("/a1", _y, "100");
// If clips are dragged elsewhere otherthan timeline set variables to 0
TL1 = "0";
TL2 = "0";
TL3 = "0";
TL4 = "0";
}
}

I also have the following scipt on the main timeline telling it to set the variable to 0:

stop ();
TL1 = "0";
TL2 = "0";
TL3 = "0";
TL4 = "0";

Underneath each block in the time line I have created a Dynamic Text field with the Variable set to TL1, TL2 etc depending on which block the text is underneath.

So when the user drags say clip 1 to block 2 of the timeline the text field under block 2 should read "1"(Because clip 1 was dragged onto it)

If you go to the link below you can see what its all doing.

http://www.globeshoes.com/somewhere/.../interface.swf

What I can't tell is:

1. Are the variables updating when the clips are dragged on to the blocks in the timeline.

or

2.Are the variables updating but the text fields arent.

Any help would be much appreciated.

Thankyou...

Robert

Using Drag & Drop To Change Dynamic Text Field
Hi Everyone! I'm new to Flash and am a bit confused, but I will try to keep this as simple as possible. I am creating a quiz where the user will drag a word over a picture and if it is correct, a dynamic text field over the picture will display the word "YES".

Here is the script I have thus far:

code:
on(press) {
startDrag(this);
_root.answer="";
}
on(release) {
stopDrag();
if (this._droptarget == "/DTOffice") {
_root.answer="YES";
}

}



"DTOffice" is the name of my movie clip and is the correct destination for the dragged word.

QUESTIONS
1. I feel like my problem may be with button usage? Right now, everything is a movie clip (the draggable word and the destination box). Does there have to be a button involved somewhere?

2. My destination movie clip ("DTOffice"), should that be a variable name? an Instance name? I know my problem is in that line of code because if I put any text in the 2nd line (under startDrag where it sets the value of the dynamic field initially), it will display correctly. ALSO, if I put an else statement after the if (to say else root.answer="NO"), the code will go right to the else statement and will display "NO" the entire time.

I hope this makes sense and somebody can help me out, I appreciate any help or advice anyone can provide!

[F8] Drag And Drop, Loading External Text File(s)
Hello,
I am in the middle of making a drag and drop project where, whenever the user drags and then drops the object into the drop zone, I would like externally loaded text to appear in the dynamic text box. I don't know if this is even possible, though. It seems like it should be, but I really don't know. I found some exercises where it is done with static text or just regular buttons, but I can't figure out how it works with draggable movie clips. I have them as draggable movie clips because they double in size once they are dropped. Maybe there is a script that will make the text file load after the object is dropped? I am not sure.

I wanted to upload my source file but it is larger than 2 MB so unfortunately I can't. If anyone has any answers or suggestions, I'm all ears (or eyes, I guess). Thanks very much!

Drag And Drop To Grid With Snap To And Text Handles
Hi Everybody,

I'm tackling a new project and I can't figure out where to start! The app allows the user to drag images from a libray onto a grid and position the elements within the grid. The user can also drag textfields which can be edited and resized.

The grid needs to have some sort of snap-to, to make it easier for the user to line up the elements. And then I need to create resize handles around both the editable text fields and the other mc's. Has anyone seen a tutorial or can anyone help me with?

1. Drag and drop with a snap to grid
2. Resize handles for mc's, and inparticular textfields

In the end, I need to be able to track all of the x and y's of the elements on stage and then be able to rebuild their layout when it is loaded in a subsequent session. I'm sure this is going to be difficult. What do you think?

Brook

Drag & Drop: Mulltiple Buttons, Streaming Flv, Text Boxes
Hi all,
Almost finished my project, but I thought it would be great for the user to be able customize his inferface a little.

I can dragstart, buttons and simple objects.

But How do I:

1/ Drag multiple (9) buttons?

- do I have drag one button, and then use some kind of x/y offsets in actionscript for the others, or is there a more elegant way?

2/ Drag text boxes
- tried putting a button underneath, and I can drag it around, but I can't let go of my textbox then, because the button thinks it over a textbox

3/ Streaming flv
- created 10 streams as below, but have no idea how to move them, I could put an invisible button under the flv, and run some actionscript in on neter frame, but again is there something simpler?

//
//**********************************************
// SETUP NETSTREAM CONNECTON flv1
//
NC1 =new NetConnection();NC1.connect(null);
flv1 =new NetStream(NC1);flv1.setBufferTime(0);
flvstream1.attachVideo(flv1); flvsnd1.attachAudio(flv1);
flvs1 = new Sound(flvsnd1);


I know I've asked more than one question, I hope that's not considered rude, but any answers to any of them would really be appreciated.

Rick

How To Check If A Drag & Drop Exercise Is Completed And Then Use A Dynamic Text Box
I am using FlashMX. I have just completed a drag and drop exercise with 6 targets. I would like to have a dynamic text box say "Congratulations" when all six mcs are in the right target.

My drag and drop code on each MC looks like this:

PHP Code:





 on (press) {
    _root.bringToFront(this);
    startDrag(this);
}
on (release) {
    stopDrag();
    if (this._droptarget=="/box1"){
        setProperty(this, _x, 303);
        setProperty(this, _y, 62);
}else{
        setProperty(this, _x, 489);
        setProperty(this, _y, 153);
}








I tried adding this to the first frame:

PHP Code:





var finish=0;
if(finish==6){
textbox="Congratulations!"








Then to the drag and drop code I tried adding (after setProperty(this, _y, 62)

PHP Code:





 finish=finish+1; 







I also put a trace on the variable finish. It traces to 0 when the .swf loads, but doesn't pick up on the "finish=finish+1;". Anyone know what I'm doing wrong or what else I could try?

[F8] Drag Object And Produce Text
Hello Friends,

I have an object that user’s can click on and move along the X-axis, (kind of a chart thing). As the object is moved along I need some lines of text to appear at various places. For instance at ¼ way, at ½ way and at ¾ the way.

If anyone knows how I could do this, I would be very grateful to hear from you. Many thanks in advance for any assistance you can offer.

I did recieve a reponse to this question before and it looked like exactly what I needed. Unfortuantely when I unzipped the file, FLASH gave me the prompt - "Unexpected File Format". So I was unable to make use of it. Please see the example under posted heading... "Drag object and Produce Text Question " posted by myself David_111.

Here is my script for the object…

on (press) {
startDrag("", true, 0, 85, 400, 85);
}
on (release) {
stopDrag();
}

[F8] Drag Object And Produce Text Question
Hello Friends,

I have an object that user’s can click on and move along the X-axis, (kind of a chart thing). As the object is moved along I need some lines of text to appear at various places. For instance at ¼ way, at ½ way and at ¾ the way.

If anyone knows how I could do this, I would be very grateful to hear from you. Many thanks in advance for any assistance you can offer.

Here is my script for the object…

on (press) {
startDrag("", true, 0, 85, 400, 85);
}
on (release) {
stopDrag();
}

Drag And Drop MC, Involves Polygonal Boundary, Drop Into Trash.
Hello. This is my desperate problem:

I am creating a circuit diagram designer.
There is basically instructions on the left, in a scrolling textbox (taken care of) and above that a rectangle with a bunch of components in it.

You need to be able to drag the circuit part from the side bar (a duplicate, so that the original remains in the same spot), and to a square on the grid on the stage of this program(Should snap to place...). Each clone should be able to be moved. Like so: You Press on a MC to drag it, the thing you are dragging to the stage is of course a clone. You release the mouse button, so it drops on the grid. It snaps into place. *Oops, you made a mistake. You press on it again, it is draged by your mouse to another square, and does not make a clone. *mind Changes... I dont want to use this one any more. You press on the MC, drag it to a bin which animates to show you the MC is being dragged over it. You release, the MC in question is deleted/removed...

You need to be able to rotate circuit parts by clicking on it so that it highlights, then pressing space bar.

It must also be possible to delete a duplicate by dragging it to the trash (an image/ MC), and last but not least, it is required to save the contents of the stage, or print them off.

Please note that to print it off, there are 2 input boxes outside the stage. One for the title, and one for the Users' Name. When they click on the print button, the two dynamic text fields must retrieve the values from the box outside of the programs' stage.

One Last detail: The cloned objects to be dragged around net to be in a six co-ordinate polygonal boundary, so that no-one can place any objects outside of the stage.

If anyone can help me, i would greatly appriciate it. I need to get this done asap. The graphics have been taken care of, it is just the coding to be done now. HELP, HELP PLEASE!




Thanks - Matt K

(1)drag Drop In 3 (2)drag Dropin 3 ...print 3 Contents (1)+(2)
i want to do the following.

drag (dynamic text file link)1 of choice of x text file links
into an area where all text file links can then be printed..(the text file itself)


[1] [2] [3] [4] [5]...


(basket)


drag drop [1] then [2] then [3] then [4] into (basket)

then print textfiles related to [1] [2] [3] [4]

if sombody could point me to a good tutorial or help me on my way?

thanx

Copyright © 2005-08 www.BigResource.com, All rights reserved