November 8, 2007 at 1:12 am
· Filed under AS3, Benchmark, BitmapData, Graphics, Performance
Firstly… sorry for my poor English…
Working on Recyou.jp, I had to use many BitmapDatas, and so, I had to work out some way to make it lighter.
One thing I realized is that using Graphics.beginBitmapFill besides BitmapData.draw its much faster.
I made the benchmarks, drawing 10000 bitmapDatas, one using BitmapData.draw, and other using Graphics.beginBitmapFill.
First the benchmark with BitmapData.draw (Clicking on the flash it will re-run the benchmark):
The code is something like this:
var genericBmp:BitmapData = new BitmapData(100,100, false, 0×000000);
var bmp:BitmapData = new BitmapData(100,100, false, 0×000000);
for(var i = 0; i < 10000; i++){
bmp.draw(genericBmp);
}
Now the benchmark with Graphics.beginBitmapFill (Clicking on the flash it will re-run the benchmark):
The code is something like this:
var genericBmp:BitmapData = new BitmapData(100,100, false, 0×000000);
var bmp:BitmapData = new BitmapData(100,100, false, 0×000000);
for(var i = 0; i < 10000; i++){
graphics.beginBitmapFill(genericBmp);
graphics.drawRect(0,0,100,100);
}
So, if you are trying to create some bitmap pattens or attaching a Bitmap child and redrawing it’s BitmapData, try using the Graphics.beginBitmapFill.
Permalink
October 24, 2007 at 8:46 am
· Filed under AS3, BitmapData, Regexp, source
One think that I am really thankful is the addition of Regular Expression in AS3.
That’s really helping me around.
Here’s some cheatsheets that I always check:
http://krijnhoetmer.nl/stuff/regex/cheat-sheet/
http://regexlib.com/CheatSheet.aspx
http://www.ilovejackdaniels.com/cheat-sheets/regular-expressions-cheat-sheet/
Also, I uploaded my svn my StringUtils class
http://code.hellokeita.in/public/trunk/as3/br/hellokeita/utils/StringUtils.as
Actually, there’s just the trim method, but you see that’s it’s really easier than AS2.
\s|\n|\r|\t|\v <- I put all those characters to make sure every initial end final whitespace are trimmed.
Also, I uploaded my ColorUtils.as too.
You see that it's really easy to manage ARGB colors with it.
Also, there's a RGB -> Grayscale color converter.
Oh, don’t try converting a bitmapData pixel by pixel to generate a Grayscale image.
There’s an easier way to make it with the BitmapData.paletteMap() method.
but… I’ll keep it to the next post …. if anyone shows any interest.
Permalink
October 24, 2007 at 3:32 am
· Filed under AS3, AVM1, AVM2, Performance, source
http://code.hellokeita.in/public/
People, I’m launching my codes on public subversion repository.
It’s almost nothing there… but, how people claimed for the source (here), there is it.
Hope you enjoy it…
PS: If there’s any bug or anything I forgot, apologize me… I still don’t get much time to review my codes…
Permalink
October 18, 2007 at 8:06 pm
· Filed under AS3, Links, Papervision3d
Finally, a release.
http://www.recyou.jp
It’s not my first work here in Japan, but I assume it’s my debut project.
It’s a website for the new Sony walkman. People here in Japan uses the word Oneseg(One segment) for devices that have multi-uses.
Actually, I don’t know what this walkman is capable, but it looks like a walkman that you can watch tv broadcasts and record it.
The flash stills a little heavy processing, actually I didn’t have much time to improve it.
I’m using Papervision3D on the ‘G’ Grid Mode. Actually I made plenty of examples… maybe we will update with new Papervision3D views.
Clicking on ‘S’, you can upload you picture and than the magic does the rest, and your picture will show up singing. And also, if approved, your singing picture will be broadcasted on Japanese TV.
Anyway, enjoy it.
Permalink
October 16, 2007 at 4:38 pm
· Filed under AS3, ExternalInterface
I experienced a problem calling ExternalInterface.call when using SWFObject on IE.
Actually, I figured out that it wasn’t any bug. Just a little miss.
On IE, the Flash looks for the Flash Object by the Object’s ID.
So, what you need to do is just set the right name and id of the flash object you are embedding
swfobject.embedSWF(“myflash.swf”, “flash_content”, “100%”, “100%”, “9.0.0″, “expressInstall.swf”, undefined, undefined, {id:“flashMovie”, name: “flashMovie”});
Just that!
I hope it helps someone that experienced the same problem.
Permalink
October 15, 2007 at 4:36 pm
· Filed under AS3, AVM1, AVM2
I’ve been working on a project that needs to load FFmpeg generated SWF.
FFmpeg generates Flash 6 SWF. And there I got the problem, because AS3 can’t control AVM1 movies.
I googled and I found this AVM2Loader Class from Fladdict.
Simply talking, it loads the SWF and rewrites the necessary bytes to convert it to AVM2.
But, the problem was that this class just converts Flash 8 compiled AVM1.
So, I restarted my research.
Tried with Localconnection, but I got some delay on it’s response.
So I used ExternalInterface, and so far, it was working fine, until some guy tested on Safari 3 and got some slow script error.
Huh of course… I was loading douzens of avm1, everyone calling ExternalInterface on EnterFrame.
Thanks to google, I found the ultimate solution.
I found this other class ForcibeLoader that really converts any SWF versions to AVM2.
I rewrote this class for an easier syntax, but… I’ll be posting it when I get my svn and some kind of trac system ready.
So… thanks for all those byte eaters.
Permalink
October 7, 2007 at 7:18 pm
· Filed under AS3, BitmapData, Performance
I’m working on a project that everything eats performance, using FLV videos, animated smooth Bitmaps, Papervision3D and everything else…
So I started desperately find a way to increase the flash performance.
So, I realized that using BitmapDatas instead using many sprites and FLV videos helped really much.
I mean, instead adding a full screen FLV streaming video on your background, add a Bitmap child on your background that draws the FLV child.
I didn’t make any benchmarks, but, at least on this project it’s helping me speeding up my heavy processing flash.
Permalink
September 20, 2007 at 11:48 pm
· Filed under AS3
I just created a class to animate texts in AS3. Animations such as group94 or yugop
I’m using Robert Penner’s easing equations, so it’s really easy to customize the animations.
Here’s an example.
TextAnimation.animate(“Welcome to labs.hellokeita.com”, “Welcome to labs.hellokeita.com”, {
textField: tField,
textFormat: tFormat,
step: 4,
time: 3,
delay: 1,
characters: “0123456789-#”,
transition: “easeInOutCubic”
});
So, as you see, I can set the transition equation, time and delay, also the random character set that will be used.
The Step
parameter is the number of times that the random character will appear before it shows the right character.
You can also use HTML font tags and /n NewLine Characters as bellow.
TextAnimation.animate(“Welcome to <font color=”#0000ff">labs.hellokeita.com</font>", "Welcome to <font color="#0000ff">labs.hellokeita.com</font>", {
textField: tField,
step: 4,
time: 3,
delay: 1,
characters: “0123456789-#”,
transition: “easeInOutCubic”
});
The coding is a little dirty, but I think it’s pretty good for a couple hour work.
Permalink