_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?
i think the problem is that u're using "slash-syntax" which
is not supported since flash 5
according to flash help documents of _droptarget, it
recommand using eval() function to convert the returned value from
slash syntax to a dot-syntax reference.
try rewrite
if (_root.mov_logo._droptarget == "/mov_home_drop") {
as
if (_root.mov_logo._droptarget == eval("/mov_home_drop")) {
or
if (_root.mov_logo._droptarget == _root.mov_home_drop) {
u may use trace() in your target MC to get the correct path
also your loadMovie() seems provided wrong parameters
the second parameter of loadMovie() should be an "object
reference" but not a String, simply remove the double quote
hope it helps u
Similar Messages
-
Loadmovie, problem with (_droptarget ==)
Hi all
I have problem with loadmovie that drive me crazy!. I made a
drag and drop quiz (attached) that works perfectly but when I load
it in another movie it doesn’t work anymore!
The code that doesn’t work is:
if (getProperty("/face1", _droptarget) == "/box3")…
when the drag touch the target it should stay there.
I attached the fla. If you have an idea it would be a great
help!
Thanks
HernyYep you can resize a movieclip dimensions on a percentage
scale by using _xscale & _yscale which is applied from the
registration point of the movieclip. For example, I reduce the
scale of the movieclip below by 50% both horizontally and
vertically... -
Does anyone know how to set up a drag and drop activity where
you can have 1 target that multiple items get dragged to? For
example, an activity where you would drag multiple images into a
trash can.
I've tried, and it seems like once one items goes into the
target, nothing else works because its going on top of the first
item.
TIA!!!OK, I'm having trouble again. I need multiple items to drag
to one target. I'm putting all my actionscript in the same frame,
and here's how it looks:
stop();
name_mc.onPress = function():Void {
this.startDrag(true);
name_mc.onRelease = function():Void {
this.stopDrag();
if (eval(this._droptarget) == safe_mc) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
address_mc.onPress = function():Void {
this.startDrag(true);
address_mc.onRelease = function():Void {
this.stopDrag();
if (eval(this._droptarget) == safe_mc) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
And I'm getting the following error message:
**Error** Scene=Recap, layer=actions, frame=1:Line 21:
Statement block must be terminated by '}'
address_mc.onRelease = function():Void {
**Error** Scene=Recap, layer=actions, frame=1:Line 27: Syntax
error.
Total ActionScript Errors: 2 Reported Errors: 2
Do you know what I'm doing wrong? -
One tray for multiple button group items
Hi,
I have 3 button group items in my templaate ,in the propoerties of these button grps the tray is on .NOw I can see 3 trays when I execute my template instead I want to have one tray for these 3 button group items . How is this possible?
THanks
SanyOK, I'm having trouble again. I need multiple items to drag
to one target. I'm putting all my actionscript in the same frame,
and here's how it looks:
stop();
name_mc.onPress = function():Void {
this.startDrag(true);
name_mc.onRelease = function():Void {
this.stopDrag();
if (eval(this._droptarget) == safe_mc) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
address_mc.onPress = function():Void {
this.startDrag(true);
address_mc.onRelease = function():Void {
this.stopDrag();
if (eval(this._droptarget) == safe_mc) {
this.swapDepths(this._parent.getNextHighestDepth());
this.removeMovieClip();
And I'm getting the following error message:
**Error** Scene=Recap, layer=actions, frame=1:Line 21:
Statement block must be terminated by '}'
address_mc.onRelease = function():Void {
**Error** Scene=Recap, layer=actions, frame=1:Line 27: Syntax
error.
Total ActionScript Errors: 2 Reported Errors: 2
Do you know what I'm doing wrong? -
How can I create a snap to object script?
Can anyone lend some advice or knowledge on this topic. I am wanting to in essence create a puzzle with pieces that when you drag the object you can only drop it back where you got it from or into the correct spot.
Before I waste your time let me clarify a bit more. It isn't really a puzzle(I figured that would be the best way to visualize what I was explaining) Basically it is an object that when dragged to the right spot will (snap to) or drop into place. If it is dragged to the wrong spot then it will be forced back to where it was originally.
Hope that wasn't too confusing loluse the _droptarget property of movieclips to determine if your dropped item is dropped on the correct spot or not. assign the dropped movieclip's _x and _y properties based on this.
-
Help with simultaneous on off sound buttons
hi, I'm an intermediate flash user and I've made a file for
my kids in class that has some sound on-off buttons. they are set
to play once or loop depending on length by simple mouse click.
they will play simultaneously if more than one is clicked
individually on the page. I'm trying to make the page so the kids
can just select the sound button icon, drag as many of them as they
want (usually 2 -4 sounds at a time) into a box at the bottom of
the page where they will then just play and loop. if they are
dragged out of the box, that sound will stop. if another is dragged
into the box it's sound will then join the ones that are already
looping. can someone please help point me to the action script I
need to write for this to occur? thanks. please email me at school:
[email protected] if you can.yes, using the linkageID will allow you to start the sound
associated with each icon.
so, if you have an icon with instance name drumsIconMC and
you have a sound in your library that you've assigned a linkage id
of drumsID, you can use:
drumsIconMC.soundID = "drumsID";
drumsIconMC.onPress=function(){
this.startDrag();
drumsIconMC.onRelease=function(){
this.stopDrag();
if(eval(this._droptarget) == boxMC){ // assuming your drop
target box is named boxMC
if(this.s == undefined){
this.s = new Sound();
this.s.attachSound(this.soundID);
this.s.start(0,999); // <- asssuming you want to loop your
sound 999 times
} else{
if(this.s != undefined){
this.s.stop(); -
Swf not working correctly in Captivate 2
Hi,
First time poster :-)
I have built a drag and drop program in flash 8 using very
simple actionscripts.
The app is bug free and works fine with any browser.
When i import the app into Cap, the drag function works and
the drop function works but the disapear function does not.
onClipEvent(mouseDown) {
startDrag(this);
onClipEvent(mouseUp) {
stopDrag();
if (this._droptarget == "/green") {
setProperty(this, _visible, "0"); +++++ Visible set to zero
normally makes the object dissapear, but inside captivate the
object just jumps back to x and y postitions specified below.+++++
} else {
this._x=450
this._y=100
Why does Captivate not view SWF's correctly and are there any
other ways i can get this to work.
Cheers, JaredJared,
(First time poster too!)
I've got the same problem and no amount of anything I've
tried has worked.
However, there is a work around - bit of a pain but it
works...
Publish your fla to Flash Player 6 and then insert you swf
into Captivate 1 (one). Save it then open Captivate 2 (two) and
open the previous saved Cap1 file - accept all the dire warnings
about overwriting etc and it works. Not tried inserting Cap1 files
in the middle of a Cap2 movie yet but I'm sure it can be made to
work.
Adobe - please tell us there's a fix coming out for
this... -
A drag and drop game with dynamic text response
Hi,
I am a teacher and my school has recently upgraded to Adobe Design Premium. Our previous version was about 5 versions out of date.
I teach A Level which requires students to create an Interactice Multimedia product.
In the previous 6 years, I have taught students how to create simple drag and drop game with dynamic text responses.
Since the upgrade to Actionscript 3.0 the dynamic text response has ceased working.
When creating the game from scratch, I need to move to Actionscript 2.0 as 3.0 does not allow me to add actionscript to objects - I know and am sure that this is a better way of doing things, but I would prefer to keep working the way I am used to.
I use a switch case statement which I have copied below to make the drag and drop work. The objects I apply the code to work in that they can be dragged, however, my dynamic text box with a variable name of "answer" is no longer displaying the response when an answer is left on a dropzone (rectangle converted to a symbol and given an instance name).
on(press) {
startdrag(this);
on(release) {
stopdrag();
switch(this._droptarget) {
case "/dropzoneB":
_root.answer="Well done";
break;
case "/dropzoneA":
case "/dropzoneC":
_root.answer="Hopeless";
break;
default:
_root.answer="";
break;
Any help would be much apeciated.
Thanks
AdrianTo drag in as3
blie_btn is the instance of the object drawin on the stage. In AS3 you have to assign a even listener, in this case MOUSE_DOWN, and MOUSE_UP, as we want the drag to stop if the mouse is not clicked. Then we fire the functions, and tell the object to start drag.
// Register mouse event functions
blue_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
blue_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
red_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
red_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
// Define a mouse down handler (user is dragging)
function mouseDownHandler(evt:MouseEvent):void {
var object = evt.target;
// we should limit dragging to the area inside the canvas
object.startDrag();
function mouseUpHandler(evt:MouseEvent):void {
var obj = evt.target;
obj.stopDrag();
if you want to make the text do what you want then something like this might work.
In the function, you could add a text box onto the stage, give it a instance of something like outputText
and then:
outputText = ("Bla Bla Bla");
(^Not sure if this will work exactly^)
PS. I am currently a A-level student -
Flash drop target problem in Captivate
I realise that this is more a Flash-specific question, but I thought I'd give the Captivate forum a try as it relates to a Captivate lesson I am trying to put together.
I have an interactive exercise that I have produced in Flash CS4 (Actionscript 2), that involves the user dragging and dropping movieclips onto specific drop targets.
It works fine when run on its own/in a browser etc, but when I insert the movieclip into Captivate to incorporate it into the lesson, the drag/drop functionality doesn't work as it should do anymore (drag/drop still works, but the dropped mc's no longer react to being dropped on the correct targets.)
I'm wondering if this is because Captivate outputs the lesson as an .SWF, so my Flash clip is within a 'container' consisting of the actual Captivate e-learning package itself?
Unfortunately my knowledge of Flash and Captivate is still in its infancy, so any help would be greatly appreciated from anyone with experience of using Flash within Captivate.
Thanks.Hi kglad,
Thanks for your quick reply. I'm little confused though - this is the line of code I'm suspecting I need to change: -
if (GetProperty ("/Ref_out", _droptarget) eq "/Ref_in") {
Ref_out being the dragged object, Ref_in being the drop target mc. How would I go about using the _name property instead?
Sorry for the stupid question, but I'm struggling to find my way around the Adobe help files on the web - I don't think they're particularly user friendly, but maybe that's just me. -
Draggable images and replacing positions
i have 6 images, draggable ones that replace the position of the new image you drag it to.
actionscript:
on (press) {
dragsound.start();
startDrag("_root.facebook");
this.swapDepths(1000); //bring icon to the front
facebookposOLDy = getProperty(_root.facebook, _y); //gets position of original facebook icon
facebookposOLDx = getProperty(_root.facebook, _x);
ebayposy = getProperty(_root.ebay, _y);
ebayposx = getProperty(_root.ebay, _x);
googleplusposy = getProperty(_root.googleplus, _y);
googleplusposx = getProperty(_root.googleplus, _x);
twitterposy = getProperty(_root.twitter, _y);
twitterposx = getProperty(_root.twitter, _x);
googleposy = getProperty(_root.google, _y);
googleposx = getProperty(_root.google, _x);
youtubeposy = getProperty(_root.youtube, _y);
youtubeposx = getProperty(_root.youtube, _x);
on (release) {
dropsound.start();
stopDrag();
if (_root.facebook._droptarget == "/ebay") {
_root.facebook._x = ebayposx;
_root.facebook._y = ebayposy;
_root.ebay._x = facebookposOLDx;
_root.ebay._y = facebookposOLDy;
} else if (_root.facebook._droptarget == "/googleplus") {
_root.facebook._x = googleplusposx;
_root.facebook._y = googleplusposy;
_root.googleplus._x = facebookposOLDx;
_root.googleplus._y = facebookposOLDy;
} else if (_root.facebook._droptarget == "/twitter") {
_root.facebook._x = twitterposx;
_root.facebook._y = twitterposy;
_root.twitter._x = facebookposOLDx;
_root.twitter._y = facebookposOLDy;
} else if (_root.facebook._droptarget == "/google") {
_root.facebook._x = googleposx;
_root.facebook._y = googleposy;
_root.google._x = facebookposOLDx;
_root.google._y = facebookposOLDy;
} else if (_root.facebook._droptarget == "/youtube") {
_root.facebook._x = youtubeposx;
_root.facebook._y = youtubeposy;
_root.youtube._x = facebookposOLDx;
_root.youtube._y = facebookposOLDy;
} else {
_root.facebook._x = facebookposOLDx;
_root.facebook._y = facebookposOLDy;
i know theres probably a shorter way to go about doing it, but can somebody tell me why it works when i grab the first image and can replace any other...but when i grab a 2nd image after moving the first..i can replace any other image except the one that has been moved before.facebook.as :
on (press) {
dragsound.start();
startDrag("_root.facebook");
this.swapDepths(1000); //bring icon to the front
facebookposOLDy = getProperty(_root.facebook, _y); //gets position of original icon
facebookposOLDx = getProperty(_root.facebook, _x);
ebayposy = getProperty(_root.ebay, _y);
ebayposx = getProperty(_root.ebay, _x);
googleplusposy = getProperty(_root.googleplus, _y);
googleplusposx = getProperty(_root.googleplus, _x);
twitterposy = getProperty(_root.twitter, _y);
twitterposx = getProperty(_root.twitter, _x);
googleposy = getProperty(_root.google, _y);
googleposx = getProperty(_root.google, _x);
youtubeposy = getProperty(_root.youtube, _y);
youtubeposx = getProperty(_root.youtube, _x);
on (release) {
dropsound.start();
stopDrag();
if (_root.facebook._droptarget == "/ebay") {
_root.facebook._x = ebayposx;
_root.facebook._y = ebayposy;
_root.ebay._x = facebookposOLDx;
_root.ebay._y = facebookposOLDy;
} else if (_root.facebook._droptarget == "/googleplus") {
_root.facebook._x = googleplusposx;
_root.facebook._y = googleplusposy;
_root.googleplus._x = facebookposOLDx;
_root.googleplus._y = facebookposOLDy;
} else if (_root.facebook._droptarget == "/twitter") {
_root.facebook._x = facebookposx;
_root.facebook._y = facebookposy;
_root.twitter._x = facebookposOLDx;
_root.twitter._y = facebookposOLDy;
} else if (_root.facebook._droptarget == "/google") {
_root.facebook._x = googleposx;
_root.facebook._y = googleposy;
_root.google._x = facebookposOLDx;
_root.google._y = facebookposOLDy;
} else if (_root.facebook._droptarget == "/youtube") {
_root.facebook._x = youtubeposx;
_root.facebook._y = youtubeposy;
_root.youtube._x = facebookposOLDx;
_root.youtube._y = facebookposOLDy;
} else {
_root.facebook._x = facebookposOLDx;
_root.facebook._y = facebookposOLDy;
twitter.as :
on (press) {
dragsound.start();
startDrag("_root.twitter");
this.swapDepths(1000); //bring icon to the front
twitterposOLDy = getProperty(_root.twitter, _y); //gets position of original icon
twitterposOLDx = getProperty(_root.twitter, _x);
ebayposy = getProperty(_root.ebay, _y);
ebayposx = getProperty(_root.ebay, _x);
googleplusposy = getProperty(_root.googleplus, _y);
googleplusposx = getProperty(_root.googleplus, _x);
facebookposy = getProperty(_root.facebook, _y);
facebookposx = getProperty(_root.facebook, _x);
googleposy = getProperty(_root.google, _y);
googleposx = getProperty(_root.google, _x);
youtubeposy = getProperty(_root.youtube, _y);
youtubeposx = getProperty(_root.youtube, _x);
on (release) {
dropsound.start();
stopDrag();
if (_root.twitter._droptarget == "/ebay") {
_root.twitter._x = ebayposx;
_root.twitter._y = ebayposy;
_root.ebay._x = twitterposOLDx;
_root.ebay._y = twitterposOLDy;
} else if (_root.twitter._droptarget == "/googleplus") {
_root.twitter._x = googleplusposx;
_root.twitter._y = googleplusposy;
_root.googleplus._x = twitterposOLDx;
_root.googleplus._y = twitterposOLDy;
} else if (_root.twitter._droptarget == "/facebook") {
_root.twitter._x = facebookposx;
_root.twitter._y = facebookposy;
_root.facebook._x = twitterposOLDx;
_root.facebook._y = twitterposOLDy;
} else if (_root.twitter._droptarget == "/google") {
_root.twitter._x = googleposx;
_root.twitter._y = googleposy;
_root.google._x = twitterposOLDx;
_root.google._y = twitterposOLDy;
} else if (_root.twitter._droptarget == "/youtube") {
_root.twitter._x = youtubeposx;
_root.twitter._y = youtubeposy;
_root.youtube._x = twitterposOLDx;
_root.youtube._y = twitterposOLDy;
} else {
_root.twitter._x = twitterposOLDx;
_root.twitter._y = twitterposOLDy;
maybe its something small im not noticing? remembering the position or something, i have no idea -
Drag and Drop multiple boxes and snap to multiple locations then reveal button
Hi I'm Trying to develop a small game where the user chooses from a range of boxes of the left of screen and can drag 3 of them separatley to 3 holding boxes on ther right. each box can be dragged to any location and the order is not important. Once the 3 holding boxes are all full I want a new button to appear. I completed a tutorial and I've got one box working perfectly but no matter what i try I can't get it working with multiple boxes and locations. Below is a list of the instance names of the movie clips plus my actionscript. I've attached a link to the flash file. Any help would be really appreciated. Cheers
LINK
http://www.sainters.net/flash_preview/flash_test/flash test_v6.fla.zip
INSTANCE NAMES
box 1 = "circle_mc"
box 2 = "circle_mc2"
both the grey boxes are called = "targetCircle"
ACTIONSCRIPT
function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this);
this.beingDragged=true;
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged=false;
if (eval(this._droptarget) == targ) {
this.onTarget = true;
_root.targ.gotoAndStop(2);
} else {
this.onTarget = false;
_root.targ.gotoAndStop(1);
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
clip.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/5;
this._y -= (this._y-this.myHomeY)/5;
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (!this.beingDragged && this.onTarget) {
this._x -= (this._x-this.myFinalX)/5;
this._y -= (this._y-this.myFinalY)/5;
dragSetup(circle_mc,targetCircle);Two things...
1) if you want both circles to be draggable you need to execute that last line twice, once for each.
dragSetup(circle_mc); // left off second argument purposefully
dragSetup(circle_mc2);
2) you do not want to name the targets the same name... only one will work as a target that way. GIve them different names, and assign each one a property like...
targetCircle1.isTarget == true;
targetCircle2.isTarget == true;
and in your hittest function test for that property. And if you don't want to allow the user to drop two circles on the same target, set that property to false after it is dropped on... something like...
if (this._droptarget.isTarget) { // may still need eval() portion
this._droptarget.isTarget = false;
Back to item 1... with this approach you won't need to pass the target as an argument, unless you need to have each circle dropped on a specific target instead of any of them (in that case you go back to specifying and testing the target instance)
Your overall dragSetup function will change in various ways if you follow what is offered here as far as allowing for any circle to be placed on any target. If you require specific targets, then your code would remain much as it is except you still need different instance names for all the objects. -
ok, im not new to any of this really. Im simply stuck and
cant figure out why my drop targets arent working. my variables are
tracing directly before the drop target is evaluating.... its just
not returning that it is droped on the target.
the specific problem:
btn.onRelease = function(){
stopDrag();
target_ = _root["t_"+ a_num];
droper = _root["d_"+ a_num];
trace(droper + "//" + target_);
//////--------------------THE
PROBLEM--------------------///////
if (eval(droper._droptarget) == target_) {
trace("Success");
}else{
trace("failure")
here is the code in full:
//sets animation begin point variables
for(i = 0;i< 10; i++){
tx = i*125;
ty = i*125;
dx = 180;
dy = i*125;
//loading animations and non-xml text loads//
obs_box.top_.tex_1 = "Drag and Drop Exercise";
obs_box.stg_.slideTo(obs_box.stg_._x, -467.5, 1,
"easeOutQuad");
obs_box.top_.slideTo(obs_box.top_._x, -525, .75,
"easeInOutQuad", .25);
side_bg.slideTo(side_bg._x, 175, 1, "easeOutQuad");
//load xml//
var terms_xml = new XML();
terms_xml.ignoreWhite = true;
terms_xml.onLoad = function(success){
//end loading of data//
if (success){
var main_ob:Array = new Array();
var main_trgt:Array = new Array();
var term_:Array = new Array();
var titl_ = terms_xml.firstChild.firstChild.childNodes;
var term_ = terms_xml.firstChild.childNodes;
header_.title_text = titl_;
list_amount = term_.length -1;
for (var i=0; i < list_amount; i++){
main_ob
= term_.nextSibling.firstChild.childNodes;
main_trgt
= term_.nextSibling.firstChild.nextSibling.childNodes;
//attaches the drop target movie clip (t_1) and created text
fields//
amount = main_trgt.length;
for(x=0;x<amount;x++){
ypos = x*25;
_root.attachMovie("target_", "t_"+x,x,{_x:tx, _y:ypos});
//determines position of drop targets//
if(x>3){
ypos =135+130;
xpos = 662.5-(amount+125) * (x-4);
}else{
ypos = 135;
xpos = 662.5-(amount+125) * x;
//drop target positions are set now time to move them there
(**originating position of the drop targets are set throught
//tx & ty variables in the top of this document
var tgt = _root["t_"+x];
var ob_t =tgt.t_tex;
tgt.scaleTo(0, .001, "ease");
tgt.scaleTo(100, 1.75, "easeInOutBack", x/5);
tgt.slideTo(xpos,ypos,.75,"easeOutQuad",x/75);
tgt.alphaTo(50, 1, "easeOutQuad");
ob_t.text = main_trgt[x];
//attaches the movie clip that will be droped onto the target
(d_1) and created text fields//
amount = main_ob.length;
var ypos = new Array();
var btn:Array = new Array;
for(v = 0; v<amount;v++){
ypos[v] =300/amount*v+25;
_ypos = ypos.randomize();
for(j=0;j<amount;j++){
_root.attachMovie("drop", "d_"+j,j+ 8,{_x:90, _y:_ypos});
//determines position of object//
//object positions are set now time to move them there
(**originating position of the drop targets are set throught
//dx & dy variables in the top of this document
btn = _root["d_"+j];
var btn_t = btn.d_tex;
btn.scaleTo(0, .001, "ease");
btn.scaleTo(100, 1.75, "easeInOutBack", j/5);
btn.slideTo(83,250,.75,"easeOInutQuad",j/amount);
btn.slideTo(83,_ypos[j],.75,"easeInOutQuad",j/amount+1);
btn.alphaTo(95, 1, "easeOutQuad");
btn_t.text = main_ob[j];
//begin button actions when interacted with//
btn.onRollOver = function(){
ovr(this);
btn.onRollOut = function(){
ndr(this);
btn.onPress = function(){
drg(this);
btn.onRelease = function(){
var que:String = quest;
_que = new String(quest);
q_num = _que.substr(10,1);
var _par:String = this;
_par_str = new String(_par);
numer = _par_str.substr(10,1);
ans = _par;
var ans:String = ans;
_ans = new String(ans);
a_num = _ans.substr(10,1);
stopDrag();
target_ = _root["t_"+ a_num];
droper = _root["d_"+ a_num];
trace("----------------->>");
trace(droper + "//" + target_);
trace("<<--------------------");
if (eval(droper._droptarget) == target_) {
trace("Success");
}else{
trace("failure")
btn.releaseOutside = function(){
MovieClip.prototype.ovr = function(ob){
ob.alphaTo(75,1, "easeOutQuad");
ob.btn_cover.slideTo(btn_cover._x, -15, .75, "easeOutQuad");
ob.btn_cover.brightnessTo(50, .25, "easeInOutQuad",.25);
ob.btn_cover.brightnessTo(60, .25, "easeInOutQuad",1);
MovieClip.prototype.ndr = function(ob){
ob.alphaTo(100,1, "easeOutQuad");
ob.btn_cover.slideTo(btn_cover._x, -40, 1, "easeOutQuad");
ob.btn_cover.brightnessTo(0, 1, "easeInOutQuad",1);
MovieClip.prototype.drg = function(ob){
ob.startDrag(ob);
//final closer "}" below. Everything must reside above this
unless its a prototype(function)
//or the xml.load call//
//COMMITS THE XML LOAD FUNCTION ABOVE//
terms_xml.load("dnd.xml");
//Randomize the answers on the left//
Array.prototype.randomize = function() {
var i = this.length;
if (i == 0) return;
while (--i) {
var j = Math.floor(Math.random()*(i+1));
var tmp1 = this
var tmp2 = this[j];
this = tmp2;
this[j] = tmp1;
return this;
}this & droper both return the same object. i actually
have it back to this right now. the one i posted up was just
testing. ive run out of ideas so im testing the stupid things.
sooooo, anyone else got ideas on why it isnt reading when the
object is dropped? -
As title, i am a newbie to flash using ActionScript 2.0 , and currently i enounter the problem with drag and drop coding. Below is my code:
function dragSetup(clip, targ, position) {
clip.onPress = function() {
startDrag(this);
clip.x +=2;
clip.swapDepths(clip.x);
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
if (eval(this._droptarget) == targ) {
this.onTarget=true;
gotoAndStop(position);
} else {
this.onTarget=false;
gotoAndStop(position);
clip.myHomeX=clip._x;
clip.myHomeY=clip._y;
clip.onEnterFrame = function() {
if(this.onTarget)
this._x-=(this._x-this.myHomeX)/5;
this._y-=(this._y-this.myHomeY)/5;
function dragSetup2(clip, targ, correct) {
clip.onPress = function() {
startDrag(this);
clip.x +=2;
clip.swapDepths(clip.x);
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
if (eval(this._droptarget) == targ) {
clip._visible = false;
this.onTarget=false;
gotoAndStop(correct+1);
} else {
this.onTarget=false;
gotoAndStop(correct);
var frame:Number = 1;
dragSetup2(flexibleTxt, questionBox, frame);
dragSetup(transparentTxt, questionBox, frame);
dragSetup(blueTxt, questionBox, frame);
dragSetup(TIRTxt, questionBox, frame);
dragSetup(TRTxt, questionBox, frame);
dragSetup(ssmTxt, questionBox, frame);
dragSetup(siliconTxt, questionBox, frame);
dragSetup(silicaTxt, questionBox, frame);
dragSetup(silicateTxt, questionBox, frame);
dragSetup(infraTxt, questionBox, frame);
dragSetup(radioTxt, questionBox, frame);
dragSetup(lightTxt, questionBox, frame);
dragSetup(copperTxt, questionBox, frame);
dragSetup(gopTxt, questionBox, frame);
dragSetup(liquidTxt, questionBox, frame);
The scenario is , whenever correct mc was drag and drop on the target mc , it move to the next frame with new target mc(new question) , for example "questionBox2".
By applying the code above, everything work fine but i would like that whenever i "throw" the answer mc (flexibleTxt, blueTxt etc) , i want it to slide or glide for little more distance, jz like how u throw a card in real life on a smooth surface.
I also prefer that when draging it's "angle?" change according to the direction of draging. For example if u point ur finger on north side of a card and drag to the east, it's "angle?" will change according to the direction u drag, in this case, means east.
I know my description seem abit complicated but i really someone can undestand and help me solve this issue.
This is the link i reference to for the code above,but i modify it to my own preference :http://www.swinburne.edu.au/design/tutorials/P-flash/T-How-to-drag-and-drop-in-Flash/ID-37 /
PS : can i attach my fla file in this forum? if can, why i cant found any attach button?I am having a similar but reverse problem: Under 10.5.2, when trying to push or pull files from my wireless MacBook Pro via my Airport Extreme base station to or from my wired G5 Power PC, files hang in mid copy then stall.
The other way around -- working from the G5 -- I have no problem at all.
This started with 10.5, but I'm not sure if it was .1 or .2 because I upgraded from 10.4 just recently and did the combined 10.5 updates all at once on both machines.
Thanks -
Hey. A couple of weeks ago Kglad from the forums created some code for me for a drag and drop function. It works great. Unfortunatly im having to extend to more draggable objects. So they will be within another movie clip so i can have them scrolling. After making the scroll, the draggable objects dont register on the droptarget as they are within another movie clip. Below is i think the part of the code that needs to be changed so the draggable objects know where to find the drop target.
Hope that makes sense.
Could anybody help?
Thanks
this.stopDrag();
if(eval(this._droptarget)==droptargetMC){droptargetMC
probably needs to be changed. you could take a long-shot and try:
_parent.droptargetMC
but you'll probably need to see the code that defined droptargetMC and explain where it's defined relative to the location of the stopDrag() code. -
Drag & Drop Functionality Doesn't Work in External SWF?
Hi all,
I'm currently a TA for a Flash course at my school. We're using AS 2.0 and working with external SWFs.
I think this might be pretty simple to remedy. Well, at least I'm hoping!
A student is having trouble with drag & drop functionality when it is used in an external SWF. Basically, in our drag & drop section, we have a sheet of paper ("paper" MC) and an object we drag into it ("object" MC). When the object is released in the paper area, we go to frame 2 of "paper" MC, which consequently has an animation.
This works fine and dandy in said drag & drop section, but once the drag & drop section is loaded into our main SWF via a MC placeholder, the drag & drop functionality stops working.
Here is the URL to the drag & drop section by itself:
http://www.phayzed.com/flashkit/drag_for_animation.swf
and here is the URL to the main swf, which loads the drag & drop SWF into a movieclip and causes it to work incorrectly:
http://www.phayzed.com/flashkit/main.swf
Now here is the code on the draggable object ("object" MC):
on (press) {
startDrag (this, true);
on (release) {
stopDrag ();
if (this._droptarget == "/paper") {
_parent.paper.gotoAndStop(2);
_parent.object._visible=false;
If any more info is needed, I'm willing to upload both FLA files. Although, something tells me that this is a simple issue to resolve.
Thanks a lot for any help!!!
Cheers
Twith as2 you must convert that antiquated as1 code:
on (press) {
startDrag (this, true);
on (release) {
stopDrag ();
if (eval(this._droptarget) == _parent.paper) {
_parent.paper.gotoAndStop(2);
_parent.object._visible=false;
Maybe you are looking for
-
Firefox stops responding after everytime when launched.
Every time I launch Firefox, after a while it stops responding and it does not give me a crash report. I have tried re-installing it but no luck. I used the same add-ons for almost a year without any problems, and I have not recently downloaded anyth
-
Securing DSP calls via Web Services Mediator API
I have been implementing a client of DSP 3.0 services using the static Web Services Mediator API. I am successfully calling these through the AL Service Bus, where I have deployed the WSDL generated from the DSP. We are calling this from a rich clien
-
String Comparision ---please do help me
Hai all, I have a problem , 1. i have an ArrayList which contains a list of all properties in the app, and an HashMap which contains the name of the file as the key and the string representation of the file as the value. i need to search the key of t
-
Multiple album name for one mp3
is it possible to tag the one mp3 with multiple album names?eg.most artists have greatest hits albums with their studio albums so the itunes user has to choose which one to delete from the library thus causing one or the other album to be incomplete
-
I've built a simple website in iWeb08. My hope was to make the links Brown. While they looked that way in iWeb08 when published (to a folder or the web) they were black. I've since done a workaround and italicized all the text in the links and made t