Skip to main content
Participant
September 7, 2009
Answered

Trying to get this code working

  • September 7, 2009
  • 1 reply
  • 509 views

    So, I'm trying to make some smoke and I really like the way one looks I found online; however, I guess it was made in a previous version and some of the code is no longer support with the version I'm using with is CS3.

Hopefully this is the right forum for this.  If not, please redirect me.  Any help getting this thing woring would be much appreciated.  The code comes from this site:

http://www.pixelhivedesign.com/tutorials/Realistic+Flash+Smoke+Effect/

He creates a movieclip called aPuff and then gives the movieclip an identifier of aPuff as well.  It seems identifiers are no longer used in CS3.

// ------------------------------------------------

// Realistic Smoke Effect - www.pixelhivedesign.com

// ------------------------------------------------

fadeSpeed = 1;    // Smoke fade speed.

floatUpSpeed = 2; // Smoke float up speed.

// Every frame attach a puff of smoke.

this.onEnterFrame = function(){

  // Get next available depth.

  d = this.getNextHighestDepth();

  // Attach a puff of smoke.

  aPuff = attachMovie('aPuff','aPuff'+d,d);

  // Set initial scale to 10%.

  aPuff._xscale = aPuff._yscale = 10;

  // Put puff where the mouse is. (add small random)

  aPuff._x = Math.random() * 5;

  // Randomizes the starting animation for realism.

  aPuff.gotoAndPlay(Math.round(Math.random()*20));

  // Smoke will animate each frame.

  aPuff.onEnterFrame = function(){

    // Scale smoke up.

    this._xscale = this._yscale += fadeSpeed;

    // Fade smoke.

    this._alpha -= fadeSpeed;

    // Smoke floating up.

    this._y  -= floatUpSpeed;

    // When smoke is 100% scale, remove it.

    if(this._xscale >= 100){

      this.removeMovieClip();

    }

  }

}


When I run this in CS3 I get a whole list of errors.  I’m super new to actionscript.

Thanks again.

This topic has been closed for replies.
Correct answer Ned Murphy

Wrong forum.  That is AS2 code, not AS3 (CS3 can work with either).  Since you say you are getting a bunch of errors, you probably have the file's Publish Settings set up for AS3.  If you change them to AS2 that code might work.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
September 7, 2009

Wrong forum.  That is AS2 code, not AS3 (CS3 can work with either).  Since you say you are getting a bunch of errors, you probably have the file's Publish Settings set up for AS3.  If you change them to AS2 that code might work.

bigowen23Author
Participant
September 7, 2009

Wow!  Thanks so much!

Ned Murphy
Legend
September 7, 2009

You're welcome.