|
The following is my code.
It creates swf file and I see that it is big enough (1.7MB) so I assume it incluse all the frames, but I see only the first frame.
void exportToFlash(HWND hwnd)
{
CString Path, Path1;
// Set movie params
POINT_F pt;
int cx=screen_cx;
int cy=screen_cy;
SIZE_F movieSize = {cx, cy};
int frameRate = 40;
// Create empty .SWF file
CSWFMovie swfMovie;
Path=STRING LogPath;
Path.Replace(".isu",".swf");
char *path=addDataFolder(STRING Path,Path1);
swfMovie.OpenSWFFile(path, movieSize, frameRate);
path=addDataFolder("Data\\Temp.jpg",Path1);
SWF_RGB bgColor = {0xf, 0xf, 0xf};
swfMovie.SetBackgroundColor(bgColor);
float bmp_width = 800.0f; float bmp_height = 533.0f;
// Define shapes
RECT_F shapeRect = {0.0f, 0.0f, 200.0f, 120.0f};
SWF_RGBA lineColor = {0, 0, 0, 255};
RECT_F bitmapRect = {0.0f, 0.0f, bmp_width, bmp_height}; // size of the bitmap
//RECT_F clipRect = shapeRect; // fill the full rectangle
for (int i=0; i
|
|
|
|
|
Hello,
thanks for the interest...
The reason for thew error is the following:
- the ID for each object must be unique
Regards,
Darkoman
"Avaritia est radix omnium malorum..."
|
|
|
|
|
Thank for the SWFLib !
I want to add an action context(action script) to a sprite.
How can I add the action context?
Is it possible?
------
Welcome!
|
|
|
|
|
Hello...
Thanks for the interest in the SWFLIB project.
Unfortunately, the action script is not supported in this release.
Best regards,
Darkoman
|
|
|
|
|
Thanks for your reply...
SWFLIB is very good library.
I need to add action script to flash.
Have you any plan or program architecture on the action script?
And, can I know that?
---
Welcome!
|
|
|
|
|
Hello,
in order to add action script to this library you'll have to follow the official Macromedia (now Adobe) SWF File Format Specification. I have to little time now to implement this but I will prepare this update for the future releases. I am sorry, but I have no specific plan to add ActionScript support for now.
Best regards,
Darkoman
|
|
|
|
|
Thanks for your reply...
Is that possible to add the action script on the flash ver. 3.0 ?
---
Welcome!
|
|
|
|
|
Hello,
the ActionScript of the Flash version 3.0 is already supported. Please see the programmers manual for the details in the downloads section of this article. These actions can be applied to either button object, the sprite object or to the main movie object.
Best regards,
Darkoman
|
|
|
|
|
|
Hello,
Just to make it clear:
- SWFLIB in its current release supports flash version 3.0 action model (simple tag-action model)
- flash version 4.0 extends this approach to stack-based tag-action model
- only flash version 5.0 and above extends this functionality to "JavaScript like" action model.
I am not able to do the action model upgrade in the SWFLIB in close future (I work on other projects). I will however inform you when this update is ready. I am very sorry for this delay...
Best regards,
Darkoman
|
|
|
|
|
|
thanks for this work, I have 2 questions:
1. the PDF doc says support for v4 is forthcoming; any ETA? progress? status?
2. i want to put some flash animations i make, using your SWFlib, on my web page; would you like a credit? if so, what would you like? (e.g., link to this page? your name? etc.)
|
|
|
|
|
Hello, thanks for your comments...
1. Yes, actually I have done some work but I didn't find an extra time to update an article and the library guide. You will for sure need an updated version of this SWF library (with no bugs), so I'll try to post it in the next few days.
2. The link to the site would be enough. Thank you very much...
Best regards,
Darkoman
|
|
|
|
|
fwiw, http://home.earthlink.net/~amacginitie
...don't expect anything fancy, though!
|
|
|
|
|
Hello,
I have seen your work.
It's more then fancy... I like it!
Thanks again for your interest for SWFLIB project.
Best regards,
Darkoman
|
|
|
|
|
Hi all,
If anyone has used this file to create a bitmap (jpeg) animation, maybe you can help me. I have two jpegs and I want to create a 2 frame animation. I follow the authors instructions and the first frame turns out correct (except for image is flipped).
However, in the second frame the bitmap is not updated. A second frame IS being produced because if I move the rectangle shape that shows up in the animation, but the image filling the rectangle remains the same. I have followed the authors instructions and order but I can't find where I'm going wrong. I've tried using the same shape, updating the shape, using arrays of bitmaps etc, but have been unable to have the 2nd image appear on the 2nd frame.
Any help would be appreciated.
Regards,
Stephen Faul
Here follows the code used....
SIZE_F movie_size = {200.0f, 120.0f};<br />
int framerate = 1;<br />
POINT_F pt;<br />
CSWFMovie m_SWFMovie;<br />
<br />
m_SWFMovie.OpenSWFFile("C:\\TEMP\\SWFTest.swf", movie_size, framerate);<br />
SWF_RGB bgColor = {255, 0, 0};<br />
m_SWFMovie.SetBackgroundColor(bgColor);<br />
<br />
float bmp_width = 800.0f; float bmp_height = 533.0f;<br />
<br />
RECT_F shapeRect = {0.0f, 0.0f, 200.0f, 120.0f};<br />
SWF_RGBA lineColor = {0, 0, 0, 255};<br />
RECT_F bitmapRect = {0.0f, 0.0f, bmp_width, bmp_height};
RECT_F clipRect = shapeRect;
<br />
<br />
<br />
<br />
CSWFBitmap bmp(1, "C:\\TEMP\\ron40002.jpg");<br />
m_SWFMovie.DefineObject(&bmp, -1, false);<br />
<br />
CSWFShape shape(3, shapeRect, 1);<br />
shape.AddLineStyle(3, lineColor);<br />
shape.AddBitmapFillStyle(bmp.m_ID, SWF_FILLSTYLETYPE_BITMAP_0, bitmapRect, clipRect);<br />
<br />
pt.x = 0;<br />
pt.y = 0;<br />
shape.ChangeStyle(1, 1, 0, &pt);<br />
<br />
shape.AddLineSegment(200, 0);<br />
shape.AddLineSegment(0, 120);<br />
shape.AddLineSegment(-200, 0);<br />
shape.AddLineSegment(0, -120);<br />
m_SWFMovie.DefineObject(&shape, shape.m_ID, true);<br />
<br />
m_SWFMovie.ShowFrame();<br />
<br />
<br />
<br />
<br />
<br />
CSWFBitmap bmp2(2, "C:\\TEMP\\ron40006.jpg");<br />
m_SWFMovie.DefineObject(&bmp2, -1, false);<br />
<br />
CSWFShape shape2(4, shapeRect, 1);<br />
shape.AddLineStyle(3, lineColor);<br />
shape.AddBitmapFillStyle(bmp2.m_ID, SWF_FILLSTYLETYPE_BITMAP_0, bitmapRect, clipRect);<br />
<br />
pt.x = 0;<br />
pt.y = 0;<br />
shape2.ChangeStyle(1, 1, 0, &pt);<br />
<br />
shape2.AddLineSegment(200, 0);<br />
shape2.AddLineSegment(0, 120);<br />
shape2.AddLineSegment(-200, 0);<br />
shape2.AddLineSegment(0, -120);<br />
m_SWFMovie.DefineObject(&shape2, shape2.m_ID, true);<br />
<br />
m_SWFMovie.ShowFrame();<br />
<br />
m_SWFMovie.CloseSWFFile();<br />
|
|
|
|
|
I also have this problem.
It maybe can't DefineObject for shape twice.
|
|
|
|
|
Hello,
The following lines are wrong:
// Define the rectangle shape
CSWFShape shape2(4, shapeRect, 1);
shape.AddLineStyle(3, lineColor);
shape.AddBitmapFillStyle(bmp2.m_ID, SWF_FILLSTYLETYPE_BITMAP_0, bitmapRect, clipRect);
should be:
// Define the rectangle shape
CSWFShape shape2(4, shapeRect, 1);
shape2.AddLineStyle(3, lineColor);
shape2.AddBitmapFillStyle(bmp2.m_ID, SWF_FILLSTYLETYPE_BITMAP_0, bitmapRect, clipRect);
Regards,
Darkoman
"Avaritia est radix omnium malorum..."
|
|
|
|
|
Overall very good work but docs lack some info on parameters, doxygen ?
I frequently have to debug test set digging in methods to understand details, getting SWF at hand. A key part to help doc, explain reference system. Otherwise anybody MUST read SWF doc before.
Ok I stop complaining, If I still look at it it's because it's pretty!
A Major issue for me, new version more difficult to handle than last one, already touchy.
If I try to use Scale() on a shape filled with a bitmap(not tryed on other kinds), strange comportement happens.
From 0 to nearly 1 I get a scaled pictured (ok), but anything over 1?0 give a small line on the edge (looks the shape outline) that scale inverted. A bits overflow ?
In testProject
void CSWFLIBTestProjectDlg::CreateSWFMovie_Bitmap()
..
Try replacing
swfMovie.DefineObject(&shape, shape.m_Depth, true);
swfMovie.ShowFrame();
By
swfMovie.DefineObject(&shape, shape.m_Depth, true);
shape.Scale(0.2f, 0.2f);
swfMovie.UpdateObject(&shape, shape.m_Depth, NULL, -1);
swfMovie.ShowFrame();
shape.Scale(0.5f, 0.5f);
swfMovie.UpdateObject(&shape, shape.m_Depth, NULL, -1);
swfMovie.ShowFrame();
shape.Scale(1.0f, 1.0f);
swfMovie.UpdateObject(&shape, shape.m_Depth, NULL, -1);
swfMovie.ShowFrame();
shape.Scale(2.0f, 2.0f);
swfMovie.UpdateObject(&shape, shape.m_Depth, NULL, -1);
swfMovie.ShowFrame();
And run it. (better reduce frame rate to 2!), only the first 2 "Scale" will do something sensible, why ?
A)
- What's wrong with this code ?
- Is Scale() limited ? (doesn't look when digging first level of the code) or a wrap up when converting from 16.16 ?
B) Why is ratio = -1 (I guessed because it's of no use if not between 2 morphedshape) ?
c) Sample in reference need some adpation to care about default value looks like there was previous verson with default in def. right ? wrong ? (ratio is one of them)
Anyway many thanks.
Gordon
|
|
|
|
|
Hello and thank you very much for your interest in SWFLIB.
The SWFLIB project is in its early development state so I am not supprized the many new bugs come out as users try to use it in their solutions.
Therefore, I will ask you for a patience until a new version is released and all known bugs are repaired.
Right now, I am finishing a text support in SWFLIB.
Best regards,
Darko
|
|
|
|
|
in void CSWFMatrix::SetMatrix(MATRIX_F matrix)
To get number of bits needed to encode value you use
while (pow(2, rotateSkewBitsNeaded) < maxValue)<br />
rotateSkewBitsNeaded++;<br />
rotateSkewBitsNeaded += 17;
But it does a implicit casting to compare a double with and int and doesn't always give enough bits
may work with <=,
Theoretically the direct math give
scaleBitsNeaded = (u_int)ceil(log10((double)maxValue)/log10(2))
It did worked too but I suspect that it take a lot more CPU time to get it than a while loop (and avoid caring about rounding)
So I change it to final
while ((0x1 << scaleBitsNeaded) <= maxValue) {<br />
scaleBitsNeaded++;<br />
}<br />
scaleBitsNeaded += 17;
Sucessfully for scale between 1.0 and 2.0 (failed previously) and even faster than the double pow().
and extend that to others bits sizing.
Looks good to me and better be part of the code, or do I miss something ?
Gordon
|
|
|
|
|
Just like follow as:
....<br />
CSWFBitmap *bitmap[2];<br />
bitmap[0]=new CSWFBitmap(10, (UCHAR*)"bm128.jpg");<br />
bitmap[1]=new CSWFBitmap(11, (UCHAR*)"1.jpg");<br />
<br />
swfMovie.DefineObject(bitmap[0],10, false);<br />
swfMovie.DefineObject(bitmap[1],11,false);<br />
CSWFShape *shapex[2];<br />
shapex[0]=new CSWFShape(20,shapeRect,20);<br />
shapex[1]=new CSWFShape(21,shapeRect,21);<br />
for (int i=0;i<2;i++)<br />
{<br />
shapex[i]->AddLineStyle(3, lineColor);<br />
shapex[i]->AddBitmapFillStyle(bitmap[i]->m_ID, SWF_FILLSTYLETYPE_BITMAP_0, bitmapRect, clipRect); <br />
swfMovie.DefineObject(shapex[i], shapex[i]->m_Depth,true); <br />
shapex[i]->Translate(i*200,100);<br />
swfMovie.UpdateObject(shapex[i],i,NULL,-1); <br />
swfMovie.ShowFrame();<br />
}<br />
....<br />
It can't work correctly.And the movie is blank.
My aim is show 2 jpeg in the movies.but i was failed in evidence~~~
How to do??
No pain no gain!
|
|
|
|
|
Hello...
1. When you define the CSWFBitmap object there is no need to define its depth value in the DefineObject() method call.
2. Before you do any shape definition (like in the loop) you'll have to DRAW your shape object line by line (or curve by curve). I don't see that in your code. If it is, ie. a rectangle, then just draw the rectangle with four basic calls of AddLineSegment() method.
Other things should be OK but you could have a flickering of the second bitmap object since you add it in the second keyframe.
Best regards...
|
|
|
|
|
Please check the code for type probelms.
For instance
int maxValue = __max(abs(m_SWFMatrix.TranslateX), abs(m_SWFMatrix.TranslateY));
You are asking for the abs of an unsigned value.
|
|
|
|
|
Why do you feel that your package is better than some of the open source sdk's on the web? They are almost up to Flash v7 features. I would have thought that it would be better to concentrate efforts in one direction, but maybe I am missing the benefits of your code.
|
|
|
|
|