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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:57:38+00:00 2026-05-27T16:57:38+00:00

* EDIT – I find what is giving me the error is when i

  • 0

*EDIT – I find what is giving me the error is when i try to change the graphics properties of the movieclip.*

I am receiving this error. “ReferenceError: Error #1069: Property item not found on flash.events.MouseEvent and there is no default value. at PlayScreen/onClick()”.
I did a bit of research and most sites say it is due to a typo. but as far as i can tell it looks fine?

I have two events which are set out exactly the same as far as i can tell. One is triggered onclick and the other onhover. The hover event works fine but when i use the onclick event i recieve the error above. However even though i receive the error the function still works as it should.

Here is my code.
the code below creates a new Grid. then the custom events are added. the hover event works fine with no errors. the onclick event works fine but i get the error.

package  {
import flash.events.MouseEvent;
import flash.display.MovieClip;
public class PlayScreen extends MovieClip {
    public var grid:Grid;

    public function PlayScreen() {
        grid = new Grid();
        grid.addEventListener( GridEvent.HOVER, onHover);
        grid.addEventListener( GridEvent.TILECLICK, onClick);
        grid.x = 0;
        grid.y = 0;
        addChild( grid );

    }

    public function onHover(event:*){
        event.item.graphics.beginFill(0x66ff66);
        event.item.graphics.lineStyle(2, 0x22ff22);
        event.item.graphics.drawRect(-30*0.5, -30*0.5, 30, 30);
        event.item.graphics.endFill();

    }

    public function onClick(event:*){
        event.item.graphics.beginFill(0x000000);
        event.item.graphics.lineStyle(2, 0x22ff22);
        event.item.graphics.drawRect(-30*0.5, -30*0.5, 30, 30);
        event.item.graphics.endFill();
    }

Below is my grid class. It contains a movieclip which has two mouseEvents added to it which then trigger the custom events.

package  {
import flash.display.MovieClip;
import flash.events.MouseEvent;

public class Grid extends MovieClip {

    public function Grid() {
        var test = new MovieClip();
        test.x = 0;
        test.y = 0;
        test.graphics.beginFill(0x66ff66); 
        test.graphics.drawRect(-tileWidth*0.5, -tileHeight*0.5, tileWidth, tileHeight);
        test.graphics.endFill();
        test.addEventListener(MouseEvent.MOUSE_OVER, overTile);
        test.addEventListener(MouseEvent.MOUSE_DOWN, clickTile);
        addChild(test);
    }

    function overTile (event:*) {
        dispatchEvent( new GridEvent( GridEvent.HOVER, event.target) );
    }

    function clickTile(event:*) {
        dispatchEvent( new GridEvent( GridEvent.TILECLICK, event.target) );
    }

}

Below are my custom events

   package  
{
    import flash.events.Event;
    public class GridEvent extends Event
    {
        public static const HOVER :String = "hover";
        public static const TILECLICK :String = "click";
        public var item;

        public function GridEvent (type:String, item)
        {
                this.item = item;
                super(type);
        }

    }
}
  • 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-27T16:57:39+00:00Added an answer on May 27, 2026 at 4:57 pm

    try giving the event and the item a type.
    use Sprite instead of MovieClip.

    and another thing i didn’t implement – would be best if you created a custom Tile-class for your tiles then you could set the type of the item in your GridEvent as Tile and not as Sprite/MovieClip.

    this should work ….

    package  
    {
        import flash.events.MouseEvent;
        import flash.display.MovieClip;
        public class PlayScreen extends MovieClip 
        {
            public var grid:Grid;
    
            public function PlayScreen() 
            {
                grid = new Grid();
                grid.addEventListener( GridEvent.HOVER, onHover);
                grid.addEventListener( GridEvent.TILECLICK, onClick);
                grid.x = 0;
                grid.y = 0;
                addChild( grid );
    
            }
    
            private function onHover(event:GridEvent):void
            {
                if (event.item != null)
                {
                    var g:Graphics = event.item.graphics;
                    g.beginFill(0x66ff66);
                    g.lineStyle(2, 0x22ff22);
                    g.drawRect(-30*0.5, -30*0.5, 30, 30);
                    g.endFill();
                }
            }
    
            private function onClick(event:GridEvent):void
            {
                if (event.item != null)
                {
                    var g:Graphics = event.item.graphics;
                    g.beginFill(0x000000);
                    g.lineStyle(2, 0x22ff22);
                    g.drawRect(-30*0.5, -30*0.5, 30, 30);
                    g.endFill();
                }
            }
        }
    }
    

    package  
    {
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
    
        public class Grid extends Sprite 
        {
            public function Grid() 
            {
                var test = new Sprite();
                test.x = 0;
                test.y = 0;
                test.graphics.beginFill(0x66ff66); 
                test.graphics.drawRect(-tileWidth*0.5, -tileHeight*0.5, tileWidth, tileHeight);
                test.graphics.endFill();
                test.addEventListener(MouseEvent.MOUSE_OVER, overTile);
                test.addEventListener(MouseEvent.MOUSE_DOWN, clickTile);
                addChild(test);
    
                test.mouseChildren = false;
            }
    
            private function overTile (event:MouseEvent):void 
            {
                if (event.cancelable)
                {
                    // stop MouseEvent from bubbling
                    event.stopImmediatePropagation();
                }
                dispatchEvent( new GridEvent( GridEvent.HOVER, event.target) );
            }
    
            private function clickTile(event:MouseEvent):void 
            {
                if (event.cancelable)
                {
                    // stop MouseEvent from bubbling
                    event.stopImmediatePropagation();
                }
                dispatchEvent( new GridEvent( GridEvent.TILECLICK, event.target) );
            }
        }
    }
    

    package  
    {
        import flash.events.Event;
        public class GridEvent extends Event
        {
            public static const HOVER :String = "hover";
            public static const TILECLICK :String = "click";
            public var item:Sprite;
    
            public function GridEvent (type:String, item:Sprite)
            {
                    this.item = item;
                    super(type);
            }
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: This question is more about language engineering than C++ itself. I used C++
Edit: This was accidentally posted twice. Original: VB.NET Importing Classes I've seen some code
Edit: I have solved this by myself. See my answer below I have set
Edit: The below question was answered by this . I have a new updated
Edit: I'm looking for solution for this question now also with other programming languages.
EDIT Leaving this for posterity, but nearly a year later, to get down voted,
EDIT After staring at this for 2 days, I do see one issue. I
EDIT : I've gotten the famous question badge with this question, so I figured

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.