Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Flash CS5, AS3, Stop Drag, Add Up Release for a separate function

New Here ,
May 06, 2015 May 06, 2015

Using AS3 in Flash CS5, I have a movie clip where I've placed start drag and stop drag actions, and I'd like to activate a button action (run a movie clip named person_mo) with the ReleaseToDrop function. However, I do not know how to add the right code snippet or code it correctly. Here is the AS I have for the drag: 

    stop(); 

    /* Drag and Drop Makes the specified symbol instance moveable with drag and drop. */ 

   

    SCOPE2.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag); 

   

    function fl_ClickToDrag(event:MouseEvent):void

    {    

   

    SCOPE2.startDrag();

   

   

    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop); 

   

    function fl_ReleaseToDrop(event:MouseEvent):void

    {    

    SCOPE2.stopDrag();

    }

How can I play the person_mo movie clip and stop the drag?

TOPICS
ActionScript
979
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 06, 2015 May 06, 2015

Start with the following change and then explain more if it does not work.

    function fl_ReleaseToDrop(event:MouseEvent):void

    {    

    SCOPE2.stopDrag();

     person_mo.play();

    }

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 06, 2015 May 06, 2015

I recall trying the stopDrag function, but it caused the movie to flash back and forth from the first frame to the last frame. I have a three-frame movie with movie clips, the main one has 11 frames with frame-by-frame animation and stops in frames 1 and 11. Frames 1 and 3 in the main timeline also have stops.

Here is the fist frame and actions:

Frame1_Play.png Frame1_actions.png

Frame 2 SCOPE and person_mo clips (each stick figure is the person_mo with a button in the first frame and stops actions in frames 1 and 11):

Frame2_SCOPE2.png Frame2_person_mo.png

Person_mo clip with button:

Frame2_person_mo_clip.png Frame2_person_mo_btn.png

Frame 2 actions:

Frame2_actions.png

I appreciate the help. fs ...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 06, 2015 May 06, 2015

What did you try when it flashed the frames?  That is usually an indication of a coding error.

It is difficult to tell what you are doing even with all the pictures you show.   Based on the last two you show, it looks like you have the animation planted inside the UP frame of a button symbol.  If you do that then there is no way to control that symbol because a button symbol cannot have any other properties than it is assigned by Flash.  You should remove it from the button symbol and just use the movieclip itself if you want to drag it around.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 06, 2015 May 06, 2015

The scope is what is dragged. It shows the stick guy (person_mo movie

clip), and the intent is to have the movie clip play once the mouse is

released. Thus, the stick guy loses his head. It's a shoot the stick guys

game with a timer bar counting down ten seconds. At that instance, where

the player can drag and drop (or release) the scope, the clip should play

every time. However, after inserting

function fl_ReleaseToDrop(event:MouseEvent):void

{

SCOPE2.stopDrag();

person_mo.play();

}

following:

stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);

it began flashing. I've attached the FLA and SWF. The FLA would not upload,

so I used Google drive to insert it.. I appreciate you helping.

fs ...

​

GameAS3.fla

<https://docs.google.com/a/nisd.net/file/d/0B-rH1XLAyumhSF9mZ1ZadW1haW8/edit?usp=drive_web>

​

Fernando Serna

Newspaper Adviser, Adobe Certified Associate

Photojournalism, Flash Animation

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 13, 2015 May 13, 2015

Ned,

Any luck in helping me figure this out?

fs ...

Fernando Serna

Newspaper Adviser, Adobe Certified Associate

Photojournalism, Flash Animation

On Wed, May 6, 2015 at 3:40 PM, Fernando Serna <fernando.serna@nisd.net>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 13, 2015 May 13, 2015

I took a quick look at your file and I can see right off the bat where the problem is because there is a compiler error right off the bat.  As I indicated in my previous response, when you get flashing like you said you get it usually means there is a coding error, and the coding error shows up in the Compiler Errors panel.  It is indicating that line 19 in frame 2 has a problem... it is unable to find anything named person_mo.  That is because there is nothing in frame 2 that you have assigned an instance name of person_mo. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 13, 2015 May 13, 2015

Thanks. I'm going to place several instances (and name them person_mo1,

person_m2 ...) of person_mo, and try to code it so the movie clip begins to

play. I may be back in touch.

Really appreciate the help.

fs ...

Fernando Serna

Newspaper Adviser, Adobe Certified Associate

Photojournalism, Flash Animation

On Wed, May 13, 2015 at 12:02 PM, Ned Murphy <forums_noreply@adobe.com>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 13, 2015 May 13, 2015

I tried it with just one and saw its head pop when I scoped it, so you should be alright as long as you manage it properly.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 13, 2015 May 13, 2015

Send me the code, please, just to make sure I code it correctly. Umm, one

other thing. I'd like to be able to click on the PlayAgain button and

return the animation to the first frame to begin the game once more. Do I

do the same thing as with the person_mo?

fs ...

Fernando Serna

Newspaper Adviser, Adobe Certified Associate

Photojournalism, Flash Animation

On Wed, May 13, 2015 at 1:50 PM, Ned Murphy <forums_noreply@adobe.com>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 13, 2015 May 13, 2015
LATEST

I did nothing to the code.  I just named one of the instances "person_mo"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 06, 2015 May 06, 2015

The scope is what is dragged. It shows the stick guy (person_mo movie clip), and the intent is to have the movie clip play once the mouse is released. Thus, the stick guy loses his head. It's a shoot the stick guys game with a timer bar counting down ten seconds. At that instance, where the player can drag and drop (or release) the scope, the clip should play every time. However, after inserting

function fl_ReleaseToDrop(event:MouseEvent):void

    {   

    SCOPE2.stopDrag();

     person_mo.play();

    }

following:

stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);


it began flashing.



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines