From time to time you might find it necessary to track the cursor when working with Flash.  Fortunately, this is fairly easy.

As with all things Flash when dealing with values, you should create the variables beforehand so as to prevent loads of errors when compiling.

Here’s the code, it uses an Event Listener:

var yCoord:Number = 0;
var xCoord:Number = 0;

stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove); function mouseMove(event:MouseEvent){
yCoord = mouseY;
xCoord = mouseX;
} );

yCoord and xCoord would be your mouse coordinates.  This Event Listener is called on on the stage to ensure that you get the coordinates whenever the mouse moves across the stage.  In the event that you would like the mouse to be tracked only on a particular movie clip, exchange the “stage” identifier for the identifier of the movie clip you want to track the movements on.

Hope this helps someone…

/A\V/

Tagged with:
 

Today I was attempting to make a movie clip that would fade in on rollover and fade out on rollout.  The problem that I had, however, was that there are buttons placed inside this mc, and if you in turn mouse over them, it causes the whole thing to quickly fade out/in all over again – for whatever reason – making a blinking mess.

Anyway, after a rather frustrating search across google, I came across some interesting information.  There is, now, in AS3, a property called Mouse.cursor, and using it, along with event listeners, you can force the mouse cursor to be whatever you want it to be!

It has a total (that I know of) number of five different properties: ibeam, hand, arrow, button, and auto, and is formed as such:

Mouse.cursor = “ibeam”;
Mouse.cursor = “hand”;
Mouse.cursor = “arrow”;
Mouse.cursor = “button”;
Mouse.cursor = “auto”;

And you would put whichever one you need inside your rollover event listener.  Be sure to set it back to auto after you roll out, otherwise you could end up with a very confusing UI experience!

Hope this helps someone!

/A\V/

Tagged with:
 

If you, like me, set up your Bugzilla install based on IP initially (because you didn’t have the domain ready or whatever), and then you moved the Bugzilla box, either physically or electronically – either way changing your IP address – you might notice that your bugzilla only lets you go to the front page before rerouting you into blue hell somewhere – or nowhere at all.

This is because the configuration of Bugzilla is based off of a customizable URLbase (for security or some other important reason that I care too little about to follow up on) and if that URLbase is an IP address, such as http://123.456.789.100/bugzilla (No, that link doesn’t work.  Stop clicking it.), and your box is now located at, say, 987.654.321.001 (That’s not a real IP either.  Don’t bother trying.), you’ll need to change this URLbase – either to your new IP address, or – maybe you’d like to show some initiative (I know I didn’t!) – even an actual URL!  The only problem is…  that setting is in the administration area, and you can’t get there unless your URLbase is correct.  Damn those Catch-22’s.

Logically, this means we need to hand-edit the configuration file.  Unfortunately, it isn’t exactly labeled “configuration_files_VIM_me_to_fix_URLbase_problems.conf.”  Fortunately, I know where the file is.  Unfortunately, I’m no longer in a sharing mood.   Fortunately, I’m joking. Unfor….  Ok, I’ll stop.  Just please, please put down the gun…

Alright – you calm and relaxed again?  Good.  Alright – so, open up your Terminal Application (whichever that may be for your particular flavor of *Nix), and get yourself to the bugzilla root.  (Mine, for example, is in /var/www/bugzilla/)  Once you’ve gotten there, the rest is exceedingly easy.  navigate to the folder “data” and Vim (or vi, or kate or whatever) the file params.  You shouldn’t even need to sudo it.  Inside, you will find an actual alphabetical list of all the bugzilla parameters!  How amazing is that?  Page down to the U’s, find urlbase, and change it accordingly.  :wq (or…  well, you should know how to save and quit your favorite text editor) and simply log into your bugzilla – problem solved!

I’ll actually answer questions you might have on this one.  Or on bugz in general, should i know the answer, so feel free to ask.

Tagged with:
 

Whew that’s a long title.

Basically, i have a string that I have hashed out – for storage in a database.  It looks like this:

Name#123#345#456#678#789#

Now, the problem is – I need to get the first value from this string – before the first ‘#’ – but it could be of completely variable length.  This poses a problem – if all sections were of a set length this would be far easier.  Not to mention that the string as a whole could have a variable number of segments.

The solution – as I have found – is to use a nasty looking string in PHP to parse it out.  For the sake of this example, let’s call our nasty string up there $toParse.

<?php $name = substr($toParse, 0, strpos($toParse, "#")); ?>

This will, in turn, set the variable $name to ‘Name’.

Now – let’s say that I need to actually parse all of these sections.  This is also quite easy to accomplish.. We just execute this, plus one more bit – recursively.

<?php
$workingString = $toParse;
//While we still have some string left
while ($workingString != ""){
$name = substr($workingString, 0, strpos($workingString, "#"));
//Remove the previous entry and the previous hash
$workingString = substr($workingString, (strpos($workingString, "#")+1));
//Do whatever you intend to do with your $name result
}
?>

And… That’s pretty much it.

Tagged with:
 

Remember those of you who found this site purely by accident – this site is mostly for my own use.

That said – here for my reference – the Bash commands that I end up using most often with the php exec(); command or in the shell – here in case I forget them… again. (I can remember what everyone ate at my last job interview, yet I have trouble remembering simple shell commands… odd.)

Use sudo as needed!
(more…)

Tagged with:
 
Pro Palma Deus Unus