A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: understanding script

  1. #1
    Member
    Join Date
    Apr 2002
    Posts
    52

    understanding script

    hi

    can u guys help me understand actionscript??, i've just learned a basic scripted movement, but i don't understand why it does differently when placed in a movieclip on the maintimeline - as opposed to just directly on the maintimeline.

    =code:
    r_mc.onClipEvent(load){
    this._x-=(this._x-t_mc._x)*.2
    this._xscale-=15;
    if (this._x>=300){
    this._xscale+=20;
    if(this._xscale >= 20){
    this._xscale-=(this._xscale-t_mc._xscale)*.1
    }
    }
    }

    (also please let me know- if this script can be better)

  2. #2
    Abandon all Hope Inflicted's Avatar
    Join Date
    Aug 2003
    Location
    Harlem A+, Netherlands
    Posts
    296
    Tried your code on both MC and button, but it doesn't work!
    onClipEvent means it happens directly when the movie starts. Otherwise you could call it from a button:

    code:
    on (release) {
    clip_mc._x -= (clip_mc._x-t_mc._x)*.2;
    clip_mc._xscale -= 15;
    if (clip_mc._x>=300) {
    clip_mc._xscale += 20;
    if (clip_mc._xscale>=20) {
    clip_mc._xscale -= (clip_mc._xscale-t_mc._xscale)*.1;
    }
    }
    }



    clip_mc is the MC on the stage.

    hope it helps...
    regards

  3. #3
    Member
    Join Date
    Apr 2002
    Posts
    52
    oops very sorry! i grabbed the wrong code.
    thanks for the reply tho.

    =code:

    bar_mc.onEnterFrame=function(){
    this._x-=(this._x-layout_mc._x)*.2
    this._xscale+=15;
    if (this._x>=-10){
    this._xscale+=20;
    if(this._xscale >= 20){
    this._xscale-=(this._xscale-layout_mc._xscale)*.1
    }
    }
    }

  4. #4
    Abandon all Hope Inflicted's Avatar
    Join Date
    Aug 2003
    Location
    Harlem A+, Netherlands
    Posts
    296
    Nice one!
    Any more questions?
    regards

  5. #5
    Member
    Join Date
    Apr 2002
    Posts
    52
    yeah sorry again; i meant i put the wrong code in the post- the latter code still applies to the initial question:

    when i put this code in a movieclip and the movieclip on the main time line (because i'm gonna have to mask the clip) it won't stop xscaleing.
    its probably some simple script philosphy i don't understand

    cheers

  6. #6
    Abandon all Hope Inflicted's Avatar
    Join Date
    Aug 2003
    Location
    Harlem A+, Netherlands
    Posts
    296
    Can you post the fla, or else the code you have now?
    regards

  7. #7
    Member
    Join Date
    Apr 2002
    Posts
    52
    here's the fla, with the very exciting animation
    Attached Files Attached Files

  8. #8
    Abandon all Hope Inflicted's Avatar
    Join Date
    Aug 2003
    Location
    Harlem A+, Netherlands
    Posts
    296
    put blue_mc AND it's script on the main
    timeline.
    If more problems...tomorrow, it's late here.
    regards

  9. #9
    Member
    Join Date
    Apr 2002
    Posts
    52
    hey thanks again
    its late here too (in amsterdam)
    weltrusten

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