MovieClip.curveTo() drawing bug

May 15th, 2007 § 1 comment § permalink

I’ve recently encountered drawing glitches in MovieClip.curveTo() when using a thick pen.

In the following demo, drag the little circle handle left and right. The text box updates to display the “X” value of the handle.

This movie requires Flash Player 9

The black line is a curve drawn with a one-pixel thick lineStyle. The green line is the same curve drawn with a 30-pixel thick line (the bug shows up with thinner line widths, too, but I used a very wide line for illustration purposes).

When the handle is close to the left (values of around 20 or less), look at what happens to the apex of the curve. It goes all wacky!

For additional fun, click the “toggle full screen redraw” button. This hides or shows a rectangle with an alpha of 10% covering the whole stage. When it’s visible, it forces the Flash player to redraw the entire stage every frame. When it’s hidden, you’ll see that the Flash player incorrectly calculates the redraw area, and you’ll get weird cruft left behind as you drag the handle around (actually, I’ll bet that the Flash player calculates the redraw area “correctly,” i.e. what the damaged area would be were it not for the wacky curve apex drawing).

I wish there was a way to work around this. It looks like I’m going to have to break out the algorithm books and draw thick bezier curves myself.

Source FLA file available here.

PS. So far I’ve only tested this on Windows. Let me know if you get the same thing happening on other platforms?

PPS. Note to self: I’ll also put up a Flash 7 and/or 6 version to test with the Wii and the PlayStation 3.

UPDATE: Just tried it on Mac OS X. Same results. I imagine this doesn’t vary by platform.

JSFL in Flash CS3

May 9th, 2007 § 2 comments § permalink

I still don’t have Flash CS3, but I was wondering what was changed in JSFL in the new release. The info is on livedocs. Alas, as far as I can tell, there is no event or anything sent when the selection changes, which would be a great help. Oh well. Maybe in the next version? :P

Blogging FITC

April 23rd, 2007 § Comments Off on Blogging FITC § permalink

…that is to say, I feel I should be blogging it, but I haven’t so far :P

Right now I need to sleep. Perhaps tomorrow I will at least jot down a handful of short notes on it.

FITC!

April 17th, 2007 § Comments Off on FITC! § permalink

I’m going to FITC this year! I’ve thought of going before, especially since I’ve lived in Toronto for the last four years, but I didn’t have the means. I’m pretty excited.

If anyone reading this is going and wants to meet, let me know :D

Adobe CS3!

March 29th, 2007 § Comments Off on Adobe CS3! § permalink

On Tuesday, Adobe announced the launch of Adobe Creative Suite 3. There are a whole bunch of “editions”. Now I have to figure out which one to get.

All of the premium editions include the three apps I absolutely need: Flash Professional, Photoshop Extended, and Illustrator. At first I was thinking of just getting the Web Premium Edition, which also includes Dreamweaver, Fireworks, Contribute and Acrobat, but I hand-code all my sites, and so far haven’t had a need for Acrobat. Fireworks might be useful? I’ve never really used it.

The Design Premium Edition is more print-oriented, it seems, as it includes InDesign. I don’t foresee any move to print for me at this point. But it’s the Production Premium Edition that could be more interesting, as it includes After Effects, Premiere Pro and Soundbooth. I currently don’t do any video, either, but it is something that I could see myself doing more of in the near future.

Of course I could spring for the Master Collection, which includes everything, but the price of that is significantly higher!

Decisions, decisions…

coComment

March 26th, 2007 § 1 comment § permalink

I’m trying out the coComment plugin for WordPress. I like the idea of coComment, but whenever I’ve used it I’ve gotten confused…

Looking at Flash Lite

March 22nd, 2007 § 2 comments § permalink

I recently bought a new cellphone, and it turns out that it supports Flash Lite 1.1. I thought I’d try it out– I’ve developed for cellphones before, using J2ME and BREW, but using Flash for mobile development seems much more appealing.

Alas, Flash Lite 1.x uses a very old form of ActionScript, one that I’d never used before. Things that are missing: Complex objects. User-defined functions. Arrays!!

Maybe I should have picked up a Flash Lite 2 phone! Oh well, it’s still worth looking at…

A (probably obvious) FLV playback gotcha

March 18th, 2007 § Comments Off on A (probably obvious) FLV playback gotcha § permalink

So I’ve been learning how to play back FLVs with ActionScript. It’s pretty simple, but my first tests weren’t working. I spent some time scratching my head, because my test was a simple modification of the sample code provided in Learning ActionScript 2.0 in Flash.

What was going wrong?

I had taken the sample code and placed it in a method of an ActionScript class. Thus, the variables used in the sample code (e.g. my_nc:NetConnection, my_ns:NetStream) were no longer properties of the movie, but were purely local to the method. When the method completed executing, the variables vanished, which apparently destroyed the connection and stream.

To remedy this, I made the NetConnection and the NetStream properties of the class, so that they would stick around after the method exited.

I had originally thought that keeping around references to the NetConnection and the NetStream would be optional, only necessary if you wanted to refer to them later (like it might be in Java), but I guess not!

MySpace layouts are a pain

March 2nd, 2007 § 2 comments § permalink

It seems that my new div-based pet codes are sometimes not showing up on some people’s layouts. Why not?

Due to MySpace’s generally crappy HTML, any CSS layouts have to use stupid selectors like table table table td.text table table div { whatever }. Insanity! See this great post for more insight on MySpace layout nuttiness.

Anyway, it appears that some MySpace layouts are targetting something inside some div that happens to also match my pet code, which itself lives inside a div. These selectors tend to aim to hide whatever it is they’re targetting with display: none or visibility: hidden. This means that my pets turn invisible too! Argh.

I’m not sure what to do about this exactly, except maybe go back to table-based code, or pepper inline style attributes everywhere. Or put everything inside a form, just to be perverse :P

Hi5 HTML filtering stupidity

February 27th, 2007 § 1 comment § permalink

Hi5, another social networking site, filters HTML code oddly.

Embeds are allowed (I don’t think they used to be), but if there are any percent signs (%) in the embed‘s attributes, it doesn’t display. Further testing reveals that hi5 seems to strip out any tag that has attributes that contain any URL-encoded entities in it at all!

For example, this perfectly valid code for a link:

<a href="http://www.google.com/search?q=this%2Fthat">search this/that</a>

will not display properly in a hi5 profile. The <a href="..."> tag gets stripped out because of the %2F (an URL-encoded slash “/”).

The downside for me is that pets that have spaces or accented characters in their name will not display on hi5.

I’m guessing that this is their brain-dead way to prevent XSS (cross-site scripting) vulnerabilities as reported here.

It looks like I’ll have to not encode the flashvars at all on hi5. Hope it works properly…