Critter’s Code

This is a picture of a bridge and a city. I like bridges and cities. They make me smile.

Archive for January, 2008

Jan-25-2008

I have some Seesmic invites to give out

I have a few Seesmic invites to give out to those that are interested. There are easily over 15,000 people waiting on the list. You know you want one!

Leave a comment if you are interested.

Posted under Seesmic, Stuff
Jan-17-2008

Changing button icons at runtime using Actionscript

I had to do quite a bit of searching around this morning to figure out how to change the icons on my video player at runtime.

phoenix-032   phoenix-031

I thought I could easily modify the [button].icon property, but I could not access that at runtime. You can, however, do the following:

//    embed your icons
[Embed(source='com/images/play.png')]
[Bindable]
public var imagePlay:Class; 

[Embed(source='com/images/pause.png')]
[Bindable]
public var imagePause:Class;

//    using one button to toggle play and pause of video
private function playpause():void
{
    if (seesmicVideo.playing)
    {
        seesmicVideo.pause();
        btn_play.setStyle("icon",imagePlay);
    }
    else
    {
        seesmicVideo.play();
        btn_play.setStyle("icon",imagePause);
    }
}        

Using [button].setStyle() will allow you to change the icon at runtime.

Posted under AIR, ActionScript, Flex, Samples
Jan-15-2008

I need AIR / Actionscript assistance

I have a TileList in my AIR application. Previously, I was including the itemRender directly in the tag like:

<mx:TileList itemRenderer="Timeline" >
<mx:itemRenderer>
   <mx:Component>
    <mx:HBox verticalGap="0" backgroundColor="{outerDocument.checkUser(data.publisher.value)}">
       <mx:Image click="outerDocument.PlaySeesmicVideo(data.flv.value,data.videoUri.value)" />
       <mx:VBox width="100%" height="100%" verticalGap="0" verticalScrollPolicy="off">
       <mx:Label buttonMode="true" width="100%" textAlign="left" />
       <mx:Label text="({data.language.value})" fontSize="9" />
       <mx:Text fontSize="10" text="{outerDocument.StripRE(data.title.value)}"  />
       </mx:VBox>
     </mx:HBox>
   </mx:Component>
</mx:itemRenderer>
</mx:TileList>

I need to move the itemRenderer into it’s own component, but as soon as I do that I get errors on my functions that are fired from within the component. "outerDocument" no longer works.

So, my question, is, how do I reference a function in "main.mxml" from "timeline.mxml" ?

Posted under AIR, ActionScript
Jan-14-2008

Flex and AIR Pre-release Tour with Adobe’s Ben Forta

January 23
6:00pm start time

Railinc,
7001 Weston Parkway
Cary NC 27513


View Larger Map

User Group Site: http://www.triangleuserexperience.org

Flex and AIR Pre-release Tour with Adobe’s Ben Forta

Flex 3 and AIR are getting close to launch and in preparation, Ben Forta from the Adobe Flex/AIR product team is traveling to select cities to show off the great new features and help prepare us for this exciting launch.

Flex 3 is a feature-packed release, adding new UI components like the advanced datagrid and improved CSS capabilities; powerful tooling additions like refactoring; and extensive testing tools including memory and performance profiling, plus the addition of the automated testing framework to Flex Builder.

Adobe AIR is game-changing in so many ways, extending rich applications to the desktop, enabling access to the local file system, system tray, notifications and much more. Now you can write desktop applications using the same skills that you’ve been already using to create great web apps including both Flex and AJAX.

Don’t miss out on the opportunity to see and hear about this highly anticipated release of Flex 3 and AIR during this special pre-release tour. Plus, in addition to giving away some one of a kind Flex/AIR branded schwag, we will also be raffling off a copy of Flex Builder 3 Professional (pending availability) and a full commercial copy of CS3 Web Premium at this event!

Posted under AIR, Flex, Presentations, User Group
Jan-11-2008

I need help with a php / mysql thing

For Seesmic World Project, I want to plot the video replies on a Google Map. The points will be geocoded by address off of the blog posts for example:

  • Paris, France
  • Cary, NC
  • Riverside County, California
  • Paris, France

