WEB PayPal Reward. Flash Coders! Basic stuff

Discussion in 'OT Technology' started by Disguy, Jun 1, 2008.

  1. Disguy

    Disguy Batman > Moon Knight OT Supporter

    Joined:
    Oct 26, 2004
    Messages:
    1,060
    Likes Received:
    0
    Its been solved

    I tried previously to get help with this thing I'm trying to do and I didn't get much help.

    I want to create a flash program that has a ball move up and down. Whenever it reaches the top of the screen it will hit a wall. I want to do this with actionscript and not tweens. I just can't get it to work as I don't understand this software that well.

    I would prefer to do it myself its just I don't get how this works at all.

    So $20 paypaled to you if you can create this with actionscript 3.0 and send me the file.

    OR if you could find a site that expains how do this process myself first that would be the best.

    PLZ PM or leave a msg here before you goto work as I don't want 20 ppl doing the same thing!

    stubbled upon this thanks to Ricky.

    http://www.youtube.com/watch?v=C63x2bmiufE&feature=related

    I did this but its not moving.

    onClipEvent(enterframe)
    {
    this._y+=20;
    if (_root.wall.hitTest(this))
    {
    this._y-=20;
    }
    }

    also 3 errors

    undefined method onClipevent
    undefined property enterframe
    undefined property _root
     
    Last edited: Jun 2, 2008
  2. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
  3. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
  4. Disguy

    Disguy Batman > Moon Knight OT Supporter

    Joined:
    Oct 26, 2004
    Messages:
    1,060
    Likes Received:
    0
    its good stuff there a little hard to follow and a little bit more complex than what I need.

    I literally want to the ball to move straight up and down. One speed and reverse directions when it hits the top or bottom and to repeat this forever.
     
  5. Disguy

    Disguy Batman > Moon Knight OT Supporter

    Joined:
    Oct 26, 2004
    Messages:
    1,060
    Likes Received:
    0
    stubbled upon this thanks to Ricky.

    http://www.youtube.com/watch?v=C63x2...eature=related

    I did this but its not moving.

    onClipEvent(enterframe)
    {
    this._y+=20;
    if (_root.wall.hitTest(this))
    {
    this._y-=20;
    }
    }

    also 3 errors

    undefined method onClipevent
    undefined property enterframe
    undefined property _root


    don't i need to indicate that the movie clip which is to be moving?
     
  6. Disguy

    Disguy Batman > Moon Knight OT Supporter

    Joined:
    Oct 26, 2004
    Messages:
    1,060
    Likes Received:
    0
    forget everything else this seems to be the code i'm looking for but its erroring. I think this might be code in actionscript 2 perhaps? could it be that this has changed in the new 3.0 version?



    Code:
    onClipEvent (load)
    { 
    speed = 5 
    } 
    onClipEvent (enterFrame)
    { 
    if (Key.isDown(Key.UP))
    { 
    this._y -= speed 
    } 
    if (this.hitTest(top_wall))
    { 
    gotoAndStop (1) 
    } 
    }
     
  7. you posted as2 code. I can do what you need in as3
     
  8. Disguy

    Disguy Batman > Moon Knight OT Supporter

    Joined:
    Oct 26, 2004
    Messages:
    1,060
    Likes Received:
    0
    Code:
    addEventListener(Event.ENTER_FRAME, checkCollision);
    function checkCollision(event:Event) 
    {
    
    var leftArrow:Boolean = false;
    var rightArrow:Boolean = false;
    var upArrow:Boolean = false;
    var downArrow:Boolean = false;
    
    stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressedDown);
    stage.addEventListener(KeyboardEvent.KEY_UP, keyPressedUp);
    stage.addEventListener(Event.ENTER_FRAME, moveBee);
    function keyPressedDown(event:KeyboardEvent) {
    if (event.keyCode == 37) {
    leftArrow = true;
    } else if (event.keyCode == 39) {
    rightArrow = true;
    } else if (event.keyCode == 38) {
    upArrow = true;
    } else if (event.keyCode == 40) {
    downArrow = true;
    }
    }
    function keyPressedUp(event:KeyboardEvent) {
    if (event.keyCode == 37) {
    leftArrow = false;
    } else if (event.keyCode == 39) {
    rightArrow = false;
    } else if (event.keyCode == 38) {
    upArrow = false;
    } else if (event.keyCode == 40) {
    downArrow = false;
    }
    }
    
    // move every frame
    function moveBee(event:Event) {
    var speed:Number = .5;
    
    if (leftArrow) {
    ball_mc.x -= speed;
    }
    if (rightArrow) {
    ball_mc.x += speed;
    }
    if (upArrow) {
    ball_mc.y -= speed;
    }
    if (downArrow) {
    ball_mc.y += speed;
    }
    }
    
    // test playerBee hit maze
    /*if (ball_mc.hitTestObject(bottom_wall)) 
    {
    messageText2.text = "hitTestObject: YES";
    } else 
    {
    messageText2.text = "hitTestObject: NO";
    }*/
    }
    Here is the code pretty much in AS3. it works but the collision detection isn't there. If you want to do it the offers still on the table.
     
  9. Disguy

    Disguy Batman > Moon Knight OT Supporter

    Joined:
    Oct 26, 2004
    Messages:
    1,060
    Likes Received:
    0
    No takers?
     
  10. MikeTheVike1

    MikeTheVike1 OT Supporter

    Joined:
    Aug 29, 2002
    Messages:
    5,840
    Likes Received:
    0
    I might be able to help you on Monday, I will have to test code at work, since I don't have Flash on my home computer.

    Edit: Do you know any actionscript at all? I might be able to give you some ideas to try...
     
  11. Disguy

    Disguy Batman > Moon Knight OT Supporter

    Joined:
    Oct 26, 2004
    Messages:
    1,060
    Likes Received:
    0
    thanks but its been completed!

    I'd like to thank everyone that helped or tried to help! :bigthumb: This was a pain in the ass and I wouldn't be do so otherwise!
     

Share This Page