Category: Flash

  • Sample Flash 2004 App #1: RSS Reader

    *** Updated @ 1:59pm EST 9/24/2003 ***

    Here is the source code for the sample app I made. It simply uses the Flash Pro Accordion component with RSS XML parsed from various blog sites.

    Illustrates:
    – how to use the new factory method createObject (used to use attachMovie)
    – shows how to use the new callbacks for events (used to be setClick/setChangeHandler (“handlerName”, scopedObject))
    – how to get around the security restrictions easily using PHP (10 lines of code)
    – how to preload components & classes to allow your preloaders to work in frame 1

    Cons:
    – I forward reference functions (I got enough shlack from Erik, no more please…)
    – I don’t use the XMLConnector component; I couldn’t figure out how to send variables using it to PHP, so just used a LoadVar’s object to get the XML and then pass it to an XML object to parse it
    – no loading bar; there are more events than one knows what to do with, so there is little excuse not showing a loading bar while the XML data is retreived form the websites

    Hope this helps you learn, as I learned a lot by this small project.

    BTW, I straight ganked this idea from Michael at <a href=”http://www.hollowcube.com”>Hollowcube.com</a>. He had one he built in MX very similiar, so that’s why I put his blog first!

    Source – ZIP

    Update: I have updated the PHP file based on comments from Bertrand Saint-Guillain and Darron Schall to be more secure (I think). Therefore, please know that the php file, both the last one and this one, are a security risk; use at your own discretion, or find a PHP guru who can make it safer.

    Comment from Bertrand, “…in fact that (my latest change) should do the trick , but your php script can still be used as an anonymous gateway by anyone (which is not such a big issue, but someone could try to anonymously brute force an htaccess authentification through your script)”

  • How to preload in Flash MX 2004 & Kill Yer Calender

    In Flash MX, Export in First frame was introduced. This would then end up giving your SWF file a ton of k in the first frame, therefore, the user wouldn’t see anything for a long time before your SWF was finally downloaded from the web.

    In MX, you solved this in 3 ways:
    – make a new SWF to load the big one (this didn’t always work because some components didn’t work correctly when loaded into a level)
    – use shared libaries via making a new SWF (worked well in later versions of the Flash 6 player, but still required another SWF)
    – OR: uncheck all components “Export in First Frame”, frame 1 = lightweight preloader, frame 2 = all your components off stage, frame 3 = your app

    In 2004, even if you uncheck export in first frame on even just one component, you’ll still have about 32k in the first frame. I thought my days of single SWF delivery were over when I heard this. Thanks to -insert tomorrow-, there is a new feature that I came across, but didn’t know the significance at the time… until now.

    The reason for the 32k is that all class files are compiled on frame 1. To get around this, you can use the class frame feature under File > Publish Settings, Flash Tab, and then the “Settings…” button next to the ActionScript version field. This allows you to set the frame to export you classes on. Set it to frame 2, and you can use the 3rd option above (uncheck all first frame export, frame 1 preloader, frame 2 components, frame 3 app).

    … I was so skeered, but now I’m happy as hell!

    *******

    BTW, if you see I took out my stoopid calendar and replaced it with a Flash widget. It’s my first app in Flash 7. Basically, I needed to learn Pro, so I dove straight in trying to use the components. I used the Accordion pane that comes standard, and populate it with people’s blogs. Now, I’m not playing favorites, it’s just I used the same XML parsing for RSS v0.91 or whatever, so those 4 were the only ones that worked, hehe. I tried using the XMLConnector, but couldn’t figure out how to attach variables to it to send to PHP (that’s how I get around the security sandbox). Anyway, I know it needs some work (titles?) so I’ll post the source tomorrow morning.

    DIE CALENDAR!!!

  • XPathAPI documentation?

    I saw that XPathAPI is one of the data files used in the XMLDataConnector. However, the class file says it’s intrinsic… wtf, does this mean XPath is internally built in the Flash player? If so, anyone know where the documentation for it’s methods are?

    I was just gonna play with them to figure them out, but wouldn’t mind a headstart…

  • Scientific Breakthrough

    Via a co-worker.

    A scientist from Texas A&M University has invented an improved bra that keeps women’s breasts from jiggling and prevents the nipples from pushing through the fabric when cold weather sets in.

    At a news conference announcing the invention, the scientist was taken outside by a large group of very angry men, who promptly kicked the shit out of him.