As3 drag and drop

hi all
i have a problem with my drag and drop jigsaw
everything worked fine before i added the draggable content to a movieclip called pieces_mc which should goto the nextFrame after a target has been filled.
wondering if you can see what is wrong, i believe i need to point the movieclip to event.target but how to do this??
stop();
var startX:Number;
var startY:Number;
var counter:Number=0;
var tries:Number=0;
finished_mc.visible=false;
help_file_mc.visible=false;
pieces_mc.jig1_mc.buttonMode=true;
pieces_mc.jig2_mc.buttonMode=true;
pieces_mc.jig3_mc.buttonMode=true;
pieces_mc.jig4_mc.buttonMode=true;
pieces_mc.jig5_mc.buttonMode=true;
pieces_mc.jig6_mc.buttonMode=true;
pieces_mc.jig7_mc.buttonMode=true;
pieces_mc.jig8_mc.buttonMode=true;
pieces_mc.jig9_mc.buttonMode=true;
pieces_mc.jig10_mc.buttonMode=true;
pieces_mc.jig1_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
pieces_mc.jig1_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
pieces_mc.jig2_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
pieces_mc.jig2_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
pieces_mc.jig3_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
pieces_mc.jig3_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
pieces_mc.jig4_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
pieces_mc.jig4_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
pieces_mc.jig5_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
pieces_mc.jig5_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
pieces_mc.jig6_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
pieces_mc.jig6_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
pieces_mc.jig7_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
pieces_mc.jig7_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
pieces_mc.jig8_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
pieces_mc.jig8_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
pieces_mc.jig9_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
pieces_mc.jig9_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
pieces_mc.jig10_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
pieces_mc.jig10_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function pickUp(event:MouseEvent):void {
event.target.startDrag(true);
//reply_txt.text="";
event.target.parent.addChild(event.target);
startX=event.target.x;
startY=event.target.y;
function dropIt(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String="target"+event.target.name;
var myTarget:DisplayObject=getChildByName(myTargetName);
if (event.target.dropTarget!=null&&event.target.dropTarget.parent==myTarget) {
  event.target.play();
  pieces_mc.nextFrame();
  borders_mc.parent.setChildIndex(borders_mc, borders_mc.parent.numChildren-1);
  //reply_txt.text="Good Job!";
  event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
  event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
  event.target.buttonMode=false;
  event.target.x=myTarget.x;
  event.target.y=myTarget.y;
  counter++;
} else {
  //reply_txt.text="Try Again!";
  event.target.x=startX;
  event.target.y=startY;
  tries++;
if (tries>=15) {
  //tries_txt.text="fi";
if (counter==10) {
  borders_mc.visible=false;
  targetjig1_mc.visible=false;
  targetjig2_mc.visible=false;
  targetjig3_mc.visible=false;
  targetjig4_mc.visible=false;
  targetjig5_mc.visible=false;
  targetjig6_mc.visible=false;
  targetjig7_mc.visible=false;
  targetjig8_mc.visible=false;
  targetjig9_mc.visible=false;
  targetjig10_mc.visible=false;
  pieces_mc.jig1_mc.visible=false;
  pieces_mc.jig2_mc.visible=false;
  pieces_mc.jig3_mc.visible=false;
  pieces_mc.jig4_mc.visible=false;
  pieces_mc.jig5_mc.visible=false;
  pieces_mc.jig6_mc.visible=false;
  pieces_mc.jig7_mc.visible=false;
  pieces_mc.jig8_mc.visible=false;
  pieces_mc.jig9_mc.visible=false;
  pieces_mc.jig10_mc.visible=false;
  finished_mc.visible=true;
  //reply_txt.text="Congrats, you're finished!";
thanks in advance for any help
fonzio

hi kglad
well the problem is before i put all of the separate jigsaw pieces into a movieclip called pieces_mc everything was fine, but not now
i think i need to tell event.target where to find the pieces but i dont know how
you see i have the target clips in a movieclip on the stage and the pieces themselves inside another movieclip on stage
so i can no longer pick up a piece
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at gameone_fla::gameone_3/frame1()
at flash.display::MovieClip/gotoAndPlay()
at gameone_fla::MainTimeline/nextk()
I get this error but this has nothing to do with it as it worked fine before and i havent touched this
this just moves it to the next frame ie the jigsaw
intro_2.my_btn.addEventListener(MouseEvent.CLICK, nextk);
function nextk(event:MouseEvent):void {
  gotoAndPlay(2);
any ideas?
thanks
fonzio

Similar Messages

  • Help Converting AS2 to AS3 Drag and Drop Event

    Hi All,
    This is the second post on help for converting AS2 to AS3. This code is used in Captivate to allow a drag and drop action between two areas (User presses down, drags, and releases in a second area - They are not dragging any object). If anyone can help me convert this please let me know.
    Source for Drag and Drop: (Note: Single MovieClip)
    // pause the Captivate movie
    _root.rdcmndPause = 1;
    // when the user's mouse is let go check if there was a successful drop
    _root.onMouseUp = function(){
              // If the source area's center coordinate is nearby the destination area's center coordinate then advance the slide
              if ( Math.abs(_root.sourceX + _root.sourceWidth  / 2 + _root.sourceParentX - (_root.destX + _root.destWidth  / 2)) < (_root.destWidth  / 2) &&
                         Math.abs(_root.sourceY + _root.sourceHeight / 2 + _root.sourceParentY - (_root.destY + _root.destHeight / 2)) < (_root.destHeight / 2) )
                        _root.rdcmndNextSlide = 1;
              } else {
                        // show error movie clip for 2 seconds (60 frames at 30 frames per second)
                        _root.showErrorMessage = 60;
      mc.onEnterFrame = function(){
              // continuously update the source area's coordinates and size
              _root.sourceX = mc._x;
              _root.sourceY = mc._y;
              _root.sourceWidth = mc._width;
              _root.sourceHeight = mc._height;
              _root.sourceParentX = _parent._x;
              _root.sourceParentY = _parent._y;
    mc.onPress = function(){
              // Uncomment following line to have control click capabilities
              //if(key.isDown(Key.CONTROL))
              // when user clicks on the source area click start the drag
                        startDrag(this);
    mc.onRelease = function(){
              // stop drag when user releases the source area
              stopDrag();
    Source for Destination Area (Single MovieClip named destArea)
    // Set a root variable to control when the error message is displayed
    _root.showErrorMessage = -1;
    // Use setCoords variable so we only set the destination coordinates once
    var setCoords = 0;
    destArea.onEnterFrame = function(){
              if (setCoords == 0){
                        // set the destination x, y, width, and height
                        _root.destX = _parent._x;
                        _root.destY = _parent._y;
                        _root.destWidth = _parent._width;
                        _root.destHeight = _parent._height;
              // destination coordinates have been set, change setCoords so it doesn't get set again
              setCoords = 1;
    Code for the Error Message (Single MovieClip named errorMessage)
    // Don't display the error message initially
    errorMessage._alpha = 0;
    errorMessage.onEnterFrame = function (){
              // If the drag and drop method detects a missed drop
              // then show this error message by setting _alpha to 100
              if (_root.showErrorMessage > 0){
                        errorMessage._alpha = 100;
                        // decrementing this variable controls the time the
                        // error message will be displayed
                        _root.showErrorMessage--;
              } else {
                        // Don't display the error message
                        errorMessage._alpha = 0;

    use:
    MovieClip(parent.parent.parent).rdcmndPause=1;
    this.addEventListener(KeyboardEvent.KEY_DOWN,keydownF);
    function keydownF(e:KeyboardEvent):void{
    fscommand("KEYPRESSED", e.keyCode);
    if(e.keyCode==32){
    MovieClip(parent.parent.parent).rdcmndNextSlide=1;

  • AS3 drag and drop masked bitmaps - not working

    I have a drag and drop project using bitmaps that were masked using fireworks. All bitmaps are PNG (fireworks files) and one object is GIF. All objects were converted into movie clips.
    PROBLEM
    All movie clips from PNG's can be dragged, but they can't be dropped. However, the GIF movie clip responds to both drag and drop.
    ActionScript worked when all movie clips had GIF's.
    Is this problem because the objects were masked or for any other reason?
    Note: Objects were masked because their border is very fussy and cropping them doesn't help with the quality of their image.
    // ACTION SCRIPT
    var startX:Number;
    var startY:Number;
    var counter:Number = 0;
    name_mc1.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc1.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    name_mc2.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc2.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    name_mc3.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc3.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    name_mc4.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc4.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    name_mc5.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc5.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    name_mc6.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc6.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    name_mc7.addEventListener(MouseEvent.MOUSE_DOWN, placeUP);
    name_mc7.addEventListener(MouseEvent.MOUSE_UP, placeDown);
    function placeUP(event:MouseEvent):void {
    event.target.startDrag(true);
    mess_txt.text = "";
    event.target.parent.addChild(event.target);
    startX = event.target.x;
    startY = event.target.y;
    function placeDown(event:MouseEvent):void {
    event.target.stopDrag();
    var myTargetName:String = "target" + event.target.name;
    var myTarget:DisplayObject = getChildByName(myTargetName);
    if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
      mess_txt.text = "Good Job!";
      event.target.removeEventListener(MouseEvent.MOUSE_DOWN, placeUP);
      event.target.removeEventListener(MouseEvent.MOUSE_UP, placeDown);
      event.target.buttonMode = false;
      event.target.x = myTarget.x;
      event.target.y = myTarget.y;
      counter++;
    } else {
      mess_txt.text = "Try Again!";
      event.target.x = startX;
      event.target.y = startY;
    if(counter == 7){
            mess_txt.text = "Congratulations, you're finished!";
    name_mc1.buttonMode = true;
    name_mc2.buttonMode = true;
    name_mc3.buttonMode = true;
    name_mc4.buttonMode = true;
    name_mc5.buttonMode = true;
    name_mc6.buttonMode = true;
    name_mc7.buttonMode = true;
    Thanks for any help!
    German

    Kglad:
    Thanks. Your code worked as well.
    German

  • Create a drag and drop target set

    Hi,
    I want to be able to create the following if possible:
    Create five words that make up a sentence and they are mixed up in order. So basically I would turn each word into a Movie clip perhaps.
    I would then like to assign a target hotspot for each word so that a user can drag the words into the correct order.
    Once they are in the correct order they click a button to go to a correct response or incorrect response. Is this possible?

    Yes, it is possible.  Try seaching Google for a tutorial using terms like "AS3 drag and drop tutorial" and/or "AS3 dropTarget tutorial"

  • More info on using drag and drop in AS3?

    I have coded a basic drag and drop using a rope .jpg saved as an mc. the idea is to have the user drag the rope from left to right using the mouse down and up functions. I was able to do this but I'm trying to add to the functionality by doing the following:
    dragging limited to a certain amount per drag
    no dragging up or down just left to right
    set boundries within the screensize
    I've looked and could only find as2 and basic tutes on this
    here is what I have so far
    any help?
    ropeclip_mc.addEventListener(MouseEvent.MOUSE_DOWN, ropedrag);
    ropeclip_mc.addEventListener(MouseEvent.MOUSE_UP, ropedrop);
    function ropedrag(e:MouseEvent):void
         ropeclip_mc.startDrag();
    function ropedrop(e:MouseEvent):void
         ropeclip_mc.stopDrag();
    RD

    Hi,
    Along with your code add this code to specify the dragging limited.
    var sbound:Rectangle = new Rectangle(x,y,width,height);
    x  states x position of the drag object starts.
    y  states y position of the drag object starts.
    width states width of the drag object.
    height states height of the drag object
    ropeclip_mc.startDrag(true,sbound);
    Try this.
    Saransoft

  • Drag and Drop Bug (Flash, AS3)

    Hello! Help, please! I'm making a game that involves dragging and dropping books. (Right now there is only one book.) While testing my game, I discovered by accident that no matter where I drag on the screen, the draggable book responds, moving around on screen despite the cursor not being on top of it. Here is my code. (It also snaps a larger book mc to the small one for purposes I intend to use later.)
    // Making the small book dragable. //
    small_book.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_6);
    // when the mouse button is clicked...
    function fl_ClickToDrag_6(event:MouseEvent):void
        small_book.startDrag();
        big_book_mc.x = small_book.x;///
        big_book_mc.y = small_book.y;///-----> Makes the big book snap to the lil one when clicked.
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_6);
    // when the mouse button is released...;
    function fl_ReleaseToDrop_6(event:MouseEvent):void
        small_book.stopDrag();
        big_book_mc.x = small_book.x;///
        big_book_mc.y = small_book.y;///-----> Makes the big book snap to the lil one when the mouse button is released.
    stage.addEventListener(MouseEvent.MOUSE_DOWN, dragFn);
    // if the mouse is currently dragging....;
    function dragFn(event:MouseEvent):void
        small_book.startDrag();
        big_book_mc.x = small_book.x;///
        big_book_mc.y = small_book.y;///-----> The big book follows while the mouse is dragging.
    // the small book is now draggable and the big book snaps to it.

    your stage listeners should be added in the mousedown listener functions and then removed in the mouseup listener functions.
    and just to clarify, your small book starts dragging no matter where there is a mousedown?

  • Desktop drag and drop icon for my "other" computer

    i really need an icon for my MacBookPro desktop to reside on my Mac Pro desktop (and vice versa) so that I can just drag and drop copy (or move) data from one volume to another. sort of like what I have with my dropbox icon in the sense that I can just keep this on my desktop and in the View Pane of Finder and drag and drop items or open the volume etc.
    is this possible and i am just not getting it to work because i don't have things set to mount automatically or is there a restriction that does not allow this that I don't understand?
    i am on snow leopard and the connection is via wi, but I could plug in via ethernet when i know i will need to do this sort of moving of data a lot.
    thanks for clearing any of this up for me.
    - jon

    if as3, create a sprite or movieclip and use:
    image1.addEventListener(MouseEvent.MOUSE_DOWN,downF);
    image1.addEventListener(MouseEvent.MOUSE_UP,upF);
    function downF(e:MouseEvent):void{
    Sprite(e.currentTarget).startDrag();
    function upF(e:MouseEvent):void{
    Sprite(e.currentTarget).stopDrag();

  • 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
    Adrian

    To 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

  • Drag and drop file into Outlook from AIR application

    I am hoping to see if this would be possible with the Adobe AIR API. We currently have a desktop AIR application that clients install in order to facilitate certain operations triggered via a web application (such as opening files directly from the web).
    One of the actions we are requested to support is the ability to drag and drop files from our web application directly into Outlook and have the file added as an attachment. I saw the documentation at Adobe Flash Platform * Dropping file promises and was wondering if this might be a possibility, or if there was some other method of performing this.
    We are trying to get around the fact that users now have to download a document to their desktop before being able to attach in Outlook.
    Thanks for any assistance.

    You just aren't calling the right NativeDragManager functions. See http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7d83.html

  • Drag and Drop HELP!

    OK - Here's my problem. Just moving from AS2 to AS3 and
    trying to create a drag and drop template. I need to re-use a
    single drag selection multiple times, to multiple targets and then
    graded. For example, say I was building a car by dragging parts
    over to a car frame. I need to be able to drag a copy of a tire to
    the car frame 4 times in any random order. Drag 2 doors in any
    order, or drag one item like a hood... etc, then grade to make sure
    all are in the right place.
    I have succedded in dragging a specific Drag item to a
    specific Target and give feedback as it is dropped (either "wrong",
    "correct" or "Good Job, Completed"), but having a bear of a time
    trying to figure out how to use one Drag item for multiple Targets.
    Anybody have a sample template FLA of the same concept that I
    can build from?
    Many, Many, Thanks!

    What I am trying to do is to be able to use one of each of
    the images on the left multiple times, and put them in the correct
    position on the diagram in any order and then checked after student
    drops the item on a target. (sample sent to email)
    I have 1 for 1 working (working targets have green
    highlight), but can’t figure out how for instance, drag 2
    barrels in any order, 6 red squares over in any order and 2 orange
    circles over in any random order. I am stuck on 1 drag item for one
    specific target only.
    I would like the selections to remain to the left and copies
    of them created and dragged to the targets. (currently they are
    removed from the left when dragged)

  • Drag and Drop disappear issue

    Hello, I'm making a game in which I have some drag and drop items that they can be multiplied as many as you want. This items have to stay in the scene and I also have a bin in the menu where If you drag them they have to disappear.The problem is that I tried with multiple coordinates and they disappear also in the scene in the moment that I'm dragging them out of the menu. So, my question is:What could be wrong? Is the issue in the code?
    Thank you for taking the time to help me. It's my first game in AS3 so I'm not so familiar with the codes.
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    DDB1.addEventListener(MouseEvent.MOUSE_DOWN, createDDB1);
    var _DDB1:Sprite;
    function createDDB1(evt:MouseEvent){
      _DDB1 = new DDB1MC();
      _DDB1.x = evt.stageX;
      _DDB1.y = evt.stageY;
      _DDB1.rotation = evt.currentTarget.rotation;
      _DDB1.transform.colorTransform = evt.currentTarget.transform.colorTransform
      addChild(_DDB1);
      _DDB1.startDrag(false);
      _DDB1.addEventListener(MouseEvent.MOUSE_DOWN, dragDDB1);
      stage.addEventListener(MouseEvent.MOUSE_UP, dropDDB1);
    function dragDDB1(evt:MouseEvent){
      evt.stopPropagation();
      _DDB1 = evt.currentTarget as Sprite;
      _DDB1.startDrag(false);
      stage.addEventListener(MouseEvent.MOUSE_UP, dropDDB1);
    function dropDDB1(e:MouseEvent):void {
      _DDB1.stopDrag();
      stage.removeEventListener(MouseEvent.MOUSE_UP,dropDDB1);
      if (_DDB1.x>700 || _DDB1.x < 755 || _DDB1.y < 240 || _DDB1.y > 155) {
      _DDB1.removeEventListener(MouseEvent.MOUSE_DOWN, dragDDB1);
      _DDB1.parent.removeChild(_DDB1);
      _DDB1 = null;

    Chances are that the problem lies in the following line:
      if (_DDB1.x>700 || _DDB1.x < 755 || _DDB1.y < 240 || _DDB1.y > 155) {
    That line essentially says if(the object is anywhere) due to using the OR ( || ) operator.  If any one of those things is true then the condition is satisfied, which becxause they overlap will always be true for at least two of them.  If that is supposed to be restricting the object to within an area you likely want to all of those conditions to be satsified.  So in that case you need to use the AND operator ( && ).

  • Zoom, drag and drop in a movie clip

    if zoom a movie clip...i want drag and drop the mc...and also don't go the mc outside the screen..pls help me...:(

    To drag within a limited area you use the startDrag() method, defining a rectangle to limit how far the object can be moved in any direction.  The startDrag is normally executed when a MOUSE_DOWN event occurs for the object that is to be dragged.  A MOUSE_UP event is what is used to trigger a call to the stopDRag() method, whereby the listener for that is usually assigned to the stage.
    Search Google for a tutorial using terms like "AS3 drag drop tutorial" if you need detailed coding help to get started.

  • Issues with Drag and Drop to Folder

    I know how to pack and unpack folders.  But how does one add regions to an existing folder.  As the help manual states, that this is done by dragging existing regions into the folder region at the top level of the Arrange hierarchy, and that if the folder does not contain a track that uses the same channel strip as the source region, then LOGIC CREATES ONE.  However, it does in my case. It often overlaps some regions on an existing track.
    For example, say in my main arrangement I have a folder track on track 1, a MIDI track on track 2, and an audio track on 3, and my folder contains a MIDI track on 1 and an audio track on 2. If I drag a MIDI region from my arrangement (track 2) into the folder, it appears on track 2 in the folder even though this is an audio track. If I drag an audio region from track 3 into the folder, it appears on a newly created track with no output and I have to manually reassign it.   Is this a bug or is there something I am doing wrong or a setting I need to alter to make Logic create a new folder channel when a new region is added if an appropriate one does not already exist?
    The workaround I have come up with is very cumbersome:
    -Create a screenset with 2 arrange pages and an audio environment layer.
    -Link the audio environment layer to the arrange with the track you want to move. Select that track on the 1st arrange page. Deselect the link on the environment.
    -navigate to the inside of the folder you want to move the region to in the other arrange page. Create an empty track in that folder, then use the Midi Thru tool on the Audio Environment layer to select the highlighted track from step one.
    -Now that the folder has the correct track for your region, either carefully drag and drop it from one arrange page to the other or cut and paste at original position after selecting the new track. (If one just drags the region onto the folder it will be placed haphazardly on a random track, not the correct audio instrument track just created and will need to moved immediately.)
    -I tried using the track mixer for creating an instrument in the folder (Rt click create/select arrange track) instead of the using the environment midi through tool and it will only create the track on the arrangement if you are viewing ALL tracks, but since I am using multi-channel AU instruments, like Vienna and Kontakt, that obviously wont work.
    Overall this seems to be a cumbersome process to perform a very simple task (move regions from the arrange page to an existing folder). Is there a simpler way to do this?

    You just aren't calling the right NativeDragManager functions. See http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7d83.html

  • AS2 Drag and Drop Interaction help

    I am trying to create a reusable template for a drag and drop interaction.
    There are 7 drag objects, 7 targets.
    Based on a scenario we develop (which of the 7 services [drag objects] are the best solution, for example), I would like to create interactions where some of the drag drop combinations are correct answers and dragging/dropping other combinations would result in an "incorrect" answer.
    I am having issues with designating the correct and incorrect responses in the AS code, as well as how to provide the positive (correct answers) and negative (incorrect answers) feedback after a submit button is selected.
    Additionaly, I have a reset button that does not function the way I expected - move the drag objects back to the start position and allow the user to resubmit an answer.
    I am using Flash CS5, but need to use AS2 as the swf file is going to be inserted into an Articulate Presenter project (Articulate does not support AS3 yet).
    Thank you for any assistance or suggestions!
    Source file: https://www.dropbox.com/home/AS2%20D&D#:::68035214
    Current AS2 code:
    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(drag1,drop1);
    dragSetup(drag2,drop2);
    dragSetup(drag3,drop3);
    dragSetup(drag4,drop4);
    dragSetup(drag5,drop5);
    dragSetup(drag6,drop6);
    dragSetup(drag7,drop7);
    //this code controls the reset button function and returns all of the drag objects to the start position.
    resetBtn.onRelease = function (){
    drag1.onTarget=false;
    drag1._x = drag1.myHomeX;
    drag1._y = drag1.myHomeY;
    drag2.onTarget=false;
    drag2._x = drag2.myHomeX;
    drag2._y = drag2.myHomeY;
    drag3.onTarget=false;
    drag3._x = drag3.myHomeX;
    drag3._y = drag3.myHomeY;
    drag4.onTarget=false;
    drag4._x = drag4.myHomeX;
    drag4._y = drag4.myHomeY;
    drag5.onTarget=false;
    drag5._x = drag5.myHomeX;
    drag5._y = drag5.myHomeY;
    drag6.onTarget=false;
    drag6._x = drag6.myHomeX;
    drag6._y = drag6.myHomeY;
    drag7.onTarget=false;
    drag7._x = drag7.myHomeX;
    drag7._y = drag7.myHomeY;
    //This code controls the submitBtn and feedback for a correct and incorrect answer
    var groupID:Array = [0,0];
    var incorrectFeedback:String = "That isn't correct.";
    var correctFeedback:String = "Excellent good work.";
    var answerGroup:Array =  [
                                                                 [drag1,drop1],
                                                                 [drag2,drop2],
                                                                 [drag3,drop3],
                                                                 [drag4,drop4],
                                                                 [drag5,drop5],
                                                                 [drag6,drop6],
                                                                 [drag7,drop7]];
    //Enable all the stage items
    resetBtn.onRelease = function()
              resetAll();
    submitBtn.onRelease = function()
              if(evaluateAnswers())
                        feedbackTxt.text = correctFeedback;
              else
                        feedbackTxt.text = incorrectFeedback;

    Here is an alternate link to the source / .fla file  - orig link was not to my public dropbox!
    https://www.dropbox.com/home#:::68035214
    or
    https://skydrive.live.com/?cid=bb539b6eff0afbf5&sc=documents&id=BB539B6EFF0AFBF5%21124#

  • Drag and Drop | Text | Submit | PLEASE HELP

    Hi. I really need help.  THANK YOU in advance.
    I am building a voting contact from in flash profession with AS3. The functionality will allow users to drag and drop choices OR add their own allow them to submit their TOP 5 choices.
    PROBLEM:
    1. Drag and drop text is not submitted when it is dragged into the editable text field.
    HOW CAN I DO THIS TO ALLOW FOR DRAG AND DROPPED ITEMS TO BE SUBMITTED or TEXT THAT IS MANUALLY ENTERED.
    This can be seen HERE: http://pttdt.com/winnipegcafes.php
    AS3 Code used thus far:
    /* Drag and Drop
    Makes the specified symbol instance moveable with drag and drop.
    choice_1.buttonMode = true;
    choice_1.mouseChildren = false;
    choice_1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    function fl_ClickToDrag(event:MouseEvent):void
                choice_1.startDrag();
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    function fl_ReleaseToDrop(event:MouseEvent):void
                choice_1.stopDrag();
    /* Drag and Drop
    Makes the specified symbol instance moveable with drag and drop.
    choice_2.buttonMode = true;
    choice_2.mouseChildren = false;
    choice_2.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_2);
    function fl_ClickToDrag_2(event:MouseEvent):void
                choice_2.startDrag();
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_2);
    function fl_ReleaseToDrop_2(event:MouseEvent):void
                choice_2.stopDrag();
    /* Drag and Drop
    Makes the specified symbol instance moveable with drag and drop.
    choice_3.buttonMode = true;
    choice_3.mouseChildren = false;
    choice_3.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_3);
    function fl_ClickToDrag_3(event:MouseEvent):void
                choice_3.startDrag();
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_3);
    function fl_ReleaseToDrop_3(event:MouseEvent):void
                choice_3.stopDrag();
    /* Drag and Drop
    Makes the specified symbol instance moveable with drag and drop.
    choice_4.buttonMode = true;
    choice_4.mouseChildren = false;
    choice_4.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_4);
    function fl_ClickToDrag_4(event:MouseEvent):void
                choice_4.startDrag();
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_4);
    function fl_ReleaseToDrop_4(event:MouseEvent):void
                choice_4.stopDrag();
    /* Drag and Drop
    Makes the specified symbol instance moveable with drag and drop.
    choice_5.buttonMode = true;
    choice_5.mouseChildren = false;
    choice_5.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_5);
    function fl_ClickToDrag_5(event:MouseEvent):void
                choice_5.startDrag();
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_5);
    function fl_ReleaseToDrop_5(event:MouseEvent):void
                choice_5.stopDrag();
    /* Mouse Click Event
    Clicking on the specified symbol instance executes a function in which you can add your own custom code.
    Instructions:
    1. Add your custom code on a new line after the line that says "// Start your custom code" below.
    The code will execute when the symbol instance is clicked.
    send_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
    function fl_MouseClickHandler(event:MouseEvent):void
                // Start your custom code
                // This example code displays the words "Mouse clicked" in the Output panel.
                trace(box_1.text);
                trace(box_2.text);
                trace(box_3.text);
                trace(box_4.text);
                trace(box_5.text);
                trace(theName.text);
                trace(theEmail.text);
                // End your custom code
    PLEASE HELP

    It can be fairly involved once you realize how many aspects need to be dealt with.  You'll need to find a tutorial that teaches you how to use drag and drop involving targets so that when you drop something you check if it hit a valid target (textfield in your case) and then process your text into that target.  You should try searching Google using terms like "AS3 drag drop tutorial" and "AS3 dropTarget tutorial"   Here's a link from the latter of the two that has links to tutorials that might help.
    http://forums.adobe.com/post!reply.jspa?message=3462293

Maybe you are looking for