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 6589861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:13:42+00:00 2026-05-25T17:13:42+00:00

I have a class that I use to display text on stage, with some

  • 0

I have a class that I use to display text on stage, with some number effects. It works pretty well, but when I chain it like this

    public function onAdd(e:Event) {
        //stuff
        addChild(new messager("Welcome."));
        addChild(new messager("WASD to move, mouse to shoot."));
        addChild(new messager("Kill zombies for XP and collect ammo boxes.",waveOne));
    }
    public function waveOne(){
        addChild(new messager("Good luck and have fun.",newWave));
    }

The text (Good luck and have fun) is not displayed, but newWave is called. The reason why I don’t call waveOne in onAdd is so that it doesn’t happen too quick – my class just throws the text at the user once every 50 frames (which is intended, for later when you kill enemies and the text needs to catch up).

Here is my class (with the effects removed):

package  {

import flash.display.MovieClip;
import flash.events.*;
import flash.utils.Timer;

public class Messager extends MovieClip{
    var actualText:String;
    var callback:Function;
    var upTo:int = 0;
    static var waitingFor:int = 0;
    public function Messager(text:String,callback:Function=null) {
        this.callback = callback;
        actualText = text;
        x = 320 - actualText.length * 6.5;
        y = 0 - waitingFor * 60;
        addEventListener(Event.ENTER_FRAME, onEnterFrame);
        waitingFor++;
    }
    public function onEnterFrame(e:Event) {
        y+= 1;
        if(y > 60){
            waitingFor--;
        }
        if(y > 200){
            alpha -= 0.03;
            if(alpha <= 0){
                if(callback != null){
                    callback();
                }
                removeEventListener(Event.ENTER_FRAME, onEntFrm);
                this.parent.removeChild(this);
            }
        }
    }
}

It is set to linkage with a movieclip that has a textfield.

Thanks for any help.

  • 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-25T17:13:42+00:00Added an answer on May 25, 2026 at 5:13 pm

    y = 0 - waitingFor * 60; Maybe y of the last Mesager is a big negative number? Have you tried to trace waitingFor?

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

Sidebar

Related Questions

I have panel that I have customized. I use it to display text. But
I have a class that I would like to use in a scala.collection.mutable.PriorityQueue, but
I have written a class in python that implements __str__(self) but when I use
I have a class that I want to use to store properties for another
I have a C# singleton class that multiple classes use. Is access through Instance
I have a template class where I want to use objects of that class
I have an Obj-C 2.0 class that has an NSMutableArray property. If I use
I have following code snippet that i use to compile class at the run
I have several categories that I use in my Grails plugin. e.g., class Foo
I have the following use case: There's a class called Template and with that

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.