As you can see from the list above, some posts will have the same title. Meaning when they are passed into Google Maps they will have the same Lat/Lon. When this happens, only the last point passed in will show. Basically what I need to do is take the query result and loop through it, combining the $post_content of duplicate $post_title’s into one $post_title

Did that make sense?

So, if I have

Post: Paris, France
Content: Hello, I am Steve from Paris

Post: Cary, NC
Content: Hello, I am Critter from Cary

Post: Paris, France
Content: Good Evening, I live in Paris

Would become:

Post: Paris, France
Content: Hello, I am Steve from Paris
Good Evening, I live in Paris

Post: Cary, NC
Content: Hello, I am Critter from Cary

Any suggestions or assistance would be greatly appreciated. PHP is not really my thing.

Posted under Site News
Jan-11-2008

This blog is a pain to move

I just recently switched this blog over to a new server. And at the same time, ended up switching the engines behind the blog. I moved from BlogCFC to WordPress, only because I do not have ColdFusion on this hosting account. I know, I know, blasphemer!! This is actually my first time using WordPress for my blogging, but so far, I am quite pleased with it.

Over the next few days I will be working at extracting all my old posts from old server and getting them imported into WordPress.

I had a few flex samples that had quite a bit of traffic. I will work on getting those over first.

Posted under Site News
Jan-7-2008

Meeting Reminder: January 23rd 6-9 / Cary, NC / Ben Forta

Just one of numerous reminders you will receive about Ben Forta’s presentation on Adobe’s Flex 3 and Adobe Integrated Runtime (AIR).

Adobe will be providing some eats and a copy of Flex 3 (upon release) and CS3 Web Premium Suite to be raffled off during the event.

The meeting location is being provided by:

Railinc Corporate Headquarters
7001 Weston Parkway, Suite 200
Cary, NC 27513
Phone: 919.651.5000
Fax: 919.651.5402


View Larger Map

We would really appreciate it if you could RSVP for the event so that we have a rough idea of how many will be attending.

RSVP Link: http://tinyurl.com/389zrs 

See you there!

Posted under AIR, Flex, Presentations, User Group
Jan-6-2008

Using ColdFusion.navigate() from within a cfgrid.

I had what seemed like a simple task. Load a query into an html cfgid. Users could then click on a row (record) and be taken to an edit/update page.

Piece of cake. I have done this many times before. Unfortunately, this was my first time attempting it with ColdFusion 8 and all it’s ajaxy goodness. CFGRIDCOLUMN has an ‘href’ attribute, but I was not able to fire off javascript from it, it would only execute regular links. I wanted my edit screen to open up below the grid in a CFDIV.

After much googling and mucking around, I was able to piece together the following. Which adds a click event to the cell.

   1:  addLinksforaTasks = function()
   2:  {
   3:      gTask = ColdFusion.Grid.getGridObject(‘agrid_tasks’);
   4:      cm = gTask.getColumnModel();
   5:      gTask.on(‘cellclick’,function(grid,rowIndex,columnIndex,e)
   6:      {
   7:      var unitID = ColdFusion.getElementValue(‘agrid_tasks’,‘taskform’,‘taskid’);
   8:      ColdFusion.navigate(‘atasks.cfm?action=edit&taskid=’+unitID,‘taskedit’);
   9:       }
  10:      )
  11:  }

The hardest part to figure out was how to get the id field value (in this case taskid).  It is such a simple thing that I was sure is used constantly, but I could not find much help on the web. Here is the function explained:  ColdFusion.getElementValue(’grid_name’,'form_name’,'columnid’). That gave me the taksid of the selected row in the grid.

To execute the function when the grid loads you need to add

<cfset ajaxOnLoad(’addLinksforaTasks’)> to the page containing the grid.

One other thing to note, if you are loading a grid into a CFDIV, you need to put all helper functions on the parent page. They do not seem to execute correctly if they are included on the page loaded into the CFDIV.

Anyway… hope that can help someone…

Posted under Ajax, ColdFusion, Samples