Page 1 of 2 1 2 LastLast
Results 1 to 15 of 21

Thread: Flash ActionScript

  1. #1
    Join Date
    Jan 2007
    Location
    KL
    Posts
    39
    Rep Power
    0

    Flash ActionScript

    hello...i need help in scripting.im doing a flash project which involves a few buttons to be dragged and dropped onto the right place.now,lemme tell u guys how do my project looks like:

    at the left corner,the arrangement is btn_hitarea2,btn_hitarea1,btn_hitarea3 (all these at layer hitarea). then i also have the btn_hitarea movie clip on the left(at layer named correct_area) which is where the button resides when it's correct. on the right corner, there are btn_1,btn_2,btn_3.so,btn_1 hits btn_hitarea1,btn_2 hits btn_hitarea2 and btn_3 hits btn_hitarea3.

    so now i wan the buttons to stay at the correct hitarea. when it's not correct,the buttons go back to their original position.

    anyone can help?thx in advance





    i hope i made my case clear
    Regards,
    2-help-&-2-b-helped

  2. #2
    Join Date
    Jan 2007
    Location
    Petaling Jaya
    Posts
    867
    Rep Power
    172
    err...i dun really quite understand, mayb somebody else understand? but for my request could u if possible provide some illustration? it would help thanks~~

  3. #3
    Join Date
    Sep 2005
    Location
    in my body lar...
    Posts
    1,325
    Rep Power
    0
    Quote Originally Posted by ccool View Post
    i hope i made my case clear
    i'm totally blur and can't understand your requirements at all...
    if you are trying to do some simple flash animated menu button... i would recommend you use SwishMax from swishzone.com. it easy to use and support scripting....

    if you need tutorial on swishmax.. visit--> swishmaxtutorials.com

  4. #4
    Join Date
    Jun 2001
    Location
    Mystic Kingdoms
    Posts
    2,749
    Rep Power
    277
    pening.. pening...
    sorry.. i dont ever understand what you talking about

    swish? also no no.

    @ccool : what version of Flash you use?

    Load MC? target path? or you just use go to scene / timeline?

  5. #5
    Join Date
    Jan 2007
    Location
    KL
    Posts
    39
    Rep Power
    0
    hahahhahaahha......looks like i complicated u guys' life huh sorrieee

    as u can c from the image:
    > btn_1 is to be dragged to btn_hitarea1.

    same goes to:
    > btn_2 which is supposed to be dragged to btn_hitarea2
    > btn_3 which is supposed to be dragged to btn_hitarea3

    all the buttons will stay at the respective btn_hitarea if it's correct.
    if it's not,then the button goes back to its original place on the right corner.

    im using flash mx 2004 and im using the hitTest() and also hitArea() command.

    hehehe....hope it's clearer now?merci
    Attached Images Attached Images To view attachments your post count must be 0 or greater. Your post count is 0 momentarily.
    Regards,
    2-help-&-2-b-helped

  6. #6
    Join Date
    Jan 2007
    Location
    Petaling Jaya
    Posts
    867
    Rep Power
    172
    if u were to let the button to b drag into the area and stay it there and return bak if it isn't in tat area, then could b easily be done by using startDrag() and stopDrag();

    click on the button itself and insert the action script:
    -----------------------------------------------------
    on(press)
    {
    startDrag(this, true);
    }

    on(release)
    {
    stopDrag();
    if(this._droptarget == "/area") /* the 'area' is your target place instant name*/
    {
    the code to do ur stuffs
    }
    else
    {
    the code to return ur button to its initial status.
    }
    }

    --------------------------------------------------------
    if u wanna ask how to let the button return to the initial status, wat come out frmo my mine now is when u startdrag, record its initialposition, then when u stopdrag and its not on the target area, let the _y and _x = to the initial number.

    this is js a raw idea of doin it hope it helps
    Last edited by yipguseng; 19-01-2007 at 06:28 PM.

  7. #7
    Join Date
    Jan 2007
    Location
    Ampang, KL
    Posts
    32
    Rep Power
    0
    I think I've seen something like this before... is it a dejavu.. no heheh...

    Someone have done this with tutorial let me check first, hmm.. yeah it still exists right here...

    Drag 'n Drop and Drop Targets - ActionScript.org Flash, Flex and ActionScript Resources

    you can even download and analyze the sample... Good Luck!
    Coder's Talk | Art Of ApOgEE | (coming soon... )

  8. #8
    Join Date
    Jan 2007
    Location
    Petaling Jaya
    Posts
    867
    Rep Power
    172
    yeap, was original from there, so u can download fr there for the source as well for reference

  9. #9
    Join Date
    Jan 2007
    Location
    Ampang, KL
    Posts
    32
    Rep Power
    0
    yipguseng : oh really?... I just passing by those sites before on my search about actionscript.

    anyway, there is a lot of samples you can download and analyze... and thank god.. it's all free!! hehehe

    another site is flashkit.com... check it out!
    Coder's Talk | Art Of ApOgEE | (coming soon... )

  10. #10
    Join Date
    Jan 2007
    Location
    KL
    Posts
    39
    Rep Power
    0
    Quote Originally Posted by ApOgEE View Post
    I think I've seen something like this before... is it a dejavu.. no heheh...

    Someone have done this with tutorial let me check first, hmm.. yeah it still exists right here...

    Drag 'n Drop and Drop Targets - ActionScript.org Flash, Flex and ActionScript Resources

    you can even download and analyze the sample... Good Luck!
    as much as i hate to say this,the link aint working
    Regards,
    2-help-&-2-b-helped

  11. #11
    Join Date
    Jan 2007
    Location
    Ampang, KL
    Posts
    32
    Rep Power
    0
    I'm sorry for that... on the day that I posted that link, it is still working... I don't know why...

    Anyway, you can try your luck on this link then...

    kirupa.com - Drag and Drop Using Targets

    Different tutorial... but still applicable to solve your problem... (Downloadable sample is also included)... Now, be quick before its gone again... heheheh!!
    Coder's Talk | Art Of ApOgEE | (coming soon... )

  12. #12
    Join Date
    Jan 2007
    Location
    KL
    Posts
    39
    Rep Power
    0
    Quote Originally Posted by ApOgEE View Post
    I'm sorry for that... on the day that I posted that link, it is still working... I don't know why...

    Anyway, you can try your luck on this link then...

    kirupa.com - Drag and Drop Using Targets

    Different tutorial... but still applicable to solve your problem... (Downloadable sample is also included)... Now, be quick before its gone again... heheheh!!
    haha....ive checked this URL b4 but came to no help anyway,i managed to get the button to stick to the position when it's correct.

    the only problem now is to make the button bounce back to its original position when it's wrong.....anyone?

    cheers~
    Regards,
    2-help-&-2-b-helped

  13. #13
    Join Date
    Jan 2007
    Location
    Ampang, KL
    Posts
    32
    Rep Power
    0
    Hmm... if that so... didn't it help?

    Well bro, you can't get exactly like what you are developing. But from those samples, you have to figure out how they do it and then implement the same technique to yours.

    Good to hear that you've managed to get the button to stick to the position when it's correct.

    Then for the wrong position...

    maybe you can save the position in some variables before dragging, then just place the movieclip back to this position when it is wrong...
    Coder's Talk | Art Of ApOgEE | (coming soon... )

  14. #14
    Join Date
    Jan 2007
    Location
    Petaling Jaya
    Posts
    867
    Rep Power
    172
    Quote Originally Posted by ccool View Post
    haha....ive checked this URL b4 but came to no help anyway,i managed to get the button to stick to the position when it's correct.

    the only problem now is to make the button bounce back to its original position when it's wrong.....anyone?

    cheers~
    well, as i mentioned above, u can actually capture the _x and _y initial position when u start press on the button,
    eg: on(press) { tempX = this._X; tempY = this._y; }

    then when u release ur mouse from the button, u can give a condition if the target is not within the boundaries u can prompt back to the tempX and tempY which u had saved js now, this here will depends on wat method u use to have ur button stick on the target

  15. #15
    Join Date
    Jan 2007
    Location
    KL
    Posts
    39
    Rep Power
    0

    prob solved :) thx

    Quote Originally Posted by yipguseng View Post
    well, as i mentioned above, u can actually capture the _x and _y initial position when u start press on the button,
    eg: on(press) { tempX = this._X; tempY = this._y; }

    then when u release ur mouse from the button, u can give a condition if the target is not within the boundaries u can prompt back to the tempX and tempY which u had saved js now, this here will depends on wat method u use to have ur button stick on the target
    really thx a lot,guys!hahaha...i finally managed to get it right now i've posted a sample of my code here.probably it'll help some other ppl next time

    cheers,again everyone

    on(press)
    {
    this.startDrag();
    dragX = _x;
    dragY = _y;
    }
    }


    on(release)
    {
    stopDrag();
    if (this.hitTest(_root["btn_hitarea"+int_name]))
    {
    this._x = _root.btn_hitarea._x;
    this._y = _root.btn_hitarea._y;
    }

    else
    {
    setProperty (this, _x, dragX);
    setProperty (this, _y, dragY);
    }
    }
    Regards,
    2-help-&-2-b-helped

Page 1 of 2 1 2 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Vacancy : Actionscript coder
    By yanzer in forum Job Vacancies
    Replies: 0
    Last Post: 13-04-2008, 02:03 PM
  2. ActionScript
    By baddai in forum Websites Review and Suggestion
    Replies: 3
    Last Post: 22-04-2004, 07:17 PM
  3. actionscript newbie:urgent
    By mikev_fly in forum Website Design
    Replies: 8
    Last Post: 19-02-2004, 08:02 PM
  4. nak belajor actionscript.!!
    By lanxc_7 in forum Website Design
    Replies: 6
    Last Post: 04-07-2003, 12:27 AM
  5. Kat Mana Nak Belaja Actionscript?
    By napy8gen in forum Website Design
    Replies: 11
    Last Post: 12-12-2002, 01:05 AM

Posting Permissions

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

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112