Archive for the ‘Flash’ Category

PrintJob problems in ActionScript 2

Wednesday, October 31st, 2007

What I did mostly today was debug some ActionScript code on printing. All the basics about printing can be found in this tutorial. But as usual, what you want to do is more complicated than the basics. I have to talk a bit about my setup for you to understand the problem. What I usually do for a project, is that I load my content on 3 levels. The first level is the preloader which loads the shell (an external file) on level 2. The shell will load all the other content (also external files) on level 3. Also, because of all the rounded corners, content will be loaded under a mask.

So what I wanted to print was in the content MovieClip. I set out to do was in the tutorial, and everything worked really fine until I wanted to mmove the printArea MovieClip outside the visible screen (that’s the basic principle to do good printing using ActionScript). The big problem here is that content is under a mask so when I move the printArea out of the mask it become invisible so it won’t print. In order to solve that I had to attach the printArea MovieClip on the shell level (which is not under a mask). It sounds easy, but it took me 2 hours to find.

An other problem I had was that I was trying to offset a bit the stuff that I am printing so that when it prints there is a margin at the top and left. Well it seems that even if you offset (move a bit less and down) it doesn’t work, because for a reason, Flash start printing at the first pixel it encounters top and left. I think to circumvent that, I’ll put a single white pixel at 0, 0 so then my offset will work.

I hear there is also a problem with multiple page printing, but all my pages fit in one page so I did not have to solve that problem also

Games, Flash and money

Sunday, October 28th, 2007

This guy blogs about how to monetize a game you made in flash and what type of game you should target. It’s a nice article, the guy even made a game to experiment with and the game is pretty fun and really simple. I always wanted to make flash games and I have ideas that have been in my head for years but I never took the time to sit down and do them. Also it got me thinking about Air and flash games, now that you can make a desktop version of your game without too much trouble, it gives you another way to monetize your gave by making a small version online and a big version for the desktop.

More 3D, but from Alternativa Games

Saturday, October 27th, 2007

You can see a really cool demo of a 3D engine all in flash here. It runs nicely when you lower the settings a bit and doesn’t seems too slow. The sprites need some touch-ups but it’s only a demo so we can hope for the best. I don’t think they are going to release the code for us to play with it, but it’s nice to see that this can be done with flash. It confirms that being a flash programmer is really a good career choice because there is going to be a lot of good jobs in that domain in the future. As the computers get better and better, we will be allowed to program more complex stuff and no designers will be able to do it.

Going to Flex coming from Flash

Monday, October 22nd, 2007

I never really gave much attention to Flex. Mostly because it’s not beautiful enough in the sense that now the design of the website is so important that the platform you end up doing it on has to be very flexible to accommodate it. It’s kinda ironic to say, but I don’t find Flex that much flexible, design-wise.

But now I have an idea for a rich internet application, so I said to myself, why not try Flex, this application needs more usability than design. Well it isn’t as easy as it sounds. Flex is a whole new paradigm from Flash even if they share ActionScript 3. I’m kinda lost here and I don’t know where to start to get my application going. I guess I’ll have no choice but to buy the book. That’s what I’ll do right now.

Shared libraries, why not to be afraid anymore

Saturday, October 13th, 2007

Well, the answer to that is because it works fine now and it’s really great. I kinda searched a lot for this and found all sorts of old tutorials on flash 6 which is not really what I wanted. Then I found this tutorial and it made things really easy. Basically if your file structure is simple (all your swf and html are in the same directory) then it’s a piece of cake. I had a bit of trouble because my swf were in a different folder, but once it was resolved, it was great. It’s really neat for fonts, you embed your fonts in the shared library and you can use it in any swf on your site, even the ones loaded in another swf. What is even greater is that your swf don’t have to contain dynamic textfields for you to save space, you’ll even save space for static textfields. I also considered putting in my shared library components that I use in at least three different movies, but I am not sure about that yet. That is one more step to making the smallest, lightest flash website. I’ll check if it is still the same in Flash CS3 and maybe I’ll make my own tutorial about it.

9-slices scaling, Papervision 3D, Tweener and FlashDevelop

Wednesday, October 10th, 2007

I am currently working on a website with tons of rounded corners, so I’m pretty happy they added 9-slices scaling in Flash 8. The only problem I had today, was that I wanted to apply 9-slices scaling on a mask and it happens that you just can’t. You can’t do it using ActionScript and you can’t use it using the Flash Authoring tool. I don’t know about flash 9, but I sure hope they will get that to work.

I also stumbled upon something that looks pretty cool: Papervision 3D . The name says it, you can use it to do 3D in flash, haven’t tried it yet but it looks sweet. And while browsing their website I found a nice example using Tweener which I spoke off recently. They’ll both deserve more investigation.

Finally, on the same project I am working with all those rounded corner I am using FlashDevelop. I use it because I find the Flash Authoring tool to be realy bad (Flash 8 ) for ActionScript. Well I said FlashDevelop was good, but I would rectify what I said, and now say that it is still experimental. I had all sort of problems with it, mostly with the auto-completion tool completing things all the time which I didn’t ask for . Just thought I’d share that with you.

2 new tutorials and SEO

Tuesday, October 9th, 2007

I have been busy this weekend, I have made two new tutorials about how to time your animations, one in ActionScript 2, one in ActionScript 3. I hope this help.

If you noticed there is the word SEO (search engine optimization) in the title of the blog but I didn’t have the time to write about it yet. In the meanwhile I can direct you to the website the-flash-files made by Nurun , a web agency in Montreal (actually a competitor of the company I work for).

