Blog

  • Flash Player Can’t Read Ur Stuff & Access T3h Internets @ T3h Same Time

    Can’t sleep, must blog. I’m thinking of rigging up a dart frog blow dart gun next to my office desk. I can basically lean forward to my right, pull a nylon + silk, 1 inch thick drape rope, much like the Adam’s Family did to summon Lurch, and I’ll promptly be knocked unconscious with the dart protruding from my neck. Insomnia sucks. Might as well put it to good use. I was accused of having a similar setup in high school, except, instead of a blow dart, it was red velvet curtains that would part, and a salt lick would slide down; a massive slab. Salt licks are stationary blocks of salt left to attract dear; typically used by hunters. Instead of salt, however, it was a massive slab of solid caffeine that I apparently licked every morning before arriving to school. This wasn’t true, although, red velvet curtains sounds h@wt! Drinking coffee at 14 isn’t such a good idea; note to self for future teenagers.

    …anyway, Flash Player. Flash Player 8 had this (yet again) new security model put into place. They call it a “sandbox” so you think it’s this happy place to keep honest people honest. Basically, a SWF can (only) now:

    – contact interweb sites, but not local files
    – load local files, but not internet sites
    – do both with a modified configuration file installed on a user’s computer in a special directory

    An EXE, aka, a Projector, is exempt. If it’s not, you’ve got a virus, abort, abandon ship, JesterXLs’ and women first.

    Granted, you “can” theortically get the 3rd option to work via Settings Manager, but I’ve never heard of anyone publicly getting it working. Using that tool myself makes me cringe. It’s easier to just ask someone that trusts you to run an .exe you made for them via a 3rd party Flash Projector. Unfortunately, a few people who published CD-ROM’s in the past without such projectors had their content break when their users updated.

    I believe the Flash IDE allows this via the special player that it uses when you do a Test Movie ( Control + Enter). I could be wrong.

    I DO know that Flex Builder 2 utilizes the config files I mentioned. It basically writes them to exempt your bin folder. That way, you can load XML files locally for configuration stuff AND have that same SWF access various back-end services, either local, or on the web. When you do a new project, it’ll point this config file to our bin directory, thus making a SWF in there capable of having a wonderful time… like Optimus Prime or Gman for example.

    What if this ISN’T written? You’ll get a security error. You can compile SWF’s to do one or the other in Flash 8, as well as Flex Builder’s mxmlc. For both, you’ll need an EXE, or access to the user’s box. Naturally, the 3rd never happens for most of us. In development, though, it’s all us. I’ve seen this fail for the first time, today.

    We’re not allowed to check in bin, html-template, .settings, .project, and .actionscriptSettings into CVS, which I agree with. However, apparently when you do an import project in Eclipse, it doesn’t do any Eclipse magic without the main project files in there. Even “Adding Flex Nature” to your newly created Eclipse project doesn’t seem to add the entry. If you delete the project, and then re-import with the goodie config files in there, it apparently goes and writes the config file. Example path on PC:

    C:\Documents and Settings\[username]\Application Data\Macromedia\Flash Player\#Security\FlashPlayerTrust

    Why should you care?

    If you start testing things in Flex Builder, and it starts bitching that your SWF “isn’t allowed to access” either local files or remote files, call bs on FB, promptly add the entry, and reboot your browser. The last part ensures that Flash Player reloads the .cfg files and knows who’s allowed to break the laws of nature. For me, there were 2 entries in 2 files. The flexbuilder_plugin.cfg and the flexbuilder_plugin.fbr files. The first is easy; you just paste the bin directory’s file path. The latter is… weird. Just copy and paste the one above it.

    Granted, you’ll hopefully never have to do this. I only write for the poor sod searching late at night on Google for ytf his stuff isn’t working.

    More specific information (still relevant to Flash Player 9).

  • Double Line Breaks in Flex Builder 2 ActionScript Files

    Check out a fresh build today of a project I’m working on, and all the AS files have double line breaks in them while the MXML are fine. So, instead of:

    public function Class
    {
    }

    It was:

    public function Class

    {

    }

    wtf?

    Open in Notepad. Looks fine.

    Open in WordPad. No line breaks.

    WTF?!

    Open up Flash 8, do a LoadVars, and inspect the onData result in the debugger. \r\r\r\n after each line. Huh? Didn’t have this problem with various other people on PC’s & Mac’s using Eclipse, Flex Builder 2 plug in, and SubEclipse. My setup was different than last week. Instead of a MacBook using the above, I had switched to my home setup; PC, 2 directories (one for source, one for development), TortoiseCVS, and Beyond Compare as my diffing tool.

    Mike Morearty
    hit Google for me and found that this is a common problem with some CVS setups. Basically, CVS does a good job at handling multiple systems. Eclipse will even inject the necessary line breaks for viewing, but SubEclipse will take ’em out so Unix is happy. Actually, it’s not that simple. The post Mike found is like 9 frikin’ pages about line breaks and such.

    Bottom line, I had to check this one check box on the 3rd tab of TortoiseCVS when checking out a project to “keep Unix line endings” or some such, and all was well. Thanks Mike!

  • Captivate Player 1.2

    Works with Captivate 2. Additionally, now supports skin.swf’s. Basically, you can choose a skin that your demo / movie uses, and Captivate 2 will generate a skin.swf. You point your playlist to those instead of your regular SWF’s. The CaptivatePlayer can now read them.

    CaptivatePlayer is a SWF that plays multiple Captivate movies in succession. Since it’s best to create a bunch of 30 frame or less Captivate demo’s, you’ll typically end up with a bunch of them after a project. The CaptivatePlayer makes it easier to easily play those on the web. You just input their names into the XML playslist file, and upload with the CaptivatePlayer.swf.

    Captivate Player 1.2 – Download

  • Getting a Photoshop Design into Flex 2

    Photoshop Fireworks Flex
    Raw, unrehearsed, and barely edited. Hopefully useful. This video tutorial will show you how to get a Photoshop CS2 design into Flex 2. I show taking the design from Photoshop to Fireworks, and then importing it into Flex. I aditionally cover using those assets in states & transitions in Flex Builder 2. Ben, a commenter, asked for a tutorial on this subject.

    This is not the only way to do this.

    I’ve had a designer export all PNG’s for me from Photoshop.

    I’ve had a designer export all graphics as GIF’s with per-screen printouts to tape inside of my cube for visual reference.

    I’ve had a designer give me a PSD with no fonts. When I got the fonts, they were the Mac fonts, not the PC fonts.

    So, I’ve had a full gamut of situations on how this went down. Typically, most designers do not know, or just don’t care to export PNG’s out of Photoshop. GIF’s are sometimes ok . Thus, these are the measures us Flash & budding Flex developers have to go through to get the design into our world. I’m not saying it’s the right way, but without a designer capable of exporting PNG’s, we have no choice.

    Maybe if every designer capable of doing this wasn’t always busy when I asked them to do contract work, I wouldn’t be posting this. Unfortunately, there is still a shortage of talent, or that talent in house doesn’t get effectively communicated to, and it’s just faster to do this yourself.

    I’ll be speaking about this as well as Flash integration at the 360Flex Conference March 5-7, 2007 at Ebay in San Jose, California, USA. [pending topic approval]

    Anyway, I say “denote” at least 7 times. Also, apologies for Flex Builder’s non-real-time typing. Eclipse is stealing the key presses from Captivate. It catches up when I click though, so just wait patiently, and you’ll see the code.

    If you are a Designer, you can safely stop on “Contents Layout”, the 9th section. If you are curious to see how to animate & implement image assets in Flex, feel free to watch the whole thing. I covered states & transitions by accident. All 30 sections counted, the whole tutorial is about 58 minutes. Took about 7 hours to create & edit since it was improv. Uploaded all 150 megs of it all of last night. BTW, I had to update my CaptivatePlayer to work with Captivate 2 skin SWF’s, so any problems viewing, just let me know and I’ll just link to the files directly.

    Hope it helps!

    Getting a Photoshop Design into Flex 2 – A Video Tutorial using Photoshop CS2, Fireworks 8, and Flex Builder 2.