Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
-
- CommentAuthorBourkster
- CommentTimeAug 20th 2008 edited
Hey there guys,
I was able to transfer the FireAndSmoke example into a a movieclip in a flash document without a need for the external .as document. Although the fire works perfectly fine, the smoke has issues.
http://www.megaupload.com/?d=9FZ6NK9U (.fla source)
As seen in this source, Symbol 2 (the smoke) is placed up in the corner, this is to place it in the correct spot. If you open up the movie clip and go to the AS tab, and modify the coordinates to x,0 y,0; and then place the clip somewhere on the stage, you will notice that the smoke emits from a small area and is cut off by what seems to be the corner of a box.
Is there anyway around this issue, as having the smoke off center is troublesome and untidy.
Thanks guys! -
- CommentAuthorRichard
- CommentTimeAug 20th 2008
Hi
The particle space will always be drawn with coordinate 0,0 at the registration point of the renderer (this is true of all the renderers). You can move the renderer (set smokeRenderer.x and smokeRenderer.y) but I don't think that what you're after so lets assume we leave the renderer where it is (as you have done) - then the renderer's 0,0 is at the same location as the movie clip container's 0,0.
The emitter can be placed anywhere. That is what your code does withsmoke.x = 200;
smoke.y = 400;
The result of this is that the smoke emitter is 200 pixels to the right and 400 pixels down from the registration point of the renderer, which is why it's offset from the registration point of the movie clip. You are right in thinking the answer is to set this to (you could also leave them out altogether - the default values are 0)smoke.x = 0;
smoke.y = 0;
but this is only part of the solution.
The smoke effect uses a BitmapRenderer which, unlike the DisplayObjectRenderer, draws just a limited region of the particle space. This region, which I call the canvas, is defined by the rectangle that is passed in to the Renderer's constructor. The canvas defined in your code isnew Rectangle( 0, 0, 800, 800 )
which is a rectangle 800 pixels wide and 800 pixels tall with the top left corner at 0,0. Because the smoke originates at 0,0 and moves upwards and to the left and right, most of the smoke effect will fall outside this canvas and so will not be drawn.You need a canvas with space above the 0,0 point, and to the left as well as the right of it. Something likenew Rectangle( -100, -300, 200, 350 )
which is a rectangle 200 pixels wide and 350 pixels tall, with its top left corner at -100, -300. The emitter, which is at 0,0, is horizontally in the middle of this canvas, and vertically near the bottom, which means there's room for the smoke effect to be displayed within this canvas.
N.B. Always make the canvas as small as you can while displaying all of the effect - a smaller canvas means the effect will run faster. -
- CommentAuthorBourkster
- CommentTimeAug 21st 2008
Thanks for this! Very helpful.
1 to 3 of 3
