A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: actionscript HELP!

  1. #1
    Junior Member
    Join Date
    Feb 2006
    Posts
    6

    actionscript HELP!

    hey, i have this snow effect controlled by actionscript in the timeline of my scene, but the effect plays through all of the scenes.

    can ne1 tell me how to stop this effect from playing on the other scenes?

    cheers!

  2. #2
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282
    What AS are you using for the snow ?

  3. #3
    Junior Member
    Join Date
    Feb 2006
    Posts
    6
    on the stage i have this actionscript on a keyframe..
    "for (k=0; k<50; k++) {
    duplicateMovieClip(this.snow, "snow"+k, k);
    }"
    i also have a instance of a movieclip on the stage with this actionscript..
    "onClipEvent (load) {
    movieWidth = 700;
    movieHeight = 140;
    i = 1+Math.random()*2;
    k = -Math.PI+Math.random()*Math.PI;
    this._xscale = this._yscale=22+Math.random()*100;
    this._alpha = 75*100;
    this._x = 20+Math.random()*movieWidth;
    this._y = 0+Math.random()*movieHeight;
    }
    onClipEvent (enterFrame) {

    rad += (k/180)*Math.PI;
    this._x -= Math.cos(rad);
    this._y += i;
    if (this._y>=movieHeight) {
    this._y = 20;
    }
    if ((this._x>=movieWidth) || (this._x<=0)) {
    this._x = -40*movieWidth;
    this._y = 450;
    }
    }"
    ne suggestions?

  4. #4
    Junior Member
    Join Date
    Feb 2006
    Posts
    22
    1. Add you code in between [CODE] [CODE/]

    2. Use // before you add commentary to the code

    3. Use remotely proper grammar -- this isn't AIM >.>

    It makes it much less confusing. ;-)

    As far as your problem, I can't really help ya there. :-\
    ~Joseph

  5. #5
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    I added a few lines to the end of your snow script:

    Code:
    onClipEvent (load) {
    	movieWidth = 700;
    	movieHeight = 140;
    	i = 1+Math.random()*2;
    	k = -Math.PI+Math.random()*Math.PI;
    	this._xscale = this._yscale=22+Math.random()*100;
    	this._alpha = 75*100;
    	this._x = 20+Math.random()*movieWidth;
    	this._y = 0+Math.random()*movieHeight;
    }
    
    onClipEvent (enterFrame) {
    
    	rad += (k/180)*Math.PI;
    	this._x -= Math.cos(rad);
    	this._y += i;
    	if (this._y>=movieHeight) {
    		this._y = 20;
    	}
    	if ((this._x>=movieWidth) || (this._x<=0)) {
    		this._x = -40*movieWidth;
    		this._y = 450;
    	}
    	if (_root.noSnow) // jbum added this part
    	{
    		this.removeMovieClip();
    	}
    }
    On the frame in your main timeline where you want the snow to stop, add the following
    frame script:

    Code:
    noSnow = true;
    -- regards

  6. #6
    Junior Member
    Join Date
    Feb 2006
    Posts
    6
    hey jbum thanks alot you know your stuff! much appreciated

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