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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:27:54+00:00 2026-05-28T21:27:54+00:00

having some trouble with hitTestObject and now Flash is telling me it can’t convert

  • 0

having some trouble with hitTestObject and now Flash is telling me it can’t convert my ship to a display object.. my problem is the ship class extends Sprite to begin with so I don’t know what’s going on:

Compile error shows this:

TypeError: Error #1034: Type Coercion failed: cannot convert Ship$ to flash.display.DisplayObject.
at Control/controlgame()

Control / controlgame() is this:

function controlgame(e:Event) {
        for (var i = 0; i < wprojectiles.length; i ++) {
            if (wprojectiles[i].x < -200 || wprojectiles[i].x > 750 || wprojectiles[i].y < -200 || wprojectiles[i].y > 600) {
                parent.removeChild(wprojectiles[i]);
                wprojectiles.splice(i,1);
            }
            if (wprojectiles[i].hitTestObject(Ship)) {
                parent.removeChild(wprojectiles[i]);
                wprojectiles.splice(i,1);
            }
        }
    }

Using the debugger, I get this error:

TypeError: Error #1034: Type Coercion failed: cannot convert Ship$ to flash.display.DisplayObject.
at Control/controlgame()[C:\Users\Harry\Desktop\Flash Games\Games\Dodge\Control.as:29]

Line 29, seen in the above snippet, is this:

if (wprojectiles[i].hitTestObject(Ship)) {

Tearing my hair out here, tried everything I could think of and I get this error every single time, no matter what I do! Help would be so badly appreciated!

Thanks in advance.

e: if it bears relevance, this is my document class file

  • 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-28T21:27:55+00:00Added an answer on May 28, 2026 at 9:27 pm

    Where did you declare Ship? It looks like you’re using a Class for your test instead of an instance… do you have something like Ship = new ShipClass() somewhere?

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

Sidebar

Related Questions

Having some trouble with the VideoPlayer Class in XNA (see: XNA VideoPlayer object causes
I having some trouble figuring this problem out where I have one button which
After having some trouble with object deletion, I ran a simple test: Created a
Im having some trouble with a simple form. I can't seem to prevent the
Am having some trouble hooking up instance variables in the visual object editor using
Having some trouble passing values from one class to another. I basically have a
Having some trouble understanding variable scope within a class structure. I want to create
having some trouble with this can't understand why it won't work properly. http://host.philmadelphia2.com/~clare/order/ when
Im having some trouble with Jquery Templates and can't seem to figure out what's
Having some trouble here with this. The setup: A select object with a choice

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.