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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:25:28+00:00 2026-06-16T11:25:28+00:00

I have a string variable that identifies the current level, this is placed in

  • 0

I have a string variable that identifies the current level, this is placed in the timeline when it reaches this level.

var currentLevel:String = "level1";

I have a dispatch event that is called when end of the level has been reached.

dispatchEvent(new Event("levelend", true));

I have put this into document class:

function proceedLevel(event:Event):void
    {
        removeEventListener("levelend", proceedLevel);
        SoundMixer.stopAll();
        removeChild(currentLevel);
        gotoAndStop(nextScene);
    }

Each level is called like this:

var level1:Level1 = new Level1();
level1.x = 0;
level1.y = 0;
addChild(level1);

Each level is in its own Movieclip but when it reaches the end of the timeline in that movieclip it dispatches the event “levelEnd”. the document class listens and then attempts to remove the instance calling removeChild. I add the string currentLevel and place it into removeChild to hopefully try and get rid of it from the document class.

I get this error:

implicit coercion of a value of type to an unrelated type flash display    displayobject

I know it is not happy about the string being passed into the removeChild!

Thanks

  • 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-16T11:25:29+00:00Added an answer on June 16, 2026 at 11:25 am

    You can add another variable var currentLevelView:DisplayObject set it after creating level display object and use it in removeChild or you can set the level1.name = currentLevel and change removeChild to removeChild(getChildByName(currentLevel))

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

Sidebar

Related Questions

I have javascript string variable with var sttr=We prefer questions that can be answered
I have a variable that has this string: <DIV><SPAN style=FONT-FAMILY: Tahoma; FONT-SIZE: 10pt>[If the
I have a query string that contains a variable like this $field_name = 'features';
I have a string that contains ?action=a&current=b&something=c i want to create a variable that
I have a large string in a variable that includes a whole bunch of
I have a variable that contains the following JSON string: { 0 : Jun
I have created a servlet that passes a string variable strname to a JSP
I have code that generates a List<string[]> variable but can't quite figure out how
I have a String variable that is binded to a WebSphere Portal (via admin
I have a string variable such as this: string title = string.empty; I have

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.