Mouse Wheel problems and no answer

Wednesday, September 19th, 2007

My search of the day is about the mouse wheel. So I'm making this scrollbar Class and to make a full fledge scrollbar you need to make it work with the Mouse Wheel. Ok, this part is not so bad, I look around a bit and I find this:

Actionscript:
  1. var mouseListener:Object = new Object();
  2. mouseListener.onMouseWheel = function(wheelNum:Number)
  3. {
  4. if (wheelNum> 0)//rolling wheel toward the screen
  5. {
  6. //your code
  7. }
  8. else if (wheelNum <0)//rolling wheel away from the screen
  9. {
  10. //your code
  11. }
  12. }
  13. Mouse.addListener(mouseListener);

This works out pretty well when testing inside the Flash authoring tool. The interesting part of this code it the Mouse.addListener part because in ActionScript 2, there is no mouseWheel event on MovieClips, you have to use the global object Mouse to catch the mouse wheel. This can cause trouble because it won't only catch the mouse wheel when the mouse is over the MovieClip, but at large, when the mouse is over the entire flash movie. You have to tweak it to make it work this way. I think this is resolved in ActionScript 3; most of the mouse events are renamed for consistency and there is a mouseWheel event on MovieClips.

My trouble was that when I tried my movie in a browser, sometimes, the mouse wheel didn't work. At first I was thinking it was because my SWF that had the mouse listener in it was loaded in another SWF. When I make a website, I most of the time make an external preloader; this way it will preload the MovieClips I export for ActionScript. I found out that the trouble was actually coming from the SWFObject. When I was using SWFObject in my HTML, the mouse wheel wouldn't work in FireFox and Opera (it works fine in Explorer). I looked around a bit to find other people with the same problem and found none... So I did some testing on my own.

At first I tried getting the new version of SWFObject here but that didn't do it. I also tried to use the fix to make the mouse wheel work in Flash when you use Mac OS X that can be found here. But that didn't do it. My last option was to use the new technique from the makers of SWFObject and UFO: SWFFix. There it was, the answer to my problem. Trouble is, it is only in alpha stage and its not a stable release, but in my case it worked real fine. I will check for new version often to be the more stable as possible, but for now I am pleased with this option.

I have another point I want to make, I wanted to start deep liking my site to enable more browser options (back, foward, history) and the script I had found was based on SWFObject, so I can't use it in this case.

Using the Fuse kit for animation versus using the Tween Classes

Tuesday, September 18th, 2007

Most of what I will write about is interesting stuff I found while searching for something. When searching for the tween classes in Flash CS3 I stumble two times on people speaking about the fuse kit for animation. I have as a motto to check out things that I hear about twice, so that the next time it comes up, I know what people are talking about. In this case this could even be helpful for my job, so I go and check it out.

The fuse kit are some ActionScript2 classes that simplify that syntax of doing animation using ActionScript. It has 3 parts; one is the Zigo Engine which handles the tweening. It can be used as a standalone. The second part is Fuse itself, which are sequencing classes that helps you organize your tween in time. The last part is FMP which permits you to use filters with Fuse.

This all looks pretty good, with it you can do tweens in sequence as well as in parallel. I say to myself, that is fantastic, I will be able to get rid of the setTimeout in my code and my ActionScript will be simpler to understand.

There is only one catch; The Zigo engine in itself adds to your SWF 34k, Fuse: 2k and FMP: 1k for a grand total of 37k. So it rules out the possibility to use it in banners and such. When I make a flash movie, I want it to be as small as possible so the idea of starting my SWFs at 37k doesn't make me happy. Also you can't use the Fuse kit to do roll overs; I do all my rollovers in actionscript so I would have to import the tween classes from Adobe too to add another 2k. For me it just doesn't cut it; if my website as more than one SWF it's 39k I have to add each time.

So in the end, the Fuse kit looked pretty good, but its advantages don't match up with its disadvantages...

Flash IDE, FlashDevelop, SE|PY

Saturday, September 15th, 2007

While searching around for answers, I stumbled a couple of time on developers who didn't use the actionScript editor that comes with Flash. As a matter of fact, before Flash CS3, the default editor wasn't packed with options and was kinda simplistic. I was working on a project where I was up to 1000 lines of code so I said to myself, that's right I need something that has more options. So here are the options I found:

SE|PY: It's the first one I found, I guess it's been around the longest. It's kinda cool, and really easy to customize. It was made by Alessandro Crugnola from http://www.sephiroth.it/ . If you've done Flash for some time, you surely ended up on this site one day. This is a good interface, but it has two major down sides: it looks kinda old and it is not in development anymore.

FlashDevelop: I think FlashDevelop is the most promising interface out there. It looks great and has most of the feature that SE|PY has. It's kinda hard to change the syntax color of the code, but that's mostly it. It has a great structure for adding plugin so it might become really good in time. Another point I didn't like was that for help about actionScript code it sends you to adobe liveDocs on the web which is awfully slow.

Flash IDE: This is the default interface that comes with Flash. Up to Flash 8 I would say that you need another interface if you do a lot of actionScript coding. The thing is, that in Flash CS3 Adobe really put some time on the ActionScript editor and made it the better than even FlashDevelop. It now has code folding, and can fold mostly anywhere, not just functions (like in FlashDevelop). Help is easy and fast and it is integrated with the rest of the Flash interface.

So there it is, my review of the ActionScrip editors out there. My big winner is the Flash CS3 editor, but you have to watch closely for FlashDevelop development because it might become really interesting.


Close
E-mail It