programming

languages

Adobe Flex SDK and command line

I have been using Flex Builder for my flex and air programming, but decided to start doing some work in TextMate and compiling from the command line. I downloaded the Open Source Flex 3 sdk and the Adobe Air sdk. The flex sdk executables wouldn't run. After poking around, I discovered the Unix executables had Windows line endings. I used BBEdit to open each file and change the line endings to Unix line endings. BBEdit is nice for this. I think I'll build a little perl app to do this, though.

Read more

Drag Scrolling Canvas

Adding a DragScrollingCanvas

I've discovered the great flexlib library that adds a number of components to flex's already easy to use components. Here I have embedded an image inside of a DragScrollingCanvas. Try putting your cursor inside the image area and drag the image around. It will drag scroll any content contained within it, not just image data. I kept the example simple.

Below is the source

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:flexlib="http://code.google.com/p/flexlib/" layout="absolute" width="500" height="400">
   <mx:Canvas x="0" y="0" width="500" height="400">
      <flexlib:DragScrollingCanvas x="25" y="25"
               borderStyle="inset" id="dragCanvas"
               width="450" height="350"
               childrenDoDrag="true" backgroundColor="#feefd3" backgroundAlpha=".65" cornerRadius="0">
               <mx:Image id="myLogo" source="@Embed('assets/snarl.jpg')"/>
      </flexlib:DragScrollingCanvas>
   </mx:Canvas>
</mx:Application>

Javascript: The Good Parts - book review

I banged through the new O'Reilly book by Douglas Crockford titled JavaScript: The Good Parts

Crockford is a very eminent programmer in the javascript community and I was excited to see a book come out by him. However, after reading it, I have to say it wasn't what I expected. I thought it was going to be a very detailed description of Javascript objects, and particularly JSON of which he developed and popularized. But what I found it to be was a description of what is good, bad and ugly about the language. Quite interesting for anyone who has used the language for any length of time, and would consider themselves adept in the language. At times I think I am adept, but I find when I begin to think that I get challenged to the point that I really don't know much at all.

Read more

Adobe Air pocket guide is now a free download

Ajaxian had an interesting post. O'Reilly has released the Adobe Air Pocket Guide as a free download. You can get it here.

Air Pocket Guide

Regex in javascript

I needed to create a toggle image in a menu. I decided to check the image src to see what image it was on. Regex in javascript to the rescue. Here is what I used to parse only the image name.

var re = /([\w\/\.\\:]*\/)([\w\.]*)/;
var imgSrc = $('toc').src;
var myArray = re.exec(imgSrc);
if (myArray[2] == "toc_open.png") {
$('toc').src = "images/toc.png";
}
else {
$('toc').src = "images/toc_open.png";
}

Read more

Setting nested DOM element attributes

I needed to set some attributes for some anchors in an iframe. I wanted them to open in the parent frame. The problem was I only wanted certain ones that were inside of certain elements. I wrote this javascript loop to find the <a> elements inside of the div with the id of "re".

Read more

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.
Permissions beyond the scope of this license may be available at www.bradrice.com.

RSS Feed  My RSS Feed