2
votes

Updated:

Now I am recieving this error:

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip

From this class:

package com.George.MegaAmazingApp.Components
{
    import flash.display.MovieClip;
    import flash.display.Stage;
    import flash.events.MouseEvent;

    public class Wheel extends MovieClip
    {

        public function Wheel(area:MovieClip, diagram:MovieClip)
        {
            area.addEventListener(MouseEvent.CLICK, clickHandler);
        }
        private function clickHandler(event:MouseEvent):void
        {
            trace("wheel clicked");
            trace("this is diagram");
        }

    }

}

and this script:

import com.George.MegaAmazingApp.Components.*;

var wheel:Wheel = new Wheel(this.wheel,this.car);

Debug gives:

Attempting to launch and connect to Player using URL C:/Documents and Settings/reithg/My Documents/Classes/com/GeorgesMegaAmazingApp-app.xml
[SWF] GeorgesMegaAmazingApp.swf - 51681 bytes after decompression
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@2968e51 to com.George.MegaAmazingApp.Components.Wheel.
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    at GeorgesMegaAmazingApp_fla::MainTimeline()
    at runtime::ContentPlayer/loadInitialContent()
    at runtime::ContentPlayer/playRawContent()
    at runtime::ContentPlayer/playContent()
    at runtime::AppRunner/run()
    at ADLAppEntry/run()
    at global/runtime::ADLEntry()

GeorgesMegaAmazingApp-app.xml doesn't exist in that directory but I don't know why it is looking there anyway, it is not where the fla is located.

2
have you tried to say import com.George.MegaAmazingApp.Components.Wheel instead of com.George.MegaAmazingApp.Components.*? - Eugeny89
@Eugeny89 the problem was with the capitalisation of the first letter as I had saved the file as all lowercase... but now I have a new error, updating first post. - George Reith
it doesnt say a popup appears with this: TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@2963e51 to com.George.MegaAmazingApp.Components.Wheel. at flash.display::Sprite/constructChildren() at flash.display::Sprite() at flash.display::MovieClip() at GeorgesMegaAmazingApp_fla::MainTimeline() at runtime::ContentPlayer/loadInitialContent() at runtime::ContentPlayer/playRawContent() at runtime::ContentPlayer/playContent() at runtime::AppRunner/run() at ADLAppEntry/run() at global/runtime::ADLEntry() - George Reith

2 Answers

2
votes

Either this.wheel or this.car is not a MovieClip. Also could you turn on debugging in File > Publish Settings? You'll then get better error messages because, without more information, your error could be just about anywhere.

Edit:

Try renaming var wheel to something else because it seems that Flash is confused with your two wheel objects. For example, try:

var wheelObject:Wheel = new Wheel(this.wheel,this.car);
1
votes

Is Wheel.as in the directory com/George/MegaAmazingApp/Components? (case-sensitive) Is that 'com' directory in a source path directory?