Archive for October, 2008

AIR widow/app drag, minimize, and close

In working on my Uploader tool, I had to do a bit of research on how to drag, minimize, and close an AIR app. Below is the summarized code in case anyone else is wondering how to do this.

import flash.display.Sprite;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.desktop.NativeApplication;
import flash.events.MouseEvent;

public class Main extends Sprite
{
        public function Main():void
        {
                // button events
                mc_exit.addEventListener(MouseEvent.CLICK, exitApp);
                mc_minimize.addEventListener(MouseEvent.CLICK, minimizeApp);
                mc_drag.addEventListener(MouseEvent.MOUSE_DOWN, dragApp);
        }

        private function exitApp(event:MouseEvent):void
        {
                NativeApplication.nativeApplication.activeWindow.close();
        }

        private function minimizeApp(event:MouseEvent):void
        {
                NativeApplication.nativeApplication.activeWindow.minimize();
        }

        private function dragApp(event:MouseEvent):void
        {
                NativeApplication.nativeApplication.activeWindow.startMove();
        }
}
 

Three buttons on the root of the flash file each with a listener that handles an action when the mouse is clicked on it. The drag button has to use ‘MOUSE_DOWN’ instead of ‘CLICK’ to work. NativeApplication is the AIR app and it looks to see which window is currently active to send the commands for.

Tags:

Uploader Phase 1

Here is a screen shot of the Uploader 0.1.0

Uploader 0.1.0

If you missed the previous post explaining what Uploader is go check it out.

So after having some fun with code I think I’m close to being done with phase 1.  I currently have a working beta (0.1.0) that I’m going to share with you all and explain what I’ve done in case anyone else wants to do something similar.  For the most part this was pretty straight forward.  There were a few hiccups here and there that I’ll try to address in this post. The link to the code will be at the end.

  Read the rest of this entry »

Tags: , , ,

Uploader: Automating WordPress Links and File Uploads

So now that I’m starting to get my WordPress and new hosting server settled in I’m trying to think of what I can create to help me automate some tasks. One of the things I know I’ll be doing quite often is adding new links to the ‘Links of Interest’ on the front page.  I’ll also be uploading files/images to use on posts or to share with others but I’m too lazy to be ftping files constantly. So… time for a new tool!

The Uploader (yeah I know, I’m very creative) is going to do all the above for me. This will be a app I can keep running on my desktop somewhere and when I need to upload a file or link I can just drag it over and drop it in. The tool will then figure out what kind of item was dropped in and what to do with it.

Phase 1 will handle the links. The way the tool should work for links is the following.  I visit a page that I find interesting and want to add to the ‘Links of Interest’.  Instead of logging into WordPress to create it, I highlight the link from the address bar of the browser, drag it over to the app, and drop it. Now the app needs to figure out the <title> of that page to use as the name since we need a name and url to create a link. Once it has that, the tool will send the information to a PHP page which will do an insert to the links table in the WordPress DB.  

Phase 2 will deal with images and files. I may break phase 2 into two since I may do some stuff differently with images versus other files.  I’m thinking I may want to upload images, create a thumbnail, and insert to a DB to display in the front page the same way some people do with their flickr images. Other files I would just upload and store somewhere else.  I’ll give this more thought when I get to it.

I’m going to be writing the tool in Flash CS3/AIR with PHP in the backend using the current WordPress MySQL DB.  Stay tuned for updates!

EDIT:

Uploader Phase 1 completed 
Uploader Phase 2 completed

Tags: , , , ,

05 WRX STi – Road to 450whp Part 1 (Stock to 300whp)

For any car enthusiasts out there, I decided to write a little bit about my car and experiences over the last couple years.  It all started back in November of 2004… actually before that, probably the year before.  At some point in 03 I graduated from College and decided to treat myself in the form of a car.  I was driving a 91 Acura Integra at the time which was nice but I was ready for something new.  What I really wanted was a Subaru WRX STi but I couldn’t afford it so I settled on an Acura RSX-S.  The car was really fun and comfortable to drive around but around a year later, I received a promotion at work and it was time to get the car I really wanted, the WRX STi.

I bought the car from ‘Herman Jones’ at ‘Classic Cadillac and Subaru‘ after a few hours of negotiations.  I was very happy with the purchase and I would recommend anyone interested in buying a Subaru to go talk to Herman.  The car was everything I was expecting it to be if not more.  4 cylinder boxer engine, turbo, 300hp/300tq, all wheel drive, sport seats – so much performance I didn’t know what to do with.  So of course, my first thought was… more HP!

Read the rest of this entry »

Tags: , , , ,

rtl.css?

So I’m still learning to use WordPress and decided to style the default theme a bit. I went to the theme folder and opened up the first CSS file I found which was ‘rtl.css’. I added a background color to the <code> tag, saved the file, and refreshed my page… nothing. Tried it again and nothing. I went back to the theme folder and noticed a ‘style.css’ file. Opened that up, made changes to the <code> tag, saved and reloaded and it worked! So what’s this ‘rtl.css’ file? A quick Google search gave me the following answer:

“rtl.css is called when you are using a language localization that reads from right to left (e.g., Arabic or Hebrew).” – source

Well now I know and so do you.

Tags:

Setting up my WordPress

So I’m using WordPress for the first time and I’m quickly learning that it’s neat and fun to play around with.  The documentation seems good and the code easy to work with.  I’m going to be tracking all the changes I make to the default installation of version 2.6.3 for reference.  I may need this information later or someone else might find helpful.

So far I am using the default theme.  I’m sure I’ll eventually change it but for now I’m just trying to understand how things are structured and how to tweak elements on screen.  The WordPress Function Reference page was a great place to start.  My first goal was to figure out how to get my sidebar to display a list of projects and topics.  In the admin, I created a root level category called ‘Topics’ and another one called ‘Projects’.  Then I created a few other categories that were under either topics or projects such as ‘Flash’, ‘Cars’, ‘PHP’.

Read the rest of this entry »

Tags:

Finally!

I’ve been resisting for the longest time to start blogging but with the help of my friend and co-worker Moses I’ve decided it’s about time. My thoughts at the time are to blog about my interests such as coding (mainly PHP and Flash), current projects, and every once in a while about my car. I think this will be a good way to organize myself (having a centralized location for my ideas, thoughts, projects) as well as a good way to get to know more people out there. Help me via comments on what you would like to see more or less about. Would you like things more or less technical etc. Thanks for reading!