Internet Explorer 6 is not supported.
Upgrade to view this site.

Blog Archive

Results for the blog tag workaround.

Current URL in WordPress

This seems like it should be a given, but it seems that WordPress has no easy function to get the current URL. I didn’t want to use $_SERVER variables to get the URL, but after finding no good WordPress solution, I decided to bite the bullet and just make up a $_SERVER solution for the time being.

Some time passed, I forgot about it and found some other headaches to occupy my time. Then I found this post with a solution that was to my liking. The only thing that I didn’t like about it was that it always appended the original query string, whether you were using permalinks or not. I added a little conditional to it and now I have a current_url function that I wouldn’t kick out of bed.

1
2
3
4
5
6
7
8
9
10
11
<?php
	if(!function_exists('current_url'))
	{
		function current_url($trailingslash = false)
		{
			global $wp;
			$current_url = isset($wp->request) ? home_url($wp->request) : add_query_arg($wp->query_string, '', home_url());
			return $trailingslash ? trailingslashit($current_url) : $current_url;
		}
	}
?>

TransitionManager Events

I recently used the TransitionManager class to get some ready-made animation in a project I am working on. The problem was I needed to know when the tween ended so I could dispatch an event to tell my application to allow user interfacing again. I checked the Adobe API on TransitionManager and there were no events to respond to be found there. Not even a useful inherited event. So I decided to poke around in the class file itself just to see what was going on in there. In case you don’t know, never edit these classes. They are essentially part of the Flash application. If you need extra functions it’s always better to make a subclass extending the class and write your own methods and properties. That what OOP is all about.

There are 2 events that can be responded to in their without editing the code to do so. The two strings that you can add a listener for are these.

1
2
const ALL_TRANSITIONS_IN_DONE:String = "allTransitionsInDone";
const ALL_TRANSITIONS_OUT_DONE:String = "allTransitionsOutDone";

Of course, these events don’t carry any TransitionManager specific properties, it just dispatches the generic Event telling the application that it happened. I don’t know why this wasn’t included in the API, as it is something that is useful for this the implementation of this class. Maybe I’ll get around to writing a TransitionManagerEvent class one day. Until then, this works.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import fl.transitions.*;
import fl.transitions.easing.*;
 
const ALL_TRANSITIONS_IN_DONE:String = "allTransitionsInDone";
const ALL_TRANSITIONS_OUT_DONE:String = "allTransitionsOutDone";
 
var currentSlide:Slide = new Slide();
addChild(currentSlide);
 
var tm:TransitionManager = new TransitionManager(currentSlide);
tm.startTransition({type:Blinds, direction:Transition.OUT, duration:2, easing:None.easeNone, numStrips:10, dimension:0});
tm.addEventListener(ALL_TRANSITIONS_OUT_DONE, outTransitionsDone);
 
function outTransitionsDone(event:Event):void
{
	trace("done");
}

You can get the FLA example file here.

You'll Get No Help From Flash CS4

I got the new Creative Suite 4 at work the other day. My boss tells me I am one of four who got it this early. He was one that got it too. I asked him why they wasted a copy on him. From what I gathered, so he could open the program and then say he’s got mad skills.

Disc 1, Disc 2. Once it installed I was on my way to going through all the new features. Still had to setup. I can’t touch a new version of CS without setting up all my panels just like the previous one. Then I think about how the new feature panels fit into it. As I went to put the Help panel where it goes in my workspace I am redirected to Safari! I thought I was in Flash a second ago? I looked all over for a new place for the Help panel and came up with squat. Then (because Flash so generously opened my browser for me) I looked for others that were up-in-arms about this change as well. Google let me know I wasn’t alone.

I found this post where there is some kind of workaround for it. This doesn’t keep it in the IDE though. It just makes the help be local instead of on the internet. Which is faster, but doesn’t address the real problem. I like to look at the help and the code the same time, my Workspace is based on the premise that the Help panel is on my right side.

Apparently, Adobe has no intention of putting this back in the IDE. Looks like they are making the big push to get developers out of Flash and into Flex. Sure, it’s more money. Hey Adobe, I’ll use Flex because it is a better editor, not because you hack shit out of other programs to corral me into using it. All I can hope for now is that someone will develop an extension for Flash, basically an internal web browser like Flex, that can display help.