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

  • Home
  • SEARCH
  • 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 8893643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:17:49+00:00 2026-06-14T23:17:49+00:00

I’m having a problem by using classes. I used this tutorial online: http://www.youtube.com/watch?v=ALqGYMsRWxw My

  • 0

I’m having a problem by using classes. I used this tutorial online:
http://www.youtube.com/watch?v=ALqGYMsRWxw

My problem is in this tutorial he is using objects on the stage. What I want to do is add the object from out of code and use this exact same code. So that the stage is empty and when you run the project it will add the objects which you can drag.

Game.as (this is where import my class)

package
{
    import flash.display.MovieClip;

    import classes.tools.Tools;
    import classes.tools.ToolType1;

    public class Game extends MovieClip
    {       
        var tool1:classes.tools.ToolType1 = new classes.tools.ToolType1();

        public function Game()
        {           
            addChild(tool1);

        }
    }
}

Tools (this is what is called DraggableShirt in the tutorial)

package classes.tools
{
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.geom.Point;

    public class Tools extends MovieClip
    {           
        var originalPosition:Point;

        public function Tools()
        {           
            originalPosition = new Point(x,y);
            buttonMode = true;
            parent.addChild(this);

            this.addEventListener(MouseEvent.MOUSE_DOWN, drag);

        }
        // als je de muis indrukt dan pak je een voorwerp op
        function drag(evnt:MouseEvent):void
        {       
            stage.addEventListener(MouseEvent.MOUSE_UP, drop);
            this.startDrag();
            //scaling
            this.scaleY = 1.5;
            this.scaleX = 1.5;
        }
        // als je de muis loslaat laat je het voorwerp los
        function drop(e:MouseEvent):void
        {
            //positioning van de tools
            //Delete knop

            //bewerk knop
            stage.removeEventListener(MouseEvent.MOUSE_UP, drop);
            stopDrag()  

            if(dropTarget)
            {
                if(dropTarget.parent.name == "trash")
                {

                }
                else
                {
                    returnToOriginalPosition();
                }
            }
            else
            {
                returnToOriginalPosition();
            }           
        }
        function returnToOriginalPosition():void
        {
            x = originalPosition.x;
            y = originalPosition.y;
            this.scaleX = 1;
            this.scaleY = 1;
        }
    }
}

ToolType1 (this is what is called WhiteShirt/BlackShirt in the tutorial)

package classes.tools
{
    public class ToolType1 extends Tools
    {   
    }
}
  • 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-06-14T23:17:50+00:00Added an answer on June 14, 2026 at 11:17 pm

    After having a quick look at video 1 of 3, i’d say you already get that.
    He just places his stuff on the stage for easy testing/showing.

    What your looking for is code along the lines of;

    var WhiteShirt:Class = getDefinitionByName('WhiteShirt') as Class;
    var myShirt:WhiteShirt = new WhiteShirt();
    myShirt.x = 100;
    myShirt.y = 200;
    addChild(myShirt);
    

    Im not sure if you will need the first line, its something i used a while ago when i was using Classes with strings i sent back and forth between swfs, try see if it works without, else just keep it. (note that this code should go in the fla file, or even better a ‘Main.as’ file attached to the fla file)

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

Sidebar

Related Questions

I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the

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.