A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: It needs to grow!!

  1. #1
    www.designaweb4me.co.uk
    Join Date
    Apr 2002
    Location
    UK
    Posts
    246

    It needs to grow!!

    Im trying to maka a mc grow when the mouse is over it.

    basically script needs to be like....

    on rollover
    if this_mc's width or height is less that 200
    increase its width and height by 5
    until it gets that big

    I tried various ways of doin it "wrongly" but the only way I can think of doing it is by nesting ON handlers, which isn't allowed

    Frantically flickin through a Colin Moock book....
    Teoma

  2. #2
    absent
    Join Date
    Aug 2000
    Location
    NB, Canada
    Posts
    155
    a "for" may help you out here, ie:

    on (mouseover) {
    for ( i=1, i>=200, i++) {
    this._height = this._height+i
    }
    }

    or something like that.. ^_^
    i'd suggest looking it up in your
    FlashMX actionscript dictionary
    for the proper way to write it...

    good luck!
    - g

  3. #3
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Wrong
    code:
    on (mouseover) {
    for ( i=1, i>=200, i++) {
    this._height = this._height+i
    }
    }



    Right
    code:
    on (mouseover) {
    for ( i=1; i<200; i++) {
    this._height = this._height+i
    }
    }

    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  4. #4
    www.designaweb4me.co.uk
    Join Date
    Apr 2002
    Location
    UK
    Posts
    246
    I keep trying things like that,, all I get is endless loops and flash freezin,
    code:

    on (rollOver) {
    for (i=1; i<=200; i++) {
    this._height = this._height + i;
    }
    }


    like your example gomar, what this does is change the size instantly and not like just using tweening to change a size, well thats the effect i want to acheive, just with AS.

    think i remembered a fla i have that duz it, or i might look at setInterval to do it. ARGH!
    Last edited by Teoma; 09-24-2003 at 01:16 PM.

  5. #5
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Ah i know what your looking for
    code:

    //frame 1
    bar._xscale=0

    //frame2
    bar.xscale+=5

    //frame3
    if(bar._xscale<100){
    gotoAndplay(2);
    }else{
    gotoAndStop(4)
    }

    //frame4
    stop();


    This should get you started in trying to acomplish the effect your affter
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  6. #6
    www.designaweb4me.co.uk
    Join Date
    Apr 2002
    Location
    UK
    Posts
    246
    can i do that in 1 frame with rollOver event?

  7. #7
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    this code would have to be in a an mc of it own
    frame 1 would have a stop action
    the each frame after as above

    the rollover event would have something liek

    code:

    on(rollover){
    mcwithgrow.gotoAndPlay(2)
    }


    Or something like that
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  8. #8
    absent
    Join Date
    Aug 2000
    Location
    NB, Canada
    Posts
    155
    ahh, here's the movie i was thinking of... this may be a help for some code.. it's not exactly what you want but i'm sure you can rework it..

    good luck! ^_^

    Flashkit/Movies/Elastic

    and yes those "," and ";" would mess you over well.. hehe.. ^_^
    - g

  9. #9
    www.designaweb4me.co.uk
    Join Date
    Apr 2002
    Location
    UK
    Posts
    246
    Thats addictive, although doesn't work if exported to Flash 6 or 7, I played about with it to make it work, n saved it as MX format,
    The code will allow anything to expand in size when rollOver occurs, so if anyone else want to see it, it's attached

    Only problem is, It's lost the elastic effect
    Attached Files Attached Files

  10. #10
    Junior Member
    Join Date
    Nov 2002
    Posts
    18
    I never used the for command, so I don't understand how it works, but I use:

    code:

    on(rollOver) {
    while ( _root.mcname._width < 200) {
    _root.mcname._width +=5;
    _root.mcname._height +=5;

    }
    }



    Or something like that, I'm not sure if you can set the width and height with _width and _height but I think you can.

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