Smoke in Flash – AS3 Tutorial

// February 10th, 2009 // Flash - AS3

OK! Here is my 2nd small tutorial for this week. Actually don’t know if this can be called a tutorial, since I don’t really give step-by-stem instructions on how to mek it, but I do give the code and it is well commented. Below are some examples of the smoke.[kml_flashembed fversion="9.1.0" movie="http://sf-zone.net/wp-content/uploads/2009/02/white_smoke.swf" targetclass="flashmovie" publishmethod="static" width="400" height="259"]Get Adobe Flash player
[/kml_flashembed]
Also, it is very easy to change the color of the smoke. Just edit the image in Photoshop and import it back into flash.

Below is an example with a different color.
[kml_flashembed fversion="9.1.0" movie="http://sf-zone.net/wp-content/uploads/2009/02/turquaz_smoke.swf" targetclass="flashmovie" publishmethod="static" width="400" height="250"]

Get Adobe Flash player

[/kml_flashembed]
Remember to get the source file. It includes examples of different colors: white, black, red, turquoise and violet.download_fla

5 Responses to “Smoke in Flash – AS3 Tutorial”

  1. chuck says:

    your file works great, but when I open a new file and paste library iytems and script, i get these errors;

    1046: Type was not found or was not a compile-time constant: smoke.

    1180: Call to a possibly undefined method smoke.

    I am a newbie moron….can you help?

  2. Admin says:

    Make sure that your items are exported for actionscript after they have been pasted.
    But I don’t want my files to be just pasted in other projects. I made them for your to learn and understand. I strongly recommend you look over my files, examine the code and understand it. If you just copy->paste the everything you will not learn actionscript.

  3. chuck says:

    My goal is to become fluent in AS, I just got the books and program in Dec and am attempting to self teach. I am using what code I can find such as yours to study and learn as you suggest. The copy and paste is an exercise to help me understand the differences between your files and one I create. I am not a thief and I genuinely appreciate when people such as yourself make this stuff available to others.

    Regards

  4. michael says:

    Love the smoke effect. Would like to use it for smoke coming out of a warehouse chimney. I am still learning action script 3, but feel like I am starting to catch on to the real power it has.

    I am pretty sure that to make this happen I need to re-work these two lines. Can you give me some help as to how I would do that so i can just drop instances of the smoke on the stage?

    smokeElement.x=mouseX;
    smokeElement.y=mouseY;

    Thanks in advance for your consideration.

    Michael

  5. Admin says:

    You can’t just “drop” the instance of the smoke on the stage using your mouse. But you can make the smoke come out from what ever place you want. currently it comes out from where your mouse is. That is shy you have mouseX and mouseY as the starting position of every smoke element. Just change these two to the value of your chimney. You will have something like this:
    smokeElement.x=150;
    smokeElement.y=200;

    Hope this helps. Feel free to email me if you have any questions.

Leave a Reply

You must be logged in to post a comment.