Thursday, June 24, 2010

Flash Actionscript Tweening

function tween(mc, what, easeType, begin, end, time, then, onWhat) {
if (easeType == 1) {
myEase = Regular.easeInOut;
} else if (easeType == 2) {
myEase = Strong.easeInOut;
} else if (easeType == 3) {
myEase = Regular.easeOut;
} else if (easeType == 4) {
myEase = Strong.easeOut;
} else if (easeType == 5) {
myEase = Regular.easeIn;
} else if (easeType == 6) {
myEase = Strong.easeIn;
} else if (easeType == 7) {
myEase = None.easeNone;
} else if (easeType == 8) {
myEase = Back.easeOut;
}

var myTween:Tween = new Tween(mc, what, myEase, begin, end, time, false);
myTween.onMotionFinished = function() {
if (then != null) {
then.call();
}
//this.yoyo();
};

};

Friday, February 5, 2010

IE6: Removing Padding on Input Checkbox

If you've ever put a background on an input checkbox and viewed it in IE6, you'll notice there is padding around the checkbox. Other browsers don't have this padding, and it can ruin designs if not dealt with.

An easy way to get rid of the padding through CSS is by adding these styles to the checkbox:

margin:0; width:13px; height:13px; overflow:hidden;

Doing this will not affect any other browser (at least modern ones) and will fix your IE6 issues.

Thursday, February 4, 2010

Images in LABEL tag no clickable in IE

Internet Explorer doesn't allow your images that are within a LABEL tag to be clickable. There is a javascript hack fix for this that works for sure in IE6-8. Sometimes you need, for usability, to have your images work like text in the LABEL tag, this is how you can accomplish this in IE.

Note that all other browsers do this fine...

Wednesday, December 16, 2009

My Flash to EXE fullscreen scalling settings

The new version of Flash Player when rendering an EXE document doesn't want to obey the "fscommand" for some reason. I don't know why, I don't care. This works just fine:

fscommand("fullscreen", true);
fscommand("allowscale", false);
fscommand("showmenu", false);
Stage.scaleMode = "showAll";

Thursday, December 3, 2009

CSS Selectors Browser Compatibility

Compatibility is one of the most annoying parts of web scripting and programming. I've found a great reference when it comes to CSS selectors. This should help you figure out what will work in old browsers and what you'll need to find a workaround for.

Wednesday, December 2, 2009

Hiding Text on Form Submit Button

I wanted to have CSS replace a submit button for one of the forms on my site. So I decided to style it with a background image and set a text-indent to hide the text. It worked nice but in Internet Explorer, the text wouldn't go away.

I found a strange way to make the text disappear even in Explorer. Just use this bit of CSS for the submit button.

{
color: transparent;
text-transform: capitalize;
}


That should do the trick!

Tuesday, November 17, 2009

Mute Streaming Audio in Flash

Muting sounds that are streaming in Flash isn't as simple as changing the volume of an object via a "mute" button. But it is surprisingly EASY! I can't believe I didn't see it. AND the movie continues to play and unmuting just brings the sound back in.... duh!

Well, I searched and searched and finally found something. Thanks (http://www.actionscript.org/forums/showthread.php3?t=32982)! I made some simple modifications.

This is my code. I made a MC with 2 frames and buttons in it. In frame 1, a button that calls "mute();" here's the button code for the one that's in frame 1.

on (release) {
nextFrame();
this._parent.mute();
}
And frame 2 has this:

on(release) {
prevFrame();
this._parent.unmute();
}

And here's the code in the root. I could easily make a volume slider that sets the "level" variable, and would then set. But for most stuff, we simply need the sound to be either there... or not.

level = 100;
globalSound = new Sound();
globalSound.setVolume(level);

function mute() {
trace("mute");
//previewaudio.stop();
globalSound.setVolume(0);
}
function unmute() {
trace("unmute");
globalSound.setVolume(100);
}

Enjoy!