Skip to main content
Inspiring
September 1, 2011
Answered

a movie clip doesn't appear when I add it in a certain block of code

  • September 1, 2011
  • 1 reply
  • 822 views

Hi.

I want a movieclip to appear in a drag and drop game. When you successfully drag the right object and drop it then an animation is called from the library.

The animation doesn't appear. However, when I use the same code at the beginning of my programme it does appear so it's not that part of the code that is the problem. Also, a trace statement does trace so it is running the code. WHY doesn't it appear?

private function mouseUpCheckDrag(e:MouseEvent):void
        {
            e.currentTarget.stopDrag();
            if (this.currentBubble.hitTestObject(this.dragTarget))
            {
                if (currentBubble && currentBubble == e.currentTarget)
                {
                   pointBurst.x = 300;
                    pointBurst.y = 300;
                    addChild(pointBurst);

                    trace("POINTBURST");
                   
                    currentBubble.visible = false;
                    removeChild(currentBubble);

This topic has been closed for replies.
Correct answer Ned Murphy

Based on the name of the object, one thing to consider is time.  If your PointBurst object happens to be self-animating, it is not waiting for you to add it to the stage to do that.  It will animate as soon as it is instantiated, so if it should end somehow invisibly, that's what you'll see, nothing.

1 reply

Ned Murphy
Legend
September 1, 2011

That code does not show instantiating the pointBurst object from the library (as in var pointBurst:... = new .....)

Inspiring
September 1, 2011

private var pointBurst:PointBurst = new PointBurst;

I had that code at the top already but I didn't want to include the whole code.

As I say it does work when I try it at the beginning function but not when it's in the other code therefore it is a problem of that drag code. I also tried it on a click button and it didn't work.