Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-03-2007, 05:22 AM   #1
orange gold
got as?
 
Join Date: May 2007
Posts: 628
Default challenge - moving flames as

ok you have to make moving flames that look realistic glows would help that move, contest begins now, it has to be all done in actionscript
orange gold is offline   Reply With Quote
Old 06-03-2007, 06:13 AM   #2
orange gold
got as?
 
Join Date: May 2007
Posts: 628
Default ok this will help

alright this will help you its a little tool i made that will show you a grid with an alpha of 20 then when you click on it it tells you the x and y position of the point you clicked on its at http://albert.teleinc.com/tool.zip
orange gold is offline   Reply With Quote
Old 06-03-2007, 07:15 AM   #3
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,140
Default

How in the world is that supposed to help people build flames???

The point of these contest is not to just take other people's code but to challenge them with some of your own.
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
Flash Gordon is offline   Reply With Quote
Old 06-03-2007, 03:58 PM   #4
orange gold
got as?
 
Join Date: May 2007
Posts: 628
Default im not

first off thats just a tool i made to help you figure out were your line is on the x, y axis in as lineTo and stuff so we can build a realistic moving flame all done with actionscript
orange gold is offline   Reply With Quote
Old 06-22-2007, 10:51 AM   #5
babeuf
Registered User
 
Join Date: Jun 2007
Posts: 1
Default

Hi ! That s my first post here !

Here's a small fire effect using BitmapData.

It's as2 and it takes a lot of ressources

Just move your mouse over the stage (compile in 40 fps )
Code:
import flash.filters.BlurFilter; 
import flash.display.BitmapData ;

var mcBack : MovieClip = _root.createEmptyMovieClip("back",1); 
var mcFront : MovieClip = _root.createEmptyMovieClip("front",2); 

Mouse.hide() ;
var bmp : BitmapData = new BitmapData(Stage.width, Stage.height, true, 0xFF000000) ;
var b = new BlurFilter(6,6,2);
mcBack.attachBitmap(bmp,1);
mcBack.filters = [b] ;
mcFront.lineStyle(10,0xFFFF6600) ;
mcFront.moveTo(0,0) ;
mcFront.lineTo(.5,.5);
mcFront.filters = [b] ;	

_root.onEnterFrame = function()
{	
	bmp.draw(_root);
	bmp.scroll(0,-4);
	mcFront._x =_root._xmouse ;
	mcFront._y = _root._ymouse;
}
babeuf is offline   Reply With Quote
Old 06-23-2007, 02:22 PM   #6
Stu
Registered User
 
Join Date: Mar 2005
Posts: 106
Default

Hi babeuf, and welcome.

Nice flame - I borrowed the basic principle and put it into AS3, seems to be a little less processor hungry.

(I'm sure my code could do with some work though - this is the first time I have played with AS3..)

ActionScript Code:
// flame colours var outer_col:uint = 0xFF6600; var inner_col:uint = 0xFFFF00; // arrays to hold our flame parts var outer_flame:Array = new Array(); var inner_flame:Array = new Array(); var circle:Sprite; // setup blur to apply to flame elements var blur:BlurFilter = new BlurFilter(30,30,2); // paint the background black this.graphics.beginFill(0x000000); this.graphics.drawRect(0,0,550,400); // create flames and draw dodgy looking candle addFlameParts(outer_flame, outer_col, 275, 250, 40); drawCandle(); addFlameParts(inner_flame, inner_col, 275, 270, 20); // create a timer to call the update function var timer:Timer = new Timer(80); timer.addEventListener("timer", updateFlame); timer.start(); // populate the flame arrays function addFlameParts(holder_array:Array, flame_col:uint, xpos:int, ypos:int, diameter:uint):void {     for (var i:Number=0; i<20; i++) {         circle = new Sprite();         circle.graphics.beginFill(flame_col);         circle.graphics.drawCircle(xpos, ypos-(i*15), diameter);         circle.filters = [blur]         holder_array.push(circle);         addChild(circle);         diameter -= (diameter/10);     } } // update the flame function updateFlame(t_evt:TimerEvent):void {     var offset:Number;     for(var i:Number=0; i<outer_flame.length; i++) {         offset = (Math.random()*6)-3;         Sprite(outer_flame[i]).x = offset;         Sprite(inner_flame[i]).x = offset;     } } // dodgy looking candle function drawCandle():void {     // candle     this.graphics.beginFill(0xF8FEBC)     this.graphics.drawRect(175, 315, 200, 85);     this.graphics.beginFill(0xF8FEBC);     this.graphics.lineStyle(1, 0xF1FD82);     this.graphics.drawEllipse(175, 290, 200, 50);     // wick     this.graphics.lineStyle(6, 0x6D6D01, 1, false, "normal", null, null, 3);     this.graphics.moveTo(275, 225);     this.graphics.lineTo(275, 315); }

Stu
Attached Files
File Type: zip flame_1.zip (10.6 KB, 579 views)

Last edited by Stu; 06-25-2007 at 09:03 AM. Reason: Added .fla (cs3) and .swf (flash9)
Stu is offline   Reply With Quote
Old 07-02-2007, 04:00 AM   #7
orange gold
got as?
 
Join Date: May 2007
Posts: 628
Default ok

ok so we have ...
now can we make "mcFront.lineStyle" blend from 0xFFFF6600 to 0xFF66FF00 to 0x0066FF slowly?

ActionScript Code:
import flash.filters.BlurFilter; import flash.display.BitmapData ; var mcBack : MovieClip = _root.createEmptyMovieClip("back",1); var mcFront : MovieClip = _root.createEmptyMovieClip("front",2); Mouse.hide() ; var bmp : BitmapData = new BitmapData(Stage.width, Stage.height, true, 0xFF000000) ; var b = new BlurFilter(6,6,2); mcBack.attachBitmap(bmp,1); mcBack.filters = [b] ; mcFront.lineStyle(10,0xFFFF6600) ; mcFront.moveTo(0,0) ; mcFront.lineTo(.5,.5); mcFront.filters = [b]_root.onEnterFrame = function() {        bmp.draw(_root);     bmp.scroll(0,-4);     mcFront._x =_root._xmouse ;     mcFront._y = _root._ymouse; }

now can we make "mcFront.lineStyle" blend from 0xFFFF6600 to 0xFF66FF00 to 0x0066FF slowly?

Last edited by orange gold; 07-02-2007 at 04:03 AM.
orange gold is offline   Reply With Quote
Old 07-04-2007, 02:57 AM   #8
orange gold
got as?
 
Join Date: May 2007
Posts: 628
Default ok

ok here is what i have so far its good
ActionScript Code:
stop(); import flash.filters.BlurFilter; import flash.display.BitmapData ; var mcBack : MovieClip = _root.createEmptyMovieClip("back",1); var mcFront : MovieClip = _root.createEmptyMovieClip("front",2); Mouse.hide() ; var bmp : BitmapData = new BitmapData(Stage.width, Stage.height, true, 0xFF000000) ; var b = new BlurFilter(6,6,2); mcBack.attachBitmap(bmp,1); mcBack.filters = [b] ; mcFront.lineStyle(10,0xFFFF6600) ; mcFront.moveTo(0,0) ; mcFront.lineTo(.5,.5); mcFront.filters = [b] ; _root.onEnterFrame = function() {        bmp.draw(_root);     bmp.scroll(0,-4);     mcFront._x =_root._xmouse ;     mcFront._y = _root._ymouse; } _root.onMouseDown = function() { mcBack.attachBitmap(bmp,1); mcBack.filters = [b] ; mcFront.lineStyle(10,0xFF66FF00) ; mcFront.moveTo(0,0) ; mcFront.lineTo(.5,.5); mcFront.filters = [b] ; _root.onEnterFrame = function() {        bmp.draw(_root);     bmp.scroll(0,-4);     mcFront._x =_root._xmouse ;     mcFront._y = _root._ymouse; } _root.onMouseDown = function() { mcBack.attachBitmap(bmp,1); mcBack.filters = [b] ; mcFront.lineStyle(10,0xFF0066FF) ; mcFront.moveTo(0,0) ; mcFront.lineTo(.5,.5); mcFront.filters = [b] ; _root.onEnterFrame = function() {        bmp.draw(_root);     bmp.scroll(0,-4);     mcFront._x =_root._xmouse ;     mcFront._y = _root._ymouse; }     }     } trace ("left click for more colors") /******** add in mcBack.onEnterFrame = function() {     this._alpha = this._alpha - 0.0005; } for a cool effect too *********/
orange gold is offline   Reply With Quote
Old 07-06-2007, 07:37 PM   #9
mattkenefick
Chief Breaks-many-phones
 
Join Date: Jun 2007
Location: new york city
Posts: 527
Default

Here's something to make it jitter a little. Can be worked on to make look better.. but adds a little realism.

Code:
stop();
import flash.filters.BlurFilter; 
import flash.display.BitmapData ;

var mcBack : MovieClip = _root.createEmptyMovieClip("back",1); 
var mcFront : MovieClip = _root.createEmptyMovieClip("front",2);

Mouse.hide() ;
var bmp:BitmapData = new BitmapData(Stage.width, Stage.height, true, 0xF0F0F00) ;

var c1=6,c2=6,c3=2;

var b = new BlurFilter(c1,c2,c3);

mcBack.attachBitmap(bmp,1);
mcBack.filters = [b] ;
mcFront.lineStyle(10,0xFFFF6600) ;
mcFront.moveTo(0,0) ;
mcFront.lineTo(.2,1);
mcFront.filters = [b] ; 


_root.onEnterFrame = function()
{   
	b = new BlurFilter(rand(1,8),6,c3);
	mcFront.filters=[b]

    bmp.draw(_root);
    bmp.scroll(rand(-2,2),-4);
	
    mcFront._x =_root._xmouse ;
    mcFront._y = _root._ymouse;
	
}



function rand(low, high){
	return Math.floor(Math.random() * (high -  low)) + low
}
mattkenefick is offline   Reply With Quote
Old 07-07-2007, 06:18 AM   #10
orange gold
got as?
 
Join Date: May 2007
Posts: 628
Default ood job

good work it looks real good in fps 40
orange gold is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
i love this song.... boyzdynasty General Chat 3273 05-05-2008 11:33 PM
Challenge - 3D Moving Cube onasiam Just for Kicks Challenges 14 10-16-2006 09:59 AM
moving xml node references like array references? (moving reference, not node) fishmonger ActionScript 2.0 7 09-13-2005 08:12 PM
just for kicks challenge challenge junahu Just for Kicks Challenges 90 03-29-2004 06:19 AM
How to start a Challenge Jesse Just for Kicks Challenges 0 05-17-2003 01:29 AM


All times are GMT. The time now is 09:08 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.