A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: this time i've got two...

  1. #1
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272

    this time i've got two...

    Hi ,can some one tell me how to make element to do the following :

    A) move left at high speed (by sliding)
    B) move to another element and stop (by sliding)

    i've got no expiriance in this kind of stuff and its realy pissing my
    off

    P.S - blanius dont give up on 3dfa ....without you im doomed....
    ok....what ?

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    not sure what you mean by "sliding"

  3. #3
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272
    by slide i mean - not just appear in the x and y that ill pick
    but i want it to move there (motion)

    if you still dont understand what i mean check the 3dfa samples
    pac-men.........i want to make the element move as the hero does
    ok....what ?

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Ah I think I see.
    Basically you have to determine the velocities you want and watch for when it arrives at it's destination

    I have a formula for part of this

    if you know target X and target Y and origin x and origin y then set an element x velocity and with a y veolocity of

    t=(target.x-origin.x)/element.velocity.x
    element.velocity.y=(target.y-origin.y)-(t*t/2))/t


    simpler if you just want it to slide in then set a positive x velocity and a small negative acceleration watching in a IF loop until it arrives at the desired x position

    srart script like this.
    ele=element ("moon")//useed moon clipart to test
    startx=0
    starty=0
    endx=160
    ele.x=startx
    ele.y=118
    ele.velocity.x=400
    ele.acceleration.x=-40


    then in looping script I put
    if (ele.x=>endx){

    ele.velocity.x=0
    ele.acceleration.x=0
    }
    Last edited by blanius; 04-30-2004 at 11:55 AM.

  5. #5
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272
    thanks blanius....but i afried i tried what you told me but it didnt
    worked....

    im incloding a small demo .movie file to show you that its just
    keep appearing insted of sliding...

    please take a look and tell or just change it ...whatever you like

    what went wrong?
    Last edited by cyber reaper; 04-30-2004 at 12:41 PM.
    ok....what ?

  6. #6
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    couple of things. First off you can't have velocity on an animation. If you really must have it put the animation on a layer.

    Second the loop that checks for position can't be in the button it must be in a script that is executed all the time.

    See attached.
    Attached Files Attached Files

  7. #7
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272
    in that case i have to ask you one more last thing
    will it be ok to use that loop on a frame of an animation ,so one
    it have been reached that frame the animation (wich is in a layer)
    will execute the script ?

    PS - you better show me an example because dont realy understand much about this kind of stuff
    Last edited by cyber reaper; 04-30-2004 at 03:01 PM.
    ok....what ?

  8. #8
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    I don't entirely understand but I don't think it'll work that way.

    What you can do is in the animation frame set a variable in the root movie that is a "trigger" to start the animation. In other words in you IF statement check also if the "trigger" is true. And in your animation on the needed frame set the value of this "trigger" to be true.

  9. #9
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272

    ok ok...let me make myself clear

    just tell me as simple as possible .... how can i move an animation,
    you said it sould be in a layer

    but how do i write that scrip ?

    im not sure i realy need velocity cause all i want it to do is :

    a) just move until ill destroy it using .destroy command

    b) move to another element's x position

    thats all ! im sure there is an easy way of making this go

    please try to make my life as simple as possible i dont know what roots are and i think i wont unserstand....just keep it to basic
    hope its not to much truble
    ok....what ?

  10. #10
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Look over the attached file.
    Attached Files Attached Files

  11. #11
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272
    oh thank you i hope ill find out how to change the numbers
    to do what i need


    THANKS !!!!!!
    ok....what ?

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