A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: HELP ME PLEASE - Error codes and my assignment is over the deadline:O

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    12

    Exclamation HELP ME PLEASE - Error codes and my assignment is over the deadline:O

    Can someone help me please?
    can you tell me how to fix this error code?
    The first error is:
    Call to a possibly undefined method Spider1_mc.
    The code is:
    var thisMC:MovieClip = new Spider1_mc();

    The next one is:
    Access of undefined property thisMC.

    the code is
    thisMc.addEventListener(Event.ENTER_FRAME, spider1MoveHandler);

    The next one is:
    Access of undefined property Spider1MC

    The code is:
    if (spider1MC.x > stageWidth) {

    The next one is:
    Access of undefined property Spider1MoveHandler

    The code is:
    Spider1MC.removeEventListener(Event.ENTER_FRAME, Spider1MoveHandler);




    Thankyou so much
    I really appreciate it!
    Corey!

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    Without having anymore of your code, you do have some upper case letters where lower case are needed and vice versa.
    You also have the clip named as spider1MC when it should be called thisMC.

    Perhaps this might help you sort it out.
    PHP Code:
    var thisMC:MovieClip = new Spider1_mc();
    addChild(thisMC);

    thisMC.addEventListener(Event.ENTER_FRAMEspider1MoveHandler);

    function 
    spider1MoveHandler(e:Event):void
    {
        if (
    thisMC.stage.stageWidth)
        {
            
    trace("I'm here");
            
    thisMC.removeEventListener(Event.ENTER_FRAMEspider1MoveHandler);
        }


  3. #3
    Junior Member
    Join Date
    Apr 2014
    Posts
    12

    Exclamation

    Quote Originally Posted by fruitbeard View Post
    Hi,

    Without having anymore of your code, you do have some upper case letters where lower case are needed and vice versa.
    You also have the clip named as spider1MC when it should be called thisMC.

    Perhaps this might help you sort it out.
    PHP Code:
    var thisMC:MovieClip = new Spider1_mc();
    addChild(thisMC);

    thisMC.addEventListener(Event.ENTER_FRAMEspider1MoveHandler);

    function 
    spider1MoveHandler(e:Event):void
    {
        if (
    thisMC.stage.stageWidth)
        {
            
    trace("I'm here");
            
    thisMC.removeEventListener(Event.ENTER_FRAMEspider1MoveHandler);
        }

    Thankyou!
    That got rid of them errors, now i am left with one error which says Scene 1, Layer 'Layer 5', Frame 5 1084: Syntax error: expecting rightbrace before end of program.

    I will show you all of my code for that.
    Any help would be appreciated!
    Corey

    PHP Code:
    stop(); 
    stage.focus stage;


    Hammer.x=mouseX;
    Hammer.y=mouseY;
    Hammer.mouseEnabled false;


    stage.addEventListener(MouseEvent.MOUSE_MOVE,redrawCursor);

    Mouse.hide();


    function 
    redrawCursor(event:MouseEvent):void
    {
        
    Hammer.event.stageX;
        
    Hammer.event.stageY;
    }
    stop();

    var 
    cDepth:int100;
    var 
    xSpeed:Number 4;
    var 
    stageWidth:Number stage.stageWidth;
    var 
    stageHeight:Number stage.stageHeight;

    stage.addEventListener (Event.ENTER_FRAMEmain);

    function 
    main(event:Event):void{
        
    createSpider1();
    }

    function 
    createSpider1():void{
        if (
    randRange(010) == 0){
            var 
    thisMC:MovieClip = new Spider1_mc(); 
    addChild(thisMC); 
            
    cDepth++;
            
    thisMC.= -thisMC.width
            
    thisMC.speed xSpeed
            
    thisMC.randRange(thisMC.heightstageHeight-thisMC.height);
            
    thisMC.name "Spider1" cDepth;
            
    thisMC.addEventListener(Event.ENTER_FRAMEspider1MoveHandler);
            
    addChild(thisMC); 
        }
    }

    function 
    spider1MoveHandler(event:Event):void {
        var 
    Spider1MC:MovieClip event.currentTarget as MovieClip;
        function 
    spider1MoveHandler(e:Event):void 

        if (
    thisMC.stage.stageWidth
        { 
                  
    removeChild(Spider1MC);
                  
    trace("I'm here"); 
            
    thisMC.removeEventListener(Event.ENTER_FRAMEspider1MoveHandler); 
        } 
    }  

    function 
    randRange(minNum:NumbermaxNum:Number):Number {
        return (
    Math.floor(Math.random()*(maxNum minNum 1)) +minNum);


  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    It's sometimes easier for us if you attach your *.fla, but here goes, perhaps this or similar
    PHP Code:
    stop();
    stage.focus stage;

    Hammer.mouseX;
    Hammer.mouseY;
    Hammer.mouseEnabled false;

    stage.addEventListener(MouseEvent.MOUSE_MOVE,redrawCursor);
    stage.addEventListener(Event.ENTER_FRAMEmain);

    Mouse.hide();

    function 
    redrawCursor(event:MouseEvent):void
    {
        
    Hammer.event.stageX;
        
    Hammer.event.stageY;
    }

    var 
    cDepth:int 100;
    var 
    xSpeed:Number 4;
    var 
    stageWidth:Number stage.stageWidth;
    var 
    stageHeight:Number stage.stageHeight;
    var 
    thisMC:MovieClip = new Spider1_mc();

    function 
    main(event:Event):void
    {
        
    createSpider1();
    }

    function 
    createSpider1():void
    {
        if (
    randRange(010) == 0)
        {
            
    addChild(thisMC);
            
    cDepth++;
            
    thisMC.=  -  thisMC.width;
            
    thisMC.speed xSpeed;
            
    thisMC.randRange(thisMC.height,stage.stageHeight thisMC.height);
            
    thisMC.name "Spider1" cDepth;
            
    thisMC.addEventListener(Event.ENTER_FRAMEspider1MoveHandler);
        }
    }

    function 
    spider1MoveHandler(event:Event):void
    {
        var 
    Spider1MC:MovieClip event.currentTarget as MovieClip;
        if (
    thisMC.stage.stageWidth)
        {
            
    removeChild(Spider1MC);
            
    trace("I'm here");
            
    thisMC.removeEventListener(Event.ENTER_FRAMEspider1MoveHandler);
        }
    }

    function 
    randRange(minNum:NumbermaxNum:Number):Number
    {
        return (
    Math.floor(Math.random()*(maxNum minNum 1)) +minNum);


  5. #5
    Junior Member
    Join Date
    Apr 2014
    Posts
    12
    Quote Originally Posted by fruitbeard View Post
    Hi,

    It's sometimes easier for us if you attach your *.fla, but here goes, perhaps this or similar
    PHP Code:
    stop();
    stage.focus stage;

    Hammer.mouseX;
    Hammer.mouseY;
    Hammer.mouseEnabled false;

    stage.addEventListener(MouseEvent.MOUSE_MOVE,redrawCursor);
    stage.addEventListener(Event.ENTER_FRAMEmain);

    Mouse.hide();

    function 
    redrawCursor(event:MouseEvent):void
    {
        
    Hammer.event.stageX;
        
    Hammer.event.stageY;
    }

    var 
    cDepth:int 100;
    var 
    xSpeed:Number 4;
    var 
    stageWidth:Number stage.stageWidth;
    var 
    stageHeight:Number stage.stageHeight;
    var 
    thisMC:MovieClip = new Spider1_mc();

    function 
    main(event:Event):void
    {
        
    createSpider1();
    }

    function 
    createSpider1():void
    {
        if (
    randRange(010) == 0)
        {
            
    addChild(thisMC);
            
    cDepth++;
            
    thisMC.=  -  thisMC.width;
            
    thisMC.speed xSpeed;
            
    thisMC.randRange(thisMC.height,stage.stageHeight thisMC.height);
            
    thisMC.name "Spider1" cDepth;
            
    thisMC.addEventListener(Event.ENTER_FRAMEspider1MoveHandler);
        }
    }

    function 
    spider1MoveHandler(event:Event):void
    {
        var 
    Spider1MC:MovieClip event.currentTarget as MovieClip;
        if (
    thisMC.stage.stageWidth)
        {
            
    removeChild(Spider1MC);
            
    trace("I'm here");
            
    thisMC.removeEventListener(Event.ENTER_FRAMEspider1MoveHandler);
        }
    }

    function 
    randRange(minNum:NumbermaxNum:Number):Number
    {
        return (
    Math.floor(Math.random()*(maxNum minNum 1)) +minNum);

    How do i attach that? haha im new here
    I done what you said and i had another error which says line 23: Call to a possibly undefined method Spider1_MC.
    Thankyou though!

  6. #6
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    I believe it's because you need to have a clip in the library with "Spider1_mc" as it's linkage name.

    To attch a file use the paperclip icon/image

  7. #7
    Junior Member
    Join Date
    Apr 2014
    Posts
    12
    Quote Originally Posted by fruitbeard View Post
    Hi,

    I believe it's because you need to have a clip in the library with "Spider1_mc" as it's linkage name.

    To attch a file use the paperclip icon/image
    You were right and it worked !
    Thankyou!
    However, when i go to upload it says that it has failed, would it be worth uploading it to mediafire and sending you the link?
    Also do you know how i can get the Spider to move across the screen?
    Corey

  8. #8
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    If you got it working there is no need to make a link to your file, however if you are stuck with something else then please do so, explaining what you need to achieve (with key press, on it's own etc etc), I thought you already had this part done!!!

  9. #9
    Junior Member
    Join Date
    Apr 2014
    Posts
    12
    i wasn't sure haha, i got this code off my tutor (well the first code i shown you) and i did'nt even think about it, i know i should probably have it already done but i really dont know how to do it.
    This is the link to my file https://www.mediafire.com/?6t15u9zi3jo6m1y
    Thankyou and sorry for asking for everything
    You're amazing haha
    Corey

  10. #10
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    You attached the file without the fixes that we just made

  11. #11

  12. #12
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    I'm not exactly sure what you would like help with, do you actually want us to make it for you?

    there are no errors anymore either and it is your homework/project
    Last edited by fruitbeard; 04-30-2014 at 12:02 PM.

  13. #13
    Junior Member
    Join Date
    Apr 2014
    Posts
    12
    I'd love that, BUT i can't ask you to do everything haha.
    IF you can; Can you make the two Spiders move to the end?
    and then off the screen?
    Corey

  14. #14
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    I will hint toward it, both spiders on the stage need to be named differntly (not the same)

    PHP Code:
    function spider1MoveHandler(event:Event):void 
    {
        
    Spider1.+= 2;
        
    Spider2.+= 2;


  15. #15
    Junior Member
    Join Date
    Apr 2014
    Posts
    12
    Thankyou,
    If i receive the error 'Access to undefined property spider1'
    and also 'Access to undefined property spider2'

    Is this because i need to name them differently?
    and also 'Access to undefined property event'
    Cheers
    Corey

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center