Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3791102
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:25:06+00:00 2026-05-19T12:25:06+00:00

I have aa question re:AS 3. I made a Post-It note movie clip that

  • 0

I have aa question re:AS 3. I made a Post-It note movie clip that is draggable. I want to create a whole pad of notes, or at least simulate this. I thought the best way to do this would be to add another Post-It whenever the startDrag() is triggered.

I first tried creating the Post-It with symbols but didn’t think I could dynamically create new ones this way. I then created a class and added it to the stage:

…
addChild(new PostItNote());

But I wasn’t able to (or don’t know how) to set the x, y position on the stage.

Anyone have suggestions on the best way to accomplish this or even another way altogether?

EDIT:

package  {

 import flash.display.MovieClip;
 import flash.display.Sprite;
 import flash.events.MouseEvent;
 import flash.events.Event;
 import flash.text.TextField;
 import flash.media.Sound;
 import flash.media.SoundChannel;
 import flash.text.TextFormat;

 public class CoinHitTest extends MovieClip {

  var count:Number = 0;
  var total_count:TextField;
  var hitting:Boolean = false;
  var coinSnd:Sound = new coin_drop();
  var myMoney:TextFormat = new TextFormat();
  var noteStack:Vector.<PostItNotes> = new Vector.<PostItNotes>();

public function CoinHitTest(){
    for(var $i:int = 0; $i <5;$i++)
{
    var newPostIt:PostItNotes = new PostItNotes();
    this.addChild(newPostIt);
    this.noteStack.push(newPostIt);
}
// constructor code
   coin.addEventListener(MouseEvent.MOUSE_DOWN, __handleCoinDown);
   coin.addEventListener(MouseEvent.MOUSE_UP, __handleCoinUp);

   total_count = new TextField();
   total_count.x = 795.20;
   total_count.y = 506.15;
   total_count.mouseEnabled = false;

   myMoney.size = 28;
   total_count.defaultTextFormat = myMoney;
   total_count.text = String("$" + count);
   addChild(total_count);
  }

  private function __handleCoinDown($evt:MouseEvent):void {

   coin.startDrag(true);
     coin.scaleX = 1.5;
     coin.scaleY = 1.5;
   addEventListener(Event.ENTER_FRAME, __checkHit);
  }

  private function __handleCoinUp($evt:MouseEvent):void {
   coin.stopDrag();
     coin.scaleX = 1;
     coin.scaleY = 1;
   removeEventListener(Event.ENTER_FRAME, __checkHit);
  }

  private function __checkHit($evt:Event):void {
    if (this.coffee.hitTestPoint(coin.x,coin.y, false)) 
    { 
        // do our in-circle check
        if((coffee.x - coin.x) * 2 + (coffee.y - coin.y) * 2 <= (coffee.width/2 + coin.width/2) * 2)
        {
            stopDrag();
            coin.scaleX = 1;
     coin.scaleY = 1;
            removeChild(coin);
            coin.x = 116;
     coin.y = 380.1;
      addChild(coin);

        }
    }
    else
    {
        trace("Didn't Hit Mug");
    } 
   if (this.coin.hitTestObject(target)) {
     if (!hitting) {
         coinSnd.play();
     count++;
       total_count.text = String("$" + count);
       coin.stopDrag();

     removeChild(coin);
     hitting = !hitting;

     coin.x = 116;
     coin.y = 380.1;
      addChild(coin);
     coin.scaleX = 1;
     coin.scaleY = 1;

}
   } else {
    hitting = false;
   }
  }  

   }
}

EDIT:

package  {
    import flash.display.MovieClip;
public class PostItNotes extends Sprite{

        public function PostItNotes() {
            // constructor code
        }

    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:25:06+00:00Added an answer on May 19, 2026 at 12:25 pm

    The Problem ist that you set PostItNotes as the BaseClass instead of the Class itself.

    That means what you add to the stage is a Class that has only the logic and not the graphic elements.

    What you need to do is go back to the symbol in the library -> right click -> properties and change the BaseClass to flash.display.MovieClip (or in your case flash.display.Sprite if you don’t need the Timeline) and set PostItNotes as the Class.

    EDIT:

    package  {
    
        import flash.display.Sprite;
        import flash.events.MouseEvent;
    
        public class PostItNotes extends Sprite {
    
            public function PostItNotes() {
                super();
    
                addEventListener(MouseEvent.MOUSE_DOWN, onStartDrag);
            }
    
            protected function onStartDrag (event:MouseEvent):void {
    
                stage.addEventListener(MouseEvent.MOUSE_UP, onStopDrag);
                startDrag(false);
    
            }
    
            protected function onStopDrag (event:MouseEvent):void {
    
                stage.removeEventListener(MouseEvent.MOUSE_UP, onStopDrag);
                stopDrag();
    
            }
        }
    }
    

    I added the drag action to your PostItNotes class because I think this is where it belongs to as the drag really only concerns the post-it itself.

    You probably have to remove the drag code where you had it before.

    Do you need help on the creation of the new PostIt too?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my question is that I have made multimap.Here is the partial code. if(binary_search(final.begin() ,
I am learning C++ and I have a question. I made a class in
I made a similar question a few days ago, but now I have new
More of a design/conceptual question. At work the decision was made to have our
I have Question and QuestionTypes. In Question table there is a foreign key that
This is my first post, so please be nice :) I have a question
This question has some relation to this post I made recently: Drag a UIView
I have a question similar to this one , only that my question is
I recently made a question based on doing a HTTP request with POST data
Note: I have edited the original question based on comments and answers. My question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.