A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Just a bit of help on this last thing

Hybrid View

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

    Exclamation Just a bit of help on this last thing

    my code is
    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 
    {
        
    Spider1.+= 2;
        
    Spider2.+= 2;
    }  
    {
        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); 


    The errors that i am having are:
    Scene 1, Layer 'Layer 5', Frame 5 Warning: The instance name 'Spider' is declared on an object of type Spider2 but there is a conflicting use of the instance name 'Spider' on an object of type Spider1.

    Scene 1, Layer 'Layer 5', Frame 5, Line 46 1119: Access of possibly undefined property x through a reference with static type Class. This error is for the line : Spider1.x += 2;

    Scene 1, Layer 'Layer 5', Frame 5, Line 47 1119: Access of possibly undefined property x through a reference with static type Class. This error is for the line : Spider2.x += 2;

    Scene 1, Layer 'Layer 5', Frame 5, Line 50 1120: Access of undefined property event.
    This error is for the line : var Spider1MC:MovieClip = event.currentTarget as MovieClip;

    I know ive asked for alot of help today.
    I just need to get it done.
    Thankyou
    Corey

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Warning: Did you give names like "Spider" on the timeline to any existing objects? The warning is not obvious from the script.

    Line 46,47: You probably called movieclip classes Spider1 and Spider2, to which the errors refer. You need to use the instance names instead.

    Line 50 error: You need to include "var Spider1MC:MovieClip = event.currentTarget as MovieClip; " and the rest of it inside of the spider1MoveHandler function.
    - The right of the People to create Flash movies shall not be infringed. -